Code Duplication    Length = 7-10 lines in 3 locations

src/BenGorFile/File/Infrastructure/Persistence/Sql/SqlFileRepository.php 3 locations

@@ 61-67 (lines=7) @@
58
    /**
59
     * {@inheritdoc}
60
     */
61
    public function fileOfId(FileId $anId)
62
    {
63
        $statement = $this->execute('SELECT * FROM file WHERE id = :id', ['id' => $anId->id()]);
64
        if ($row = $statement->fetch(\PDO::FETCH_ASSOC)) {
65
            return $this->buildFile($row);
66
        }
67
    }
68
69
    /**
70
     * {@inheritdoc}
@@ 88-97 (lines=10) @@
85
    /**
86
     * {@inheritdoc}
87
     */
88
    public function fileOfName(FileName $aName)
89
    {
90
        $statement = $this->execute('SELECT * FROM file WHERE name = :name AND extension = :extension', [
91
            'name'      => $aName->name(),
92
            'extension' => $aName->extension(),
93
        ]);
94
        if ($row = $statement->fetch(\PDO::FETCH_ASSOC)) {
95
            return $this->buildFile($row);
96
        }
97
    }
98
99
    /**
100
     * {@inheritdoc}
@@ 102-110 (lines=9) @@
99
    /**
100
     * {@inheritdoc}
101
     */
102
    public function all()
103
    {
104
        $statement = $this->execute('SELECT * FROM file');
105
        if ($rows = $statement->fetch(\PDO::FETCH_ASSOC)) {
106
            return array_map(function ($row) {
107
                return $this->buildFile($row);
108
            }, $rows);
109
        }
110
    }
111
112
    /**
113
     * {@inheritdoc}