Browse Source

Updated the documentation

main
Cédric Belin 1 week ago
parent
commit
15f8c09a98
6 changed files with 17 additions and 17 deletions
  1. +6
    -6
      doc/advanced/events.md
  2. +3
    -3
      doc/advanced/testing.md
  3. +2
    -2
      doc/features/comment_check.md
  4. +2
    -2
      doc/features/key_verification.md
  5. +2
    -2
      doc/features/submit_ham.md
  6. +2
    -2
      doc/features/submit_spam.md

+ 6
- 6
doc/advanced/events.md View File

@@ -16,9 +16,9 @@ use Nyholm\Psr7\Uri;

function main(): void {
$client = new Client("123YourAPIKey", new Blog(new Uri("https://www.yourblog.com")));
$client->addListener(Client::eventRequest, function(RequestEvent $event) {
echo "Client request: ", $event->getRequest()->getUri();
});
$client->addListener(Client::eventRequest, fn(RequestEvent $event) =>
print "Client request: {$event->getRequest()->getUri()}"
);
}
```

@@ -32,8 +32,8 @@ use Nyholm\Psr7\Uri;

function main(): void {
$client = new Client("123YourAPIKey", new Blog(new Uri("https://www.yourblog.com")));
$client->addListener(Client::eventResponse, function(ResponseEvent $event) {
echo "Server response: ", $event->getResponse()->getStatusCode();
});
$client->addListener(Client::eventResponse, fn(ResponseEvent $event) =>
print "Server response: {$event->getResponse()->getStatusCode()}"
);
}
```

+ 3
- 3
doc/advanced/testing.md View File

@@ -19,7 +19,7 @@ function main(): void {
$client = new Client("123YourAPIKey", $blog);
$result = $client->checkComment($comment);
echo "It should be `CheckResult::isSpam`: ", $result;
print "It should be `CheckResult::isSpam`: $result";
}
```

@@ -41,7 +41,7 @@ function main(): void {
$client = new Client("123YourAPIKey", $blog);
$result = $client->checkComment($comment);
echo "It should be `CheckResult::isHam`: ", $result;
print "It should be `CheckResult::isHam`: $result";
}
```

@@ -62,7 +62,7 @@ function main(): void {
$blog = new Blog(new Uri("https://www.yourblog.com"));
$client = (new Client("123YourAPIKey", $blog))->setTest(true);
echo "It should not influence subsequent calls.";
print "It should not influence subsequent calls.";
$client->checkComment($comment);
}
```

+ 2
- 2
doc/features/comment_check.md View File

@@ -49,11 +49,11 @@ function main(): void {
$client = new Client("123YourAPIKey", $blog);

$result = $client->checkComment($comment);
echo $result == CheckResult::isHam ? "The comment is ham." : "The comment is spam.";
print $result == CheckResult::isHam ? "The comment is ham." : "The comment is spam.";
}

catch (ClientException $e) {
echo "An error occurred: ", $e->getMessage();
print "An error occurred: {$e->getMessage()}";
}
}
```


+ 2
- 2
doc/features/key_verification.md View File

@@ -38,11 +38,11 @@ function main(): void {
$client = new Client("123YourAPIKey", $blog);

$isValid = $client->verifyKey();
echo $isValid ? "The API key is valid." : "The API key is invalid.";
print $isValid ? "The API key is valid." : "The API key is invalid.";
}

catch (ClientException $e) {
echo "An error occurred: ", $e->getMessage();
print "An error occurred: {$e->getMessage()}";
}
}
```

+ 2
- 2
doc/features/submit_ham.md View File

@@ -41,12 +41,12 @@ function main(): void {
$result = $client->checkComment($comment);
// Got `CheckResult::isSpam`, but `CheckResult::isHam` expected.

echo "The comment was incorrectly classified as spam.";
print "The comment was incorrectly classified as spam.";
$client->submitHam($comment);
}

catch (ClientException $e) {
echo "An error occurred: ", $e->getMessage();
print "An error occurred: {$e->getMessage()}";
}
}
```

+ 2
- 2
doc/features/submit_spam.md View File

@@ -43,12 +43,12 @@ function main(): void {
$result = $client->checkComment($comment);
// Got `CheckResult::isHam`, but `CheckResult::isSpam` expected.

echo "The comment was incorrectly classified as ham.";
print "The comment was incorrectly classified as ham.";
$client->submitSpam($comment);
}

catch (ClientException $e) {
echo "An error occurred: ", $e->getMessage();
print "An error occurred: {$e->getMessage()}";
}
}
```

Loading…
Cancel
Save