Code Duplication    Length = 15-17 lines in 4 locations

src/Entity/CredentialRepository.php 2 locations

@@ 12-26 (lines=15) @@
9
     *
10
     * @return array
11
     */
12
    public function findAll()
13
    {
14
        $sql    = 'SELECT * FROM credential ORDER BY idCred DESC';
15
        $result = $this->db->prepare($sql);
16
        $result->execute();
17
        $result      = $result->fetchAll();
18
        $credentials = array();
19
20
        foreach ($result as $row) {
21
            $credentialId               = $row['idCred'];
22
            $credentials[$credentialId] = $this->buildDomainObject($row);
23
        }
24
25
        return $credentials;
26
    }
27
28
    /**
29
     * @param integer $id
@@ 73-87 (lines=15) @@
70
    /**
71
     * @return array
72
     */
73
    public function findAllAsArray()
74
    {
75
        $sql    = 'SELECT idCred, nameCred FROM credential ORDER BY idCred DESC';
76
        $result = $this->db->prepare($sql);
77
        $result->execute();
78
        $result      = $result->fetchAll();
79
        $credentials = array();
80
81
        foreach ($result as $row) {
82
            $id               = $row['idCred'];
83
            $credentials[$id] = $row['nameCred'];
84
        }
85
86
        return $credentials;
87
    }
88
    
89
    /**
90
     * @param $repoHook

src/Entity/ProjectRepository.php 2 locations

@@ 10-24 (lines=15) @@
7
    /**
8
     * @return array
9
     */
10
    public function findAll()
11
    {
12
        $sql     = 'SELECT * FROM project AS p LEFT JOIN credential AS c ON p.credential = c.idCred ORDER BY p.id DESC';
13
        $results = $this->db->prepare($sql);
14
        $results->execute();
15
        $results  = $results->fetchAll();
16
        $projects = array();
17
18
        foreach ($results as $row) {
19
            $projectId            = $row['id'];
20
            $projects[$projectId] = $this->buildDomainObject($row);
21
        }
22
23
        return $projects;
24
    }
25
26
    /**
27
     * @param $id
@@ 77-93 (lines=17) @@
74
     *
75
     * @return array
76
     */
77
    public function findBranch($repoHook)
78
    {
79
        $sql    = 'SELECT branch FROM project WHERE name = :name AND alive = 1;';
80
        $result = $this->db->prepare($sql);
81
        $result->bindValue(':name', $repoHook);
82
        $result->execute();
83
        $result   = $result->fetchAll();
84
85
        $branches = array();
86
87
        foreach ($result as $row) {
88
            $branch     = $row['branch'];
89
            $branches[] = $branch;
90
        }
91
92
        return $branches;
93
    }
94
95
    /**
96
     * @param $repoHook