TripleTag::setPredicate()   A
last analyzed

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 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
/*
4
 * This file is part of the kaloa/metadata package.
5
 *
6
 * For full copyright and license information, please view the LICENSE file
7
 * that was distributed with this source code.
8
 */
9
10
namespace Kaloa\Metadata;
11
12
/**
13
 *
14
 */
15
final class TripleTag
16
{
17
    private $namespace = '';
18
    private $predicate = '';
19
    private $value = '';
20
21
    /**
22
     *
23
     * @param string $value
24
     * @param string $predicate
25
     * @param string $namespace
26
     */
27 7
    public function __construct($value = '', $predicate = '', $namespace = '')
28
    {
29 7
        $this->setValue($value);
30 7
        $this->setPredicate($predicate);
31 7
        $this->setNamespace($namespace);
32 7
    }
33
34 7
    public function setNamespace($newNamespace)
35
    {
36 7
        $this->namespace = trim($newNamespace);
37 7
    }
38
39 7
    public function setPredicate($newPredicate)
40
    {
41 7
        $this->predicate = trim($newPredicate);
42 7
    }
43
44 7
    public function setValue($newValue)
45
    {
46 7
        $this->value = trim($newValue);
47 7
    }
48
49 6
    public function getNamespace()
50
    {
51 6
        return $this->namespace;
52
    }
53
54 5
    public function getPredicate()
55
    {
56 5
        return $this->predicate;
57
    }
58
59 5
    public function getValue()
60
    {
61 5
        return $this->value;
62
    }
63
64 4
    public function equals(TripleTag $tripleTag)
65
    {
66
        return (
67 4
            $this->namespace === $tripleTag->getNamespace()
68 4
            && $this->predicate === $tripleTag->getPredicate()
69 4
            && $this->value === $tripleTag->getValue()
70 4
        );
71
    }
72
}
73