Completed
Push — master ( e2dc10...6f7e0c )
by Richard
06:21
created

DependOn::variables()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 3
Ratio 100 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 3
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
/******************************************************************************
3
 * An implementation of dicto (scg.unibe.ch/dicto) in and for PHP.
4
 * 
5
 * Copyright (c) 2016 Richard Klees <[email protected]>
6
 *
7
 * This software is licensed under The MIT License. You should have received 
8
 * a copy of the licence along with the code.
9
 */
10
11
namespace Lechimp\Dicto\Definition\Rules;
12
use Lechimp\Dicto\Definition\Variables as Vars;
13
14 View Code Duplication
class DependOn extends Rule {
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
15
    /**
16
     * @var Vars\Variable
17
     */
18
    private $dependency;
19
20
    /**
21
     * @param string $mode
22
     */
23 140
    public function __construct($mode, Vars\Variable $left, Vars\Variable $dependency) {
24 140
        parent::__construct($mode, $left);
25 140
        $this->dependency = $dependency;
26 140
    }
27
28
    /**
29
     * @var Variable
30
     */
31 27
    public function dependency() {
32 27
        return $this->dependency;
33
    }
34
35
    public function invoke(Functions $fun) {
36
        return InvokeRule($this, $fun);
37
    }
38
39
    /**
40
     * @inheritdoc
41
     */
42
    public function explain($text) {
43
        $r = new DependOnRule($this->mode(), $this->subject(), $this->dependency);
44
        $r->setExplanation($text);
45
        return $r;
46
    }
47
48
    /**
49
     * @inheritdoc
50
     */
51 1
    public function variables() {
52 1
        return array($this->subject(), $this->dependency);
53
    }
54
}
55