Passed
Push — master ( 54ac54...9db44e )
by Sebastian
05:57
created

IsUncertainDate::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 4
ccs 3
cts 3
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
use stdClass;
13
14
/**
15
 * Class isUncertainDate
16
 * Tests whether the given date variables contain approximate dates.
17
 *
18
 * @package Seboettg\CiteProc\Constraint
19
 *
20
 * @author Sebastian Böttger <[email protected]>
21
 */
22
/** @noinspection PhpUnused */
7 ignored issues
show
Coding Style introduced by
The open comment tag must be the only content on the line
Loading history...
Coding Style introduced by
Missing short description in doc comment
Loading history...
Coding Style introduced by
The close comment tag must be the only content on the line
Loading history...
Coding Style introduced by
Missing @category tag in class comment
Loading history...
Coding Style introduced by
Missing @package tag in class comment
Loading history...
Coding Style introduced by
Missing @author 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...
23
class IsUncertainDate extends AbstractConstraint
24
{
25
26
    /**
1 ignored issue
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
27
     * @param string $variable
3 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 3 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Tag value for @param tag indented incorrectly; expected 2 spaces but found 1
Loading history...
28
     * @param stdClass $data ;
1 ignored issue
show
Coding Style introduced by
Expected 5 spaces after parameter name; 1 found
Loading history...
Coding Style introduced by
Tag value for @param tag indented incorrectly; expected 2 spaces but found 1
Loading history...
29
     * @return bool
1 ignored issue
show
Coding Style introduced by
Tag @return cannot be grouped with parameter tags in a doc comment
Loading history...
30
     */
31 10
    protected function matchForVariable($variable, $data)
32
    {
33 10
        if (!empty($data->{$variable})) {
34 7
            if (isset($data->{$variable}->{'circa'})) {
35 1
                return true;
36
            }
37
        }
38 10
        return false;
39
    }
40
}
41