NoCategorySourceConfigException::getName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 1 Features 1
Metric Value
eloc 1
c 1
b 1
f 1
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\TranslatorExtractor\Exception;
6
7
use RuntimeException;
8
use Yiisoft\FriendlyException\FriendlyExceptionInterface;
9
10
class NoCategorySourceConfigException extends RuntimeException implements FriendlyExceptionInterface
11
{
12 1
    public function getName(): string
13
    {
14 1
        return 'Please provide a list of CategorySource';
15
    }
16
17
    public function getSolution(): ?string
18
    {
19
        return <<<'SOLUTION'
20
`CategorySource` to be used should be specified in your console container definitions file:
21
22
```php
23
use Yiisoft\Definitions\DynamicReferencesArray;
24
use Yiisoft\Translator\Message\Php\MessageSource;
25
use Yiisoft\TranslatorExtractor\Extractor;
26
27
return [
28
    Extractor::class => [
29
        '__construct()' => [
30
            DynamicReferencesArray::from([
31
                static fn (Aliases $aliases) => new MessageSource($aliases->get('@message')),
32
            ])
33
        ],
34
    ],
35
];
36
```
37
SOLUTION;
38
    }
39
}
40