Code Duplication    Length = 17-21 lines in 2 locations

src/WebHemi/Middleware/Action/Website/IndexAction.php 2 locations

@@ 163-183 (lines=21) @@
160
     * @param int $applicationId
161
     * @return array
162
     */
163
    protected function getPublicationAuthor(int $userId, int $applicationId) : array
164
    {
165
        /** @var Entity\User\UserEntity $user */
166
        $user = $this->getUserStorage()
167
            ->getUserById($userId);
168
169
        /** @var array $userMeta */
170
        $userMeta = $this->getUserMetaStorage()
171
            ->getUserMetaArrayForUserId($userId);
172
173
        /** @var array $userDirectoryData */
174
        $userDirectoryData = $this->getFilesystemDirectoryStorage()
175
            ->getDirectoryDataByApplicationAndProxy($applicationId, ProxyInterface::LIST_USER);
176
177
        return [
178
            'userId' => $userId,
179
            'username' => $user->getUserName(),
180
            'url' => $userDirectoryData['uri'].'/'.$user->getUserName(),
181
            'meta' => $userMeta,
182
        ];
183
    }
184
185
    /**
186
     * Generates the content path.
@@ 241-257 (lines=17) @@
238
     * @param int $categoryId
239
     * @return array
240
     */
241
    protected function getPublicationCategory(int $applicationId, int $categoryId) : array
242
    {
243
        /** @var Entity\Filesystem\FilesystemCategoryEntity $categoryEntity */
244
        $categoryEntity = $this->getFilesystemCategoryStorage()
245
            ->getFilesystemCategoryById($categoryId);
246
247
        /** @var array $categoryDirectoryData */
248
        $categoryDirectoryData = $this->getFilesystemDirectoryStorage()
249
            ->getDirectoryDataByApplicationAndProxy($applicationId, ProxyInterface::LIST_CATEGORY);
250
251
        $category = [
252
            'url' => $categoryDirectoryData['uri'].'/'.$categoryEntity->getName(),
253
            'name' => $categoryEntity->getName(),
254
            'title' => $categoryEntity->getTitle()
255
        ];
256
        return $category;
257
    }
258
}
259