GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

HttpMethodCondition   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 27
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A evaluate() 0 6 1
1
<?php
2
/**
3
 * Phossa Project
4
 *
5
 * PHP version 5.4
6
 *
7
 * @category  Library
8
 * @package   Phossa2\Middleware
9
 * @copyright Copyright (c) 2016 phossa.com
10
 * @license   http://mit-license.org/ MIT License
11
 * @link      http://www.phossa.com/
12
 */
13
/*# declare(strict_types=1); */
14
15
namespace Phossa2\Middleware\Condition;
16
17
use Psr\Http\Message\RequestInterface;
18
use Psr\Http\Message\ResponseInterface;
19
use Phossa2\Shared\Base\ObjectAbstract;
20
use Phossa2\Middleware\Interfaces\ConditionInterface;
21
22
/**
23
 * HttpMethodCondition
24
 *
25
 * @package Phossa2\Middleware
26
 * @author  Hong Zhang <[email protected]>
27
 * @see     ObjectAbstract
28
 * @see     ConditionInterface
29
 * @version 2.0.0
30
 * @since   2.0.0 added
31
 */
32
class HttpMethodCondition extends ObjectAbstract implements ConditionInterface
33
{
34
    /**
35
     * @var    string[]
36
     * @access protected
37
     */
38
    protected $methods;
39
40
    /**
41
     * @param  string|string[] $methods
42
     * @access public
43
     */
44
    public function __construct($methods)
45
    {
46
        $this->methods = (array) $methods;
47
    }
48
49
    /**
50
     * {@inheritDoc}
51
     */
52
    public function evaluate(
53
        RequestInterface $request,
54
        ResponseInterface $response
55
    )/*# : bool */ {
56
        return in_array($request->getMethod(), $this->methods);
57
    }
58
}
59