IsUncertainDate::matchForVariable()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 4
nc 3
nop 2
dl 0
loc 8
rs 10
c 0
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
/*
4
 * citeproc-php
5
 *
6
 * @link        http://github.com/seboettg/citeproc-php for the source repository
7
 * @copyright   Copyright (c) 2016 Sebastian Böttger.
8
 * @license     https://opensource.org/licenses/MIT
9
 */
10
11
namespace Seboettg\CiteProc\Constraint;
12
13
use stdClass;
14
15
class IsUncertainDate extends AbstractConstraint
16
{
17
18
    /**
19
     * @param string $variable
20
     * @param stdClass $data ;
21
     * @return bool
22
     */
23
    protected function matchForVariable(string $variable, stdClass $data): bool
24
    {
25
        if (!empty($data->{$variable})) {
26
            if (isset($data->{$variable}->{'circa'})) {
27
                return true;
28
            }
29
        }
30
        return false;
31
    }
32
}
33