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.

ExpressionCondition   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
c 1
b 0
f 1
lcom 1
cbo 2
dl 0
loc 26
ccs 6
cts 6
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A holdsFor() 0 4 1
1
<?php
2
/**
3
 * Copyright (c) 2016, HelloFresh GmbH.
4
 * All rights reserved.
5
 *
6
 * This source code is licensed under the MIT license found in the
7
 * LICENSE file in the root directory of this source tree.
8
 */
9
10
namespace HelloFresh\FeatureToggle;
11
12
use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
13
14
/**
15
 * A condition written as a symfony language expression that gets evaluated against the
16
 * full context, allowing access to several keys of the context in a single condition
17
 */
18
class ExpressionCondition implements ConditionInterface
19
{
20
    /** @var string */
21
    protected $expression;
22
23
    /** @var ExpressionLanguage */
24
    protected $language;
25
26
    /**
27
     * @param string $expression The expression to ve evaluated
28
     * @param ExpressionLanguage $language The instance of the Expression Language
29
     */
30 5
    function __construct($expression, ExpressionLanguage $language)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
Comprehensibility Best Practice introduced by
It is recommend to declare an explicit visibility for __construct.

Generally, we recommend to declare visibility for all methods in your source code. This has the advantage of clearly communication to other developers, and also yourself, how this method should be consumed.

If you are not sure which visibility to choose, it is a good idea to start with the most restrictive visibility, and then raise visibility as needed, i.e. start with private, and only raise it to protected if a sub-class needs to have access, or public if an external class needs access.

Loading history...
31
    {
32 5
        $this->expression = $expression;
33 5
        $this->language = $language;
34 5
    }
35
36
    /**
37
     * @inheritdoc
38
     */
39 5
    public function holdsFor(Context $context)
40
    {
41 5
        return $this->language->evaluate($this->expression, $context->toArray()) === true;
42
    }
43
}