Code Duplication    Length = 12-14 lines in 2 locations

PHPDaemon/Structures/StackCallbacks.php 2 locations

@@ 28-41 (lines=14) @@
25
     * @param  mixed ...$args Arguments
26
     * @return boolean
27
     */
28
    public function executeOne(...$args)
29
    {
30
        if ($this->isEmpty()) {
31
            return false;
32
        }
33
        $cb = $this->shift();
34
        if ($cb) {
35
            $cb(...$args);
36
            if ($cb instanceof CallbackWrapper) {
37
                $cb->cancel();
38
            }
39
        }
40
        return true;
41
    }
42
43
    /**
44
     * Executes one callback from the top with given arguments without taking it out
@@ 48-59 (lines=12) @@
45
     * @param  mixed ...$args Arguments
46
     * @return boolean
47
     */
48
    public function executeAndKeepOne(...$args)
49
    {
50
        if ($this->isEmpty()) {
51
            return false;
52
        }
53
        $cb = $this->shift();
54
        $this->unshift($cb);
55
        if ($cb) {
56
            $cb(...$args);
57
        }
58
        return true;
59
    }
60
61
    /**
62
     * Push callback to the top of stack