Code Duplication    Length = 11-11 lines in 2 locations

src/Junty/TaskRunner/Runner/Runner.php 2 locations

@@ 35-45 (lines=11) @@
32
        $this->groups = new GroupsCollection();
33
    }
34
35
    public function group($group, callable $tasks = null)
36
    {
37
        $_name = $group instanceof GroupInterface ? $group->getName() : $group;
38
39
        if ($this->tasks->containsKey($_name)) {
40
            throw new \Exception('Is not possible to register a group and a task with the same name.');
41
        }
42
43
        $this->groups->set($group, $tasks);
44
        $this->order[] = 'group::' . $_name;
45
    }
46
47
    /**
48
     * Registres a task
@@ 53-63 (lines=11) @@
50
     * @param string|TaskInterface $task
51
     * @param callable             $callback
52
     */
53
    public function task($task, callable $callback = null)
54
    {
55
        $_name = $task instanceof TaskInterface ? $task->getName() : $task;
56
57
        if ($this->groups->containsKey($_name)) {
58
            throw new \Exception('Is not possible to register a group and a task with the same name.');
59
        }
60
61
        $this->tasks->set($task, $callback);
62
        $this->order[] = 'task::' . $_name;
63
    }
64
65
    /**
66
     * Allows create a task setting a property