Code Duplication    Length = 15-20 lines in 2 locations

src/Definition/Fluid/AsWellAs.php 1 location

@@ 17-36 (lines=20) @@
14
/**
15
 * Provides fluid interface to as_well_as().
16
 */
17
class AsWellAs extends Base {
18
    /**
19
     * Say to mean this class as well as the other class defined before.
20
     */
21
    public function __call($name, $arguments) {
22
        if (count($arguments) != 0) {
23
            # ToDo: This is used in Dicto::__callstatic as well.
24
            throw new \InvalidArgumentException(
25
                "No arguments are allowed for the reference to a variable.");
26
        }
27
28
        $left = $this->rt->get_current_var();
29
        $right = $this->rt->get_var($name);
30
        assert('$left instanceof \\Lechimp\\Dicto\\Definition\\Variables\\Variable');
31
        $this->rt->current_var_is(
32
            new Vars\AsWellAs($this->rt->get_current_var_name(), $left, $right));
33
34
        return new ExistingVar($this->rt);
35
    }
36
}
37

src/Definition/Fluid/ButNot.php 1 location

@@ 17-31 (lines=15) @@
14
/**
15
 * Provides fluid interface to as_well_as().
16
 */
17
class ButNot extends Base {
18
    public function __call($name, $arguments) {
19
        if (count($arguments) != 0) {
20
            # ToDo: This is used in Dicto::__callstatic as well.
21
            throw new \InvalidArgumentException(
22
                "No arguments are allowed for the reference to a variable.");
23
        }
24
25
        $left = $this->rt->get_current_var();
26
        $right = $this->rt->get_var($name);
27
        assert('$left instanceof \\Lechimp\\Dicto\\Definition\\Variables\\Variable');
28
        $this->rt->current_var_is(
29
            new Vars\ButNot($this->rt->get_current_var_name(), $left, $right));
30
    }
31
}
32