Code Duplication    Length = 9-9 lines in 4 locations

src/Core/Component/Blog/Application/Repository/DQL/PostRepository.php 1 location

@@ 116-124 (lines=9) @@
113
        return $this->queryService->query($dqlQuery)->getSingleResult();
114
    }
115
116
    public function findBySlug(string $slug): Post
117
    {
118
        $dqlQuery = $this->dqlQueryBuilder->create(Post::class)
119
            ->where('Post.slug = :slug')
120
            ->setParameter('slug', $slug)
121
            ->build();
122
123
        return $this->queryService->query($dqlQuery)->getSingleResult();
124
    }
125
126
    public function add(Post $entity): void
127
    {

src/Core/Component/User/Application/Repository/DQL/UserRepository.php 3 locations

@@ 96-104 (lines=9) @@
93
        return $this->queryService->query($this->dqlQueryBuilder->build());
94
    }
95
96
    public function findOneByUsername(string $username): User
97
    {
98
        $dqlQuery = $this->dqlQueryBuilder->create(User::class)
99
            ->where('User.username = :username')
100
            ->setParameter('username', $username)
101
            ->build();
102
103
        return $this->queryService->query($dqlQuery)->getSingleResult();
104
    }
105
106
    public function findOneByEmail(string $email): User
107
    {
@@ 106-114 (lines=9) @@
103
        return $this->queryService->query($dqlQuery)->getSingleResult();
104
    }
105
106
    public function findOneByEmail(string $email): User
107
    {
108
        $dqlQuery = $this->dqlQueryBuilder->create(User::class)
109
            ->where('User.email = :email')
110
            ->setParameter('email', $email)
111
            ->build();
112
113
        return $this->queryService->query($dqlQuery)->getSingleResult();
114
    }
115
116
    public function findOneById(UserId $id): User
117
    {
@@ 116-124 (lines=9) @@
113
        return $this->queryService->query($dqlQuery)->getSingleResult();
114
    }
115
116
    public function findOneById(UserId $id): User
117
    {
118
        $dqlQuery = $this->dqlQueryBuilder->create(User::class)
119
            ->where('User.id = :id')
120
            ->setParameter('id', $id)
121
            ->build();
122
123
        return $this->queryService->query($dqlQuery)->getSingleResult();
124
    }
125
126
    /**
127
     * @return User[]