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}
@@ 96-105 (lines=10) @@
93
    /**
94
     * {@inheritdoc}
95
     */
96
    public function fileOfName(FileName $aName)
97
    {
98
        $statement = $this->execute('SELECT * FROM file WHERE name = :name AND extension = :extension', [
99
            'name'      => $aName->name(),
100
            'extension' => $aName->extension(),
101
        ]);
102
        if ($row = $statement->fetch(\PDO::FETCH_ASSOC)) {
103
            return $this->buildFile($row);
104
        }
105
    }
106
107
    /**
108
     * {@inheritdoc}
@@ 110-118 (lines=9) @@
107
    /**
108
     * {@inheritdoc}
109
     */
110
    public function all()
111
    {
112
        $statement = $this->execute('SELECT * FROM file');
113
        if ($rows = $statement->fetch(\PDO::FETCH_ASSOC)) {
114
            return array_map(function ($row) {
115
                return $this->buildFile($row);
116
            }, $rows);
117
        }
118
    }
119
120
    /**
121
     * {@inheritdoc}