Code Duplication    Length = 9-10 lines in 2 locations

Todo/Infrastructure/Persistence/Eloquent/Repository/TaskRepository.php 2 locations

@@ 62-70 (lines=9) @@
59
    /**
60
     * @inheritDoc
61
     */
62
    public function find($id): Task
63
    {
64
        $results = DB::table('tasks')->where('id', $id)->get();
65
        if (count($results) === 0) {
66
            throw new TaskNotFoundException("Cannot find task with id $id");
67
        }
68
69
        return $this->hydrateTask($results[0]);
70
    }
71
72
    /**
73
     * @inheritDoc
@@ 91-100 (lines=10) @@
88
    /**
89
     * @inheritDoc
90
     */
91
    public function findByName(string $name): Task
92
    {
93
        $results = DB::table('tasks')->where('name', $name)->get();
94
95
        if (count($results) === 0) {
96
            throw new TaskNotFoundException("Cannot find task with name $name");
97
        }
98
99
        return $this->hydrateTask($results[0]);
100
    }
101
102
    /**
103
     * @inheritDoc