Completed
Push — master ( ef00d6...24f3d8 )
by Rafał
10:09
created

PublicArticleSearchController   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 25
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A searchAction() 0 4 1
A getSerializationGroups() 0 7 1
A createAdditionalCriteria() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Superdesk Web Publisher ElasticSearch Bundle.
7
 *
8
 * Copyright 2021 Sourcefabric z.ú. and contributors.
9
 *
10
 * For the full copyright and license information, please see the
11
 * AUTHORS and LICENSE files distributed with this source code.
12
 *
13
 * @copyright 2021 Sourcefabric z.ú
14
 * @license http://www.superdesk.org/license
15
 */
16
17
namespace SWP\Bundle\ElasticSearchBundle\Controller\Api;
18
19
use FOS\ElasticaBundle\Manager\RepositoryManagerInterface;
20
use SWP\Bundle\CoreBundle\Model\ArticleInterface;
21
use Symfony\Component\HttpFoundation\Request;
22
use Symfony\Component\Routing\Annotation\Route;
23
24
class PublicArticleSearchController extends ArticleSearchController
25
{
26
    /**
27
     * @Route("/api/{version}/search/articles/", methods={"GET"}, options={"expose"=true}, defaults={"version"="v2"}, name="swp_public_api_content_list_articles")
28
     */
29
    public function searchAction(Request $request, RepositoryManagerInterface $repositoryManager)
30
    {
31
        return parent::searchAction($request, $repositoryManager);
32
    }
33
34
    protected function getSerializationGroups(): array
35
    {
36
        return [
37
            'Default',
38
            'public_api',
39
        ];
40
    }
41
42
    protected function createAdditionalCriteria(Request $request): array
43
    {
44
        return [
45
            'statuses' => [ArticleInterface::STATUS_PUBLISHED],
46
        ];
47
    }
48
}
49