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}
@@ 72-81 (lines=10) @@
69
    /**
70
     * {@inheritdoc}
71
     */
72
    public function fileOfName(FileName $aName)
73
    {
74
        $statement = $this->execute('SELECT * FROM file WHERE name = :name AND extension = :extension', [
75
            'name'      => $aName->name(),
76
            'extension' => $aName->extension(),
77
        ]);
78
        if ($row = $statement->fetch(\PDO::FETCH_ASSOC)) {
79
            return $this->buildFile($row);
80
        }
81
    }
82
83
    /**
84
     * {@inheritdoc}
@@ 86-94 (lines=9) @@
83
    /**
84
     * {@inheritdoc}
85
     */
86
    public function all()
87
    {
88
        $statement = $this->execute('SELECT * FROM file');
89
        if ($rows = $statement->fetch(\PDO::FETCH_ASSOC)) {
90
            return array_map(function ($row) {
91
                return $this->buildFile($row);
92
            }, $rows);
93
        }
94
    }
95
96
    /**
97
     * {@inheritdoc}