Passed
Push — master ( d2184e...ee1eb5 )
by Sebastian
04:46
created

Variable::validate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 2
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
/*
1 ignored issue
show
Coding Style introduced by
You must use "/**" style comments for a file comment
Loading history...
3
 * citeproc-php
4
 *
5
 * @link        http://github.com/seboettg/citeproc-php for the source repository
6
 * @copyright   Copyright (c) 2016 Sebastian Böttger.
7
 * @license     https://opensource.org/licenses/MIT
8
 */
9
10
namespace Seboettg\CiteProc\Constraint;
11
12
13
/**
14
 * Class Variable
15
 * @package Seboettg\CiteProc\Choose\Constraint
1 ignored issue
show
Coding Style introduced by
There must be exactly one blank line before the tags in a doc comment
Loading history...
16
 *
17
 * @author Sebastian Böttger <[email protected]>
18
 */
3 ignored issues
show
Coding Style introduced by
Missing @category tag in class comment
Loading history...
Coding Style introduced by
Missing @license tag in class comment
Loading history...
Coding Style introduced by
Missing @link tag in class comment
Loading history...
19
class Variable implements ConstraintInterface
20
{
21
22
    private $name;
0 ignored issues
show
Coding Style introduced by
Private member variable "name" must be prefixed with an underscore
Loading history...
23
24 32
    public function __construct($name, $match = null)
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function __construct()
Loading history...
Unused Code introduced by
The parameter $match is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

24
    public function __construct($name, /** @scrutinizer ignore-unused */ $match = null)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
25
    {
26 32
        $this->name = $name;
27 32
    }
28
    /**
1 ignored issue
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
Coding Style introduced by
Parameter $value should have a doc-comment as per coding-style.
Loading history...
29
     * @param $value
1 ignored issue
show
Coding Style Documentation introduced by
Missing parameter name
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
30
     * @param int|null $citationNumber
2 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
31
     * @return bool
1 ignored issue
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
32
     */
33 24
    public function validate($value, $citationNumber = null)
34
    {
35 24
        return !empty($value->{$this->name});
36
    }
37
}
38