PaginatorNotSetException::getSolution()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 0
cp 0
crap 2
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Yii\DataView\Exception;
6
7
use RuntimeException;
8
use Yiisoft\FriendlyException\FriendlyExceptionInterface;
9
10
final class PaginatorNotSetException extends RuntimeException implements FriendlyExceptionInterface
11
{
12 1
    public function __construct(string $message = '')
13
    {
14 1
        $message = $message === '' ? $this->getName() : $message;
15 1
        parent::__construct($message);
16
    }
17
18 1
    public function getName(): string
19
    {
20 1
        return 'Failed to create widget because "paginator" is not set.';
21
    }
22
23
    public function getSolution(): ?string
24
    {
25
        return <<<SOLUTION
26
            You can configure the `paginator` property in the widget configuration. Use either `OffSetPaginator::class`
27
            or `KeySetPaginator::class` as paginator.
28
            For more information [see the documentation](https://github.com/yiisoft/data).
29
        SOLUTION;
30
    }
31
}
32