Code Duplication    Length = 14-14 lines in 2 locations

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

@@ 67-80 (lines=14) @@
64
    /**
65
     * @return Post[]
66
     */
67
    public function findAll(array $orderByList = ['id' => 'DESC'], int $maxResults = null): ResultCollectionInterface
68
    {
69
        $this->dqlQueryBuilder->create(Post::class);
70
71
        foreach ($orderByList as $property => $direction) {
72
            $this->dqlQueryBuilder->orderBy('Post.' . $property, $direction);
73
        }
74
75
        if ($maxResults) {
76
            $this->dqlQueryBuilder->setMaxResults($maxResults);
77
        }
78
79
        return $this->queryService->query($this->dqlQueryBuilder->build());
80
    }
81
82
    /**
83
     * @return Post[]

src/Core/Component/User/Application/Repository/DQL/UserRepository.php 1 location

@@ 81-94 (lines=14) @@
78
    /**
79
     * @return User[]
80
     */
81
    public function findAll(array $orderByList = ['id' => 'DESC'], int $maxResults = null): ResultCollectionInterface
82
    {
83
        $this->dqlQueryBuilder->create(User::class);
84
85
        foreach ($orderByList as $property => $direction) {
86
            $this->dqlQueryBuilder->orderBy('User.' . $property, $direction);
87
        }
88
89
        if ($maxResults) {
90
            $this->dqlQueryBuilder->setMaxResults($maxResults);
91
        }
92
93
        return $this->queryService->query($this->dqlQueryBuilder->build());
94
    }
95
96
    public function findOneByUsername(string $username): User
97
    {