Implementation::getProperty()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace LegalThings\DataEnricher\Processor;
4
5
use LegalThings\DataEnricher\Node;
6
7
/**
8
 * Basic stuff for a processor implementation
9
 */
10
trait Implementation
11
{
12
    /**
13
     * Property key which should trigger the processor
14
     * @var string
15
     */
16
    protected $property;
17
    
18
    /**
19
     * Apply processing to a single node
20
     * 
21
     * @param Node $node
22
     * @return void
23
     */
24
    abstract public function applyToNode(Node $node);
25
    
26
    /**
27
     * Class constructor
28
     * 
29
     * @param string $property  Property key with the processing instruction
30
     */
31 5
    public function __construct($property)
32
    {
33 5
        $this->property = $property;
34 5
    }
35
    
36
    /**
37
     * Doesn't apply, simply return processor
38
     * 
39
     * @param object       $source  Data source
40
     * @param array|object $target  Target or dot key path
41
     */
42 2
    public function withSourceAndTarget($source, $target)
0 ignored issues
show
Unused Code introduced by
The parameter $source is not used and could be removed.

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

Loading history...
Unused Code introduced by
The parameter $target is not used and could be removed.

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

Loading history...
43
    {
44 2
        return $this;
45
    }
46
    
47
    /**
48
     * Get the property key that holds the processing instruction
49
     * 
50
     * @return string
51
     */
52 3
    public function getProperty()
53
    {
54 3
        return $this->property;
55
    }
56
}
57