tigitz /
php-spellchecker
| 1 | <?php |
||
| 2 | declare(strict_types=1); |
||
| 3 | |||
| 4 | namespace PhpSpellCheck\MisspellingHandler; |
||
| 5 | |||
| 6 | use PhpSpellcheck\MisspellingInterface; |
||
| 7 | |||
| 8 | class EmailMisspellingHandler implements MisspellingHandlerInterface |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * @var EmailSenderInterface |
||
|
0 ignored issues
–
show
|
|||
| 12 | */ |
||
| 13 | private $emailSender; |
||
| 14 | |||
| 15 | public function __construct(EmailSenderInterface $emailSender) |
||
| 16 | { |
||
| 17 | $this->emailSender = $emailSender; |
||
| 18 | } |
||
| 19 | |||
| 20 | /** |
||
| 21 | * @param MisspellingInterface[] $misspellings |
||
| 22 | */ |
||
| 23 | public function handle(iterable $misspellings) |
||
| 24 | { |
||
| 25 | $message = <<<MSG |
||
| 26 | Dear me, |
||
| 27 | |||
| 28 | You're bad at writing. |
||
| 29 | |||
| 30 | Here's the proof: |
||
| 31 | |||
| 32 | MSG; |
||
| 33 | foreach ($misspellings as $misspelling) { |
||
| 34 | $message .= \Safe\sprintf( |
||
| 35 | 'You wrote "%s" at line %d in the article "%s" but it\'s a misspelling. Here\'s my suggestions: %s', |
||
| 36 | $misspelling->getWord(), |
||
| 37 | $misspelling->getLineNumber(), |
||
| 38 | $misspelling->getContext()['article-name'], |
||
| 39 | explode(',', $misspelling->getSuggestions()) |
||
| 40 | ).PHP_EOL; |
||
| 41 | } |
||
| 42 | |||
| 43 | $this->emailSender |
||
| 44 | ->body($message) |
||
| 45 | ->send(); |
||
| 46 | } |
||
| 47 | } |
||
| 48 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths