PaginatorNotSetException   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 16
ccs 5
cts 5
cp 1
rs 10
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 2
A getName() 0 3 1
A getSolution() 0 3 1
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