PageIndexShouldNotBeNegativeException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
dl 0
loc 14
rs 10
c 1
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getI18n() 0 7 1
A __construct() 0 3 1
1
<?php
2
namespace W2w\Lib\Apie\Exceptions;
3
4
use W2w\Lib\ApieObjectAccessNormalizer\Exceptions\ApieException;
5
use W2w\Lib\ApieObjectAccessNormalizer\Exceptions\LocalizationableException;
6
use W2w\Lib\ApieObjectAccessNormalizer\Exceptions\LocalizationInfo;
7
8
/**
9
 * Exception thrown when the page index filled in for pagination is negative.
10
 */
11
class PageIndexShouldNotBeNegativeException extends ApieException implements LocalizationableException
12
{
13
    public function __construct()
14
    {
15
        parent::__construct(422, 'Page index should not be negative!');
16
    }
17
18
    public function getI18n(): LocalizationInfo
19
    {
20
        return new LocalizationInfo(
21
            'validation.min',
22
            [
23
                'value' => 'page',
24
                'minimum' => 0
25
            ]
26
        );
27
    }
28
}
29