ArticleListMethodValidator::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace Stp\SndApi\News\Validator;
4
5
use Stp\SndApi\Common\ValidatorInterface;
6
7
class ArticleListMethodValidator implements ValidatorInterface
8
{
9
    private $allowedMethods = [
10
        'desked',
11
        'auto'
12
    ];
13
14
    private $method;
15
16
    /**
17
     * @param string $method
18
     */
19
    public function __construct($method)
20
    {
21
        $this->method = $method;
22
    }
23
24
    /**
25
     * @return bool
26
     */
27
    public function isValid()
28
    {
29
        return in_array($this->method, $this->allowedMethods);
30
    }
31
}
32