Completed
Push — SWP-2230-php7-fix ( 3795ee )
by
unknown
30s
created
src/SWP/Bundle/CoreBundle/Controller/ContentController.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,10 +22,10 @@
 block discarded – undo
22 22
 class ContentController extends AbstractController
23 23
 {
24 24
 
25
-  public function __construct() {
26
-  }
25
+    public function __construct() {
26
+    }
27 27
 
28
-  public function renderPageAction(string $contentTemplate): Response
28
+    public function renderPageAction(string $contentTemplate): Response
29 29
     {
30 30
         $response = new Response();
31 31
         $response->headers->set('Content-Type', 'text/html; charset=UTF-8');
Please login to merge, or discard this patch.
SWP/Bundle/ElasticSearchBundle/Controller/Api/ArticleSearchController.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -28,25 +28,25 @@  discard block
 block discarded – undo
28 28
 use FOS\RestBundle\Controller\Annotations\Route;
29 29
 
30 30
 class ArticleSearchController extends AbstractController {
31
-  private $extraFields; //
32
-  private CachedTenantContext $cachedTenantContext; // swp_multi_tenancy.tenant_context
33
-  private PaginatorInterface $paginator; // knp_paginator
34
-
35
-  /**
36
-   * @param $extraFields
37
-   * @param CachedTenantContext $cachedTenantContext
38
-   * @param PaginatorInterface $paginator
39
-   */
40
-  public function __construct($extraFields, CachedTenantContext $cachedTenantContext, PaginatorInterface $paginator) {
31
+    private $extraFields; //
32
+    private CachedTenantContext $cachedTenantContext; // swp_multi_tenancy.tenant_context
33
+    private PaginatorInterface $paginator; // knp_paginator
34
+
35
+    /**
36
+     * @param $extraFields
37
+     * @param CachedTenantContext $cachedTenantContext
38
+     * @param PaginatorInterface $paginator
39
+     */
40
+    public function __construct($extraFields, CachedTenantContext $cachedTenantContext, PaginatorInterface $paginator) {
41 41
     $this->extraFields = $extraFields;
42 42
     $this->cachedTenantContext = $cachedTenantContext;
43 43
     $this->paginator = $paginator;
44
-  }
44
+    }
45 45
 
46
-  /**
47
-   * @Route("/api/{version}/content/articles/", methods={"GET"}, options={"expose"=true}, defaults={"version"="v2"}, name="swp_api_content_list_articles")
48
-   */
49
-  public function searchAction(Request $request, RepositoryManagerInterface $repositoryManager) {
46
+    /**
47
+     * @Route("/api/{version}/content/articles/", methods={"GET"}, options={"expose"=true}, defaults={"version"="v2"}, name="swp_api_content_list_articles")
48
+     */
49
+    public function searchAction(Request $request, RepositoryManagerInterface $repositoryManager) {
50 50
     $criteria = $this->createCriteriaFrom($request);
51 51
     $extraFields = $this->extraFields;
52 52
 
@@ -69,16 +69,16 @@  discard block
 block discarded – undo
69 69
     $responseContext->setSerializationGroups($this->getSerializationGroups());
70 70
 
71 71
     return new ResourcesListResponse($pagination, $responseContext);
72
-  }
72
+    }
73 73
 
74
-  private function createCriteriaFrom(Request $request): Criteria {
74
+    private function createCriteriaFrom(Request $request): Criteria {
75 75
     return Criteria::fromQueryParameters(
76 76
         $request->query->get('term', ''),
77 77
         array_merge($this->createDefaultCriteria($request), $this->createAdditionalCriteria($request)
78 78
         ));
79
-  }
79
+    }
80 80
 
81
-  private function createDefaultCriteria(Request $request): array {
81
+    private function createDefaultCriteria(Request $request): array {
82 82
     $currentTenant = $this->cachedTenantContext->getTenant();
83 83
 
84 84
     return [
@@ -87,9 +87,9 @@  discard block
 block discarded – undo
87 87
         'limit' => $request->query->get('limit', 10),
88 88
         'tenantCode' => $currentTenant->getCode(),
89 89
     ];
90
-  }
90
+    }
91 91
 
92
-  protected function getSerializationGroups(): array {
92
+    protected function getSerializationGroups(): array {
93 93
     return [
94 94
         'Default',
95 95
         'api_articles_list',
@@ -102,9 +102,9 @@  discard block
 block discarded – undo
102 102
         'api_tenant_list',
103 103
         'api_articles_statistics_list',
104 104
     ];
105
-  }
105
+    }
106 106
 
107
-  protected function createAdditionalCriteria(Request $request): array {
107
+    protected function createAdditionalCriteria(Request $request): array {
108 108
     return [
109 109
         'routes' => array_filter((array)$request->query->get('route', [])),
110 110
         'statuses' => array_filter((array)$request->query->get('status', [])),
@@ -116,5 +116,5 @@  discard block
 block discarded – undo
116 116
         'metadata' => array_filter((array)$request->query->get('metadata', [])),
117 117
         'keywords' => array_filter((array)$request->query->get('keywords', [])),
118 118
     ];
119
-  }
119
+    }
120 120
 }
Please login to merge, or discard this patch.
SWP/Bundle/ElasticSearchBundle/Controller/Api/AuthorSearchController.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -26,27 +26,27 @@  discard block
 block discarded – undo
26 26
 use FOS\RestBundle\Controller\Annotations\Route;
27 27
 
28 28
 class AuthorSearchController extends AbstractController {
29
-  private RepositoryManagerInterface $repositoryManager;
30
-  private PaginatorInterface $paginator;
31
-  private string $authorClassName;
29
+    private RepositoryManagerInterface $repositoryManager;
30
+    private PaginatorInterface $paginator;
31
+    private string $authorClassName;
32 32
 
33
-  /**
34
-   * @param RepositoryManagerInterface $repositoryManager
35
-   * @param PaginatorInterface $paginator
36
-   * @param string $authorClassName
37
-   */
38
-  public function __construct(RepositoryManagerInterface $repositoryManager, PaginatorInterface $paginator,
39
-                              string                     $authorClassName) {
33
+    /**
34
+     * @param RepositoryManagerInterface $repositoryManager
35
+     * @param PaginatorInterface $paginator
36
+     * @param string $authorClassName
37
+     */
38
+    public function __construct(RepositoryManagerInterface $repositoryManager, PaginatorInterface $paginator,
39
+                                string                     $authorClassName) {
40 40
     $this->repositoryManager = $repositoryManager;
41 41
     $this->paginator = $paginator;
42 42
     $this->authorClassName = $authorClassName;
43
-  }
43
+    }
44 44
 
45 45
 
46
-  /**
47
-   * @Route("/api/{version}/authors/", methods={"GET"}, options={"expose"=true}, defaults={"version"="v2"}, name="swp_api_core_list_authors")
48
-   */
49
-  public function searchAction(Request $request): ResourcesListResponse {
46
+    /**
47
+     * @Route("/api/{version}/authors/", methods={"GET"}, options={"expose"=true}, defaults={"version"="v2"}, name="swp_api_core_list_authors")
48
+     */
49
+    public function searchAction(Request $request): ResourcesListResponse {
50 50
     $criteria = Criteria::fromQueryParameters(
51 51
         $request->query->get('term', ''),
52 52
         [
@@ -87,5 +87,5 @@  discard block
 block discarded – undo
87 87
     );
88 88
 
89 89
     return new ResourcesListResponse($pagination, $responseContext);
90
-  }
90
+    }
91 91
 }
Please login to merge, or discard this patch.
src/SWP/Bundle/CoreBundle/Controller/AnalyticsExportController.php 1 patch
Indentation   +83 added lines, -83 removed lines patch added patch discarded remove patch
@@ -51,33 +51,33 @@  discard block
 block discarded – undo
51 51
 
52 52
 class AnalyticsExportController extends AbstractController {
53 53
 
54
-  protected CacheInterface $cacheProvider;
55
-  protected RepositoryInterface $analyticsReportRepository;
56
-  protected Filesystem $filesystem;
57
-  protected CsvReportFileLocationResolver $csvReportFileLocationResolver;
58
-  protected CachedTenantContextInterface $cachedTenantContext;
59
-  protected RouteRepositoryInterface $routeRepository;
60
-  private MessageBusInterface $messageBus;
61
-  private FormFactoryInterface $formFactory;
62
-  private EventDispatcherInterface $eventDispatcher;
63
-
64
-  /**
65
-   * @param CacheInterface $cacheProvider
66
-   * @param RepositoryInterface $analyticsReportRepository
67
-   * @param Filesystem $filesystem
68
-   * @param CsvReportFileLocationResolver $csvReportFileLocationResolver
69
-   * @param CachedTenantContextInterface $cachedTenantContext
70
-   * @param RouteRepositoryInterface $routeRepository
71
-   * @param MessageBusInterface $messageBus
72
-   * @param FormFactoryInterface $formFactory
73
-   * @param EventDispatcherInterface $eventDispatcher
74
-   */
75
-  public function __construct(CacheInterface                $cacheProvider,
76
-                              RepositoryInterface           $analyticsReportRepository, Filesystem $filesystem,
77
-                              CsvReportFileLocationResolver $csvReportFileLocationResolver,
78
-                              CachedTenantContextInterface  $cachedTenantContext,
79
-                              RouteRepositoryInterface      $routeRepository, MessageBusInterface $messageBus,
80
-                              FormFactoryInterface          $formFactory, EventDispatcherInterface $eventDispatcher) {
54
+    protected CacheInterface $cacheProvider;
55
+    protected RepositoryInterface $analyticsReportRepository;
56
+    protected Filesystem $filesystem;
57
+    protected CsvReportFileLocationResolver $csvReportFileLocationResolver;
58
+    protected CachedTenantContextInterface $cachedTenantContext;
59
+    protected RouteRepositoryInterface $routeRepository;
60
+    private MessageBusInterface $messageBus;
61
+    private FormFactoryInterface $formFactory;
62
+    private EventDispatcherInterface $eventDispatcher;
63
+
64
+    /**
65
+     * @param CacheInterface $cacheProvider
66
+     * @param RepositoryInterface $analyticsReportRepository
67
+     * @param Filesystem $filesystem
68
+     * @param CsvReportFileLocationResolver $csvReportFileLocationResolver
69
+     * @param CachedTenantContextInterface $cachedTenantContext
70
+     * @param RouteRepositoryInterface $routeRepository
71
+     * @param MessageBusInterface $messageBus
72
+     * @param FormFactoryInterface $formFactory
73
+     * @param EventDispatcherInterface $eventDispatcher
74
+     */
75
+    public function __construct(CacheInterface                $cacheProvider,
76
+                                RepositoryInterface           $analyticsReportRepository, Filesystem $filesystem,
77
+                                CsvReportFileLocationResolver $csvReportFileLocationResolver,
78
+                                CachedTenantContextInterface  $cachedTenantContext,
79
+                                RouteRepositoryInterface      $routeRepository, MessageBusInterface $messageBus,
80
+                                FormFactoryInterface          $formFactory, EventDispatcherInterface $eventDispatcher) {
81 81
     $this->cacheProvider = $cacheProvider;
82 82
     $this->analyticsReportRepository = $analyticsReportRepository;
83 83
     $this->filesystem = $filesystem;
@@ -87,15 +87,15 @@  discard block
 block discarded – undo
87 87
     $this->messageBus = $messageBus;
88 88
     $this->formFactory = $formFactory;
89 89
     $this->eventDispatcher = $eventDispatcher;
90
-  }
90
+    }
91 91
 
92 92
 
93
-  /**
94
-   * @FosRoute("/api/{version}/export/analytics/", options={"expose"=true}, defaults={"version"="v2"}, methods={"POST"}, name="swp_api_core_analytics_export_post")
95
-   *
96
-   * @throws \Exception
97
-   */
98
-  public function post(Request $request): SingleResourceResponseInterface {
93
+    /**
94
+     * @FosRoute("/api/{version}/export/analytics/", options={"expose"=true}, defaults={"version"="v2"}, methods={"POST"}, name="swp_api_core_analytics_export_post")
95
+     *
96
+     * @throws \Exception
97
+     */
98
+    public function post(Request $request): SingleResourceResponseInterface {
99 99
     /** @var UserInterface $currentlyLoggedInUser */
100 100
     $currentlyLoggedInUser = $this->getUser();
101 101
 
@@ -106,46 +106,46 @@  discard block
 block discarded – undo
106 106
     $form->handleRequest($request);
107 107
 
108 108
     if ($form->isSubmitted() && $form->isValid()) {
109
-      $data = $form->getData();
109
+        $data = $form->getData();
110 110
 
111
-      $analyticsReport = new AnalyticsReport();
112
-      $analyticsReport->setAssetId($fileName);
113
-      $analyticsReport->setFileExtension('csv');
114
-      $analyticsReport->setUser($currentlyLoggedInUser);
111
+        $analyticsReport = new AnalyticsReport();
112
+        $analyticsReport->setAssetId($fileName);
113
+        $analyticsReport->setFileExtension('csv');
114
+        $analyticsReport->setUser($currentlyLoggedInUser);
115 115
 
116
-      $exportAnalytics = new ExportAnalytics(
117
-          $data['start'],
118
-          $data['end'],
119
-          $this->cachedTenantContext->getTenant()->getCode(),
120
-          $fileName,
121
-          $currentlyLoggedInUser->getEmail(),
122
-          !empty($data['routes']) ? $this->toIds($data['routes']) : [],
123
-          !empty($data['authors']) ? $this->toIds($data['authors']) : [],
124
-          $data['term'] ?? ''
125
-      );
116
+        $exportAnalytics = new ExportAnalytics(
117
+            $data['start'],
118
+            $data['end'],
119
+            $this->cachedTenantContext->getTenant()->getCode(),
120
+            $fileName,
121
+            $currentlyLoggedInUser->getEmail(),
122
+            !empty($data['routes']) ? $this->toIds($data['routes']) : [],
123
+            !empty($data['authors']) ? $this->toIds($data['authors']) : [],
124
+            $data['term'] ?? ''
125
+        );
126 126
 
127
-      $filters = $this->processFilters(
128
-          $exportAnalytics->getFilters(),
129
-          !empty($data['routes']) ? $data['routes'] : [],
130
-          !empty($data['authors']) ? $data['authors'] : []
131
-      );
127
+        $filters = $this->processFilters(
128
+            $exportAnalytics->getFilters(),
129
+            !empty($data['routes']) ? $data['routes'] : [],
130
+            !empty($data['authors']) ? $data['authors'] : []
131
+        );
132 132
 
133
-      $analyticsReport->setFilters($filters);
133
+        $analyticsReport->setFilters($filters);
134 134
 
135
-      $this->analyticsReportRepository->add($analyticsReport);
135
+        $this->analyticsReportRepository->add($analyticsReport);
136 136
 
137
-      $this->messageBus->dispatch($exportAnalytics);
137
+        $this->messageBus->dispatch($exportAnalytics);
138 138
 
139
-      return new SingleResourceResponse(['status' => 'OK'], new ResponseContext(201));
139
+        return new SingleResourceResponse(['status' => 'OK'], new ResponseContext(201));
140 140
     }
141 141
 
142 142
     return new SingleResourceResponse($form, new ResponseContext(400));
143
-  }
143
+    }
144 144
 
145
-  /**
146
-   * @FosRoute("/api/{version}/export/analytics/", methods={"GET"}, options={"expose"=true}, defaults={"version"="v2"}, name="swp_api_core_list_analytics_reports")
147
-   */
148
-  public function listAction(Request $request): ResourcesListResponseInterface {
145
+    /**
146
+     * @FosRoute("/api/{version}/export/analytics/", methods={"GET"}, options={"expose"=true}, defaults={"version"="v2"}, name="swp_api_core_list_analytics_reports")
147
+     */
148
+    public function listAction(Request $request): ResourcesListResponseInterface {
149 149
     $sorting = $request->query->all('sorting');
150 150
     $reports = $this->analyticsReportRepository->getPaginatedByCriteria(
151 151
         $this->eventDispatcher,
@@ -155,21 +155,21 @@  discard block
 block discarded – undo
155 155
     );
156 156
 
157 157
     return new ResourcesListResponse($reports);
158
-  }
158
+    }
159 159
 
160
-  /**
161
-   * @Route("/analytics/export/{fileName}", methods={"GET"}, options={"expose"=true}, requirements={"mediaId"=".+"}, name="swp_export_analytics_download")
162
-   */
163
-  public function downloadFile(string $fileName): Response {
160
+    /**
161
+     * @Route("/analytics/export/{fileName}", methods={"GET"}, options={"expose"=true}, requirements={"mediaId"=".+"}, name="swp_export_analytics_download")
162
+     */
163
+    public function downloadFile(string $fileName): Response {
164 164
     $cacheKey = md5(serialize(['analytics_report', $fileName]));
165 165
 
166 166
     $analyticsReport = $this->cacheProvider->get($cacheKey, function () use ($fileName) {
167
-      /* @var AnalyticsReportInterface|null $analyticsReport */
168
-      return $this->analyticsReportRepository->findOneBy(['assetId' => $fileName]);
167
+        /* @var AnalyticsReportInterface|null $analyticsReport */
168
+        return $this->analyticsReportRepository->findOneBy(['assetId' => $fileName]);
169 169
     });
170 170
 
171 171
     if (null === $analyticsReport) {
172
-      throw new NotFoundHttpException('Report file was not found.');
172
+        throw new NotFoundHttpException('Report file was not found.');
173 173
     }
174 174
 
175 175
     $response = new Response();
@@ -188,30 +188,30 @@  discard block
 block discarded – undo
188 188
     $response->setContent($this->filesystem->read($this->csvReportFileLocationResolver->getMediaBasePath() . '/' . $analyticsReport->getAssetId()));
189 189
 
190 190
     return $response;
191
-  }
191
+    }
192 192
 
193
-  private function toIds(array $items): array {
193
+    private function toIds(array $items): array {
194 194
     $ids = [];
195 195
     foreach ($items as $item) {
196
-      foreach ($item as $entity) {
196
+        foreach ($item as $entity) {
197 197
         if (!$entity instanceof PersistableInterface) {
198
-          continue;
198
+            continue;
199 199
         }
200 200
 
201 201
         $ids[] = $entity->getId();
202
-      }
202
+        }
203 203
     }
204 204
 
205 205
     return $ids;
206
-  }
206
+    }
207 207
 
208
-  private function processFilters(array $filters, array $routes, array $authors): array {
208
+    private function processFilters(array $filters, array $routes, array $authors): array {
209 209
     $routeNames = [];
210 210
 
211 211
     foreach ($routes as $route) {
212
-      foreach ($route as $entity) {
212
+        foreach ($route as $entity) {
213 213
         $routeNames[] = $entity->getName();
214
-      }
214
+        }
215 215
     }
216 216
 
217 217
     $filters['routes'] = $routeNames;
@@ -219,13 +219,13 @@  discard block
 block discarded – undo
219 219
     $authorNames = [];
220 220
     /** @var ArticleAuthorInterface $author */
221 221
     foreach ($authors as $author) {
222
-      foreach ($author as $entity) {
222
+        foreach ($author as $entity) {
223 223
         $authorNames[] = $entity->getName();
224
-      }
224
+        }
225 225
     }
226 226
 
227 227
     $filters['authors'] = $authorNames;
228 228
 
229 229
     return $filters;
230
-  }
230
+    }
231 231
 }
Please login to merge, or discard this patch.
src/SWP/Bundle/CoreBundle/Controller/SlideshowController.php 1 patch
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -29,28 +29,28 @@  discard block
 block discarded – undo
29 29
 use FOS\RestBundle\Controller\Annotations\Route;
30 30
 
31 31
 class SlideshowController extends Controller {
32
-  private ArticleRepositoryInterface $articleRepository;
33
-  private SlideshowRepositoryInterface $slideshowRepository;
34
-  private EventDispatcherInterface $eventDispatcher;
32
+    private ArticleRepositoryInterface $articleRepository;
33
+    private SlideshowRepositoryInterface $slideshowRepository;
34
+    private EventDispatcherInterface $eventDispatcher;
35 35
 
36
-  /**
37
-   * @param ArticleRepositoryInterface $articleRepository
38
-   * @param SlideshowRepositoryInterface $slideshowRepository
39
-   * @param EventDispatcherInterface $eventDispatcher
40
-   */
41
-  public function __construct(ArticleRepositoryInterface   $articleRepository,
42
-                              SlideshowRepositoryInterface $slideshowRepository,
43
-                              EventDispatcherInterface     $eventDispatcher) {
36
+    /**
37
+     * @param ArticleRepositoryInterface $articleRepository
38
+     * @param SlideshowRepositoryInterface $slideshowRepository
39
+     * @param EventDispatcherInterface $eventDispatcher
40
+     */
41
+    public function __construct(ArticleRepositoryInterface   $articleRepository,
42
+                                SlideshowRepositoryInterface $slideshowRepository,
43
+                                EventDispatcherInterface     $eventDispatcher) {
44 44
     $this->articleRepository = $articleRepository;
45 45
     $this->slideshowRepository = $slideshowRepository;
46 46
     $this->eventDispatcher = $eventDispatcher;
47
-  }
47
+    }
48 48
 
49 49
 
50
-  /**
51
-   * @Route("/api/{version}/content/slideshows/{articleId}", options={"expose"=true}, defaults={"version"="v2"}, methods={"GET"}, name="swp_api_slideshows_list")
52
-   */
53
-  public function listAction(Request $request, string $articleId): ResourcesListResponseInterface {
50
+    /**
51
+     * @Route("/api/{version}/content/slideshows/{articleId}", options={"expose"=true}, defaults={"version"="v2"}, methods={"GET"}, name="swp_api_slideshows_list")
52
+     */
53
+    public function listAction(Request $request, string $articleId): ResourcesListResponseInterface {
54 54
     $repository = $this->slideshowRepository;
55 55
 
56 56
     $article = $this->findArticleOr404($articleId);
@@ -60,29 +60,29 @@  discard block
 block discarded – undo
60 60
     ]), $request->query->all('sorting'), new PaginationData($request));
61 61
 
62 62
     return new ResourcesListResponse($slideshows);
63
-  }
63
+    }
64 64
 
65
-  /**
66
-   * @Route("/api/{version}/content/slideshows/{articleId}/{id}", options={"expose"=true}, defaults={"version"="v2"}, methods={"GET"}, name="swp_api_get_slideshow", requirements={"id"="\d+"})
67
-   */
68
-  public function getAction($id, string $articleId): SingleResourceResponseInterface {
65
+    /**
66
+     * @Route("/api/{version}/content/slideshows/{articleId}/{id}", options={"expose"=true}, defaults={"version"="v2"}, methods={"GET"}, name="swp_api_get_slideshow", requirements={"id"="\d+"})
67
+     */
68
+    public function getAction($id, string $articleId): SingleResourceResponseInterface {
69 69
     $article = $this->findArticleOr404($articleId);
70 70
 
71 71
     if (null === $list = $this->slideshowRepository->findOneBy([
72 72
             'id' => $id,
73 73
             'article' => $article,
74 74
         ])) {
75
-      throw new NotFoundHttpException(sprintf('Slideshow with id "%s" was not found.', $id));
75
+        throw new NotFoundHttpException(sprintf('Slideshow with id "%s" was not found.', $id));
76 76
     }
77 77
 
78 78
     return new SingleResourceResponse($list);
79
-  }
79
+    }
80 80
 
81
-  private function findArticleOr404($id) {
81
+    private function findArticleOr404($id) {
82 82
     if (null === $article = $this->articleRepository->findOneById($id)) {
83
-      throw new NotFoundHttpException(sprintf('Article with id "%s" was not found.', $id));
83
+        throw new NotFoundHttpException(sprintf('Article with id "%s" was not found.', $id));
84 84
     }
85 85
 
86 86
     return $article;
87
-  }
87
+    }
88 88
 }
Please login to merge, or discard this patch.
src/SWP/Bundle/CoreBundle/Controller/PackageSeoMediaUploadController.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -28,50 +28,50 @@
 block discarded – undo
28 28
 use FOS\RestBundle\Controller\Annotations\Route;
29 29
 
30 30
 class PackageSeoMediaUploadController extends AbstractController {
31
-  private FactoryInterface $seoMetadataFactory;
32
-  private RepositoryInterface $seoMetadataRepository;
33
-  private FormFactoryInterface $formFactory;
31
+    private FactoryInterface $seoMetadataFactory;
32
+    private RepositoryInterface $seoMetadataRepository;
33
+    private FormFactoryInterface $formFactory;
34 34
 
35
-  /**
36
-   * @param FactoryInterface $seoMetadataFactory
37
-   * @param RepositoryInterface $seoMetadataRepository
38
-   * @param FormFactoryInterface $formFactory
39
-   */
40
-  public function __construct(FactoryInterface     $seoMetadataFactory, RepositoryInterface $seoMetadataRepository,
41
-                              FormFactoryInterface $formFactory) {
35
+    /**
36
+     * @param FactoryInterface $seoMetadataFactory
37
+     * @param RepositoryInterface $seoMetadataRepository
38
+     * @param FormFactoryInterface $formFactory
39
+     */
40
+    public function __construct(FactoryInterface     $seoMetadataFactory, RepositoryInterface $seoMetadataRepository,
41
+                                FormFactoryInterface $formFactory) {
42 42
     $this->seoMetadataFactory = $seoMetadataFactory;
43 43
     $this->seoMetadataRepository = $seoMetadataRepository;
44 44
     $this->formFactory = $formFactory;
45
-  }
45
+    }
46 46
 
47 47
 
48
-  /**
49
-   * @Route("/api/{version}/packages/seo/upload/{packageGuid}", options={"expose"=true}, defaults={"version"="v2"}, methods={"POST"}, name="swp_api_upload_package_seo_image")
50
-   */
51
-  public function uploadAction(Request                   $request, string $packageGuid,
52
-                               SeoImageUploaderInterface $seoImageUploader): SingleResourceResponse {
48
+    /**
49
+     * @Route("/api/{version}/packages/seo/upload/{packageGuid}", options={"expose"=true}, defaults={"version"="v2"}, methods={"POST"}, name="swp_api_upload_package_seo_image")
50
+     */
51
+    public function uploadAction(Request                   $request, string $packageGuid,
52
+                                SeoImageUploaderInterface $seoImageUploader): SingleResourceResponse {
53 53
     $seoMetadata = $this->seoMetadataRepository->findOneByPackageGuid($packageGuid);
54 54
 
55 55
     if (null === $seoMetadata) {
56
-      $seoMetadata = $this->seoMetadataFactory->create();
56
+        $seoMetadata = $this->seoMetadataFactory->create();
57 57
     }
58 58
 
59 59
     $form = $this->formFactory->createNamed('', SeoImageType::class, $seoMetadata);
60 60
     $form->handleRequest($request);
61 61
 
62 62
     if ($form->isSubmitted() && $form->isValid()) {
63
-      try {
63
+        try {
64 64
         $seoMetadata->setPackageGuid($packageGuid);
65 65
         $seoImageUploader->handleUpload($seoMetadata);
66 66
 
67 67
         $this->seoMetadataRepository->add($seoMetadata);
68
-      } catch (\Exception $e) {
68
+        } catch (\Exception $e) {
69 69
         return new SingleResourceResponse(['message' => 'Could not upload an image.'], new ResponseContext(400));
70
-      }
70
+        }
71 71
 
72
-      return new SingleResourceResponse($seoMetadata, new ResponseContext(201));
72
+        return new SingleResourceResponse($seoMetadata, new ResponseContext(201));
73 73
     }
74 74
 
75 75
     return new SingleResourceResponse($form, new ResponseContext(400));
76
-  }
76
+    }
77 77
 }
Please login to merge, or discard this patch.
src/SWP/Bundle/CoreBundle/Controller/SlideshowItemController.php 1 patch
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -28,32 +28,32 @@  discard block
 block discarded – undo
28 28
 use FOS\RestBundle\Controller\Annotations\Route;
29 29
 
30 30
 class SlideshowItemController extends Controller {
31
-  private ArticleRepositoryInterface $articleRepository;
32
-  private SlideshowRepositoryInterface $slideshowRepository;
33
-  private SlideshowItemRepositoryInterface $slideshowItemRepository;
34
-  private EventDispatcherInterface $eventDispatcher;
31
+    private ArticleRepositoryInterface $articleRepository;
32
+    private SlideshowRepositoryInterface $slideshowRepository;
33
+    private SlideshowItemRepositoryInterface $slideshowItemRepository;
34
+    private EventDispatcherInterface $eventDispatcher;
35 35
 
36
-  /**
37
-   * @param ArticleRepositoryInterface $articleRepository
38
-   * @param SlideshowRepositoryInterface $slideshowRepository
39
-   * @param SlideshowItemRepositoryInterface $slideshowItemRepository
40
-   * @param EventDispatcherInterface $eventDispatcher
41
-   */
42
-  public function __construct(ArticleRepositoryInterface       $articleRepository,
43
-                              SlideshowRepositoryInterface     $slideshowRepository,
44
-                              SlideshowItemRepositoryInterface $slideshowItemRepository,
45
-                              EventDispatcherInterface         $eventDispatcher) {
36
+    /**
37
+     * @param ArticleRepositoryInterface $articleRepository
38
+     * @param SlideshowRepositoryInterface $slideshowRepository
39
+     * @param SlideshowItemRepositoryInterface $slideshowItemRepository
40
+     * @param EventDispatcherInterface $eventDispatcher
41
+     */
42
+    public function __construct(ArticleRepositoryInterface       $articleRepository,
43
+                                SlideshowRepositoryInterface     $slideshowRepository,
44
+                                SlideshowItemRepositoryInterface $slideshowItemRepository,
45
+                                EventDispatcherInterface         $eventDispatcher) {
46 46
     $this->articleRepository = $articleRepository;
47 47
     $this->slideshowRepository = $slideshowRepository;
48 48
     $this->slideshowItemRepository = $slideshowItemRepository;
49 49
     $this->eventDispatcher = $eventDispatcher;
50
-  }
50
+    }
51 51
 
52 52
 
53
-  /**
54
-   * @Route("/api/{version}/content/slideshows/{articleId}/{id}/items/", options={"expose"=true}, defaults={"version"="v2"}, methods={"GET"}, name="swp_api_core_slideshow_items", requirements={"id"="\d+"})
55
-   */
56
-  public function listAction(Request $request, string $articleId, string $id) {
53
+    /**
54
+     * @Route("/api/{version}/content/slideshows/{articleId}/{id}/items/", options={"expose"=true}, defaults={"version"="v2"}, methods={"GET"}, name="swp_api_core_slideshow_items", requirements={"id"="\d+"})
55
+     */
56
+    public function listAction(Request $request, string $articleId, string $id) {
57 57
     $article = $this->findArticleOr404($articleId);
58 58
     $repository = $this->slideshowItemRepository;
59 59
 
@@ -68,21 +68,21 @@  discard block
 block discarded – undo
68 68
     );
69 69
 
70 70
     return new ResourcesListResponse($items);
71
-  }
71
+    }
72 72
 
73
-  private function findOr404($id): ?SlideshowInterface {
73
+    private function findOr404($id): ?SlideshowInterface {
74 74
     if (null === $slideshow = $this->slideshowRepository->findOneById($id)) {
75
-      throw new NotFoundHttpException(sprintf('Slideshow with id "%s" was not found.', $id));
75
+        throw new NotFoundHttpException(sprintf('Slideshow with id "%s" was not found.', $id));
76 76
     }
77 77
 
78 78
     return $slideshow;
79
-  }
79
+    }
80 80
 
81
-  private function findArticleOr404($id) {
81
+    private function findArticleOr404($id) {
82 82
     if (null === $article = $this->articleRepository->findOneById($id)) {
83
-      throw new NotFoundHttpException(sprintf('Article with id "%s" was not found.', $id));
83
+        throw new NotFoundHttpException(sprintf('Article with id "%s" was not found.', $id));
84 84
     }
85 85
 
86 86
     return $article;
87
-  }
87
+    }
88 88
 }
Please login to merge, or discard this patch.
SWP/Bundle/CoreBundle/Controller/RelatedArticleOrganizationController.php 1 patch
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -35,102 +35,102 @@
 block discarded – undo
35 35
 use FOS\RestBundle\Controller\Annotations\Route;
36 36
 
37 37
 class RelatedArticleOrganizationController extends Controller {
38
-  private EventDispatcherInterface $eventDispatcher;
39
-  private DataTransformerInterface $dataTransformer;
40
-  private CachedTenantContextInterface $cachedTenantContext;
41
-  private PackageRepositoryInterface $packageRepository;
42
-  private ArticleRepositoryInterface $articleRepository;
43
-  private TenantRepositoryInterface $tenantRepository;
44
-
45
-  /**
46
-   * @param EventDispatcherInterface $eventDispatcher
47
-   * @param DataTransformerInterface $dataTransformer
48
-   * @param CachedTenantContextInterface $cachedTenantContext
49
-   * @param PackageRepositoryInterface $packageRepository
50
-   * @param ArticleRepositoryInterface $articleRepository
51
-   * @param TenantRepositoryInterface $tenantRepository
52
-   */
53
-  public function __construct(EventDispatcherInterface     $eventDispatcher,
54
-                              DataTransformerInterface     $dataTransformer,
55
-                              CachedTenantContextInterface $cachedTenantContext,
56
-                              PackageRepositoryInterface   $packageRepository,
57
-                              ArticleRepositoryInterface   $articleRepository,
58
-                              TenantRepositoryInterface    $tenantRepository) {
38
+    private EventDispatcherInterface $eventDispatcher;
39
+    private DataTransformerInterface $dataTransformer;
40
+    private CachedTenantContextInterface $cachedTenantContext;
41
+    private PackageRepositoryInterface $packageRepository;
42
+    private ArticleRepositoryInterface $articleRepository;
43
+    private TenantRepositoryInterface $tenantRepository;
44
+
45
+    /**
46
+     * @param EventDispatcherInterface $eventDispatcher
47
+     * @param DataTransformerInterface $dataTransformer
48
+     * @param CachedTenantContextInterface $cachedTenantContext
49
+     * @param PackageRepositoryInterface $packageRepository
50
+     * @param ArticleRepositoryInterface $articleRepository
51
+     * @param TenantRepositoryInterface $tenantRepository
52
+     */
53
+    public function __construct(EventDispatcherInterface     $eventDispatcher,
54
+                                DataTransformerInterface     $dataTransformer,
55
+                                CachedTenantContextInterface $cachedTenantContext,
56
+                                PackageRepositoryInterface   $packageRepository,
57
+                                ArticleRepositoryInterface   $articleRepository,
58
+                                TenantRepositoryInterface    $tenantRepository) {
59 59
     $this->eventDispatcher = $eventDispatcher;
60 60
     $this->dataTransformer = $dataTransformer;
61 61
     $this->cachedTenantContext = $cachedTenantContext;
62 62
     $this->packageRepository = $packageRepository;
63 63
     $this->articleRepository = $articleRepository;
64 64
     $this->tenantRepository = $tenantRepository;
65
-  }
65
+    }
66 66
 
67 67
 
68
-  /**
69
-   * @Route("/api/{version}/organization/articles/related/", methods={"POST"}, options={"expose"=true}, defaults={"version"="v2"}, name="swp_api_core_organization_related_articles")
70
-   */
71
-  public function postAction(Request $request) {
68
+    /**
69
+     * @Route("/api/{version}/organization/articles/related/", methods={"POST"}, options={"expose"=true}, defaults={"version"="v2"}, name="swp_api_core_organization_related_articles")
70
+     */
71
+    public function postAction(Request $request) {
72 72
     $content = $request->getContent();
73 73
     $package = $this->dataTransformer->transform($content);
74 74
     $relatedArticlesList = $this->getRelated($package);
75 75
 
76 76
     return new SingleResourceResponse($relatedArticlesList);
77
-  }
77
+    }
78 78
 
79
-  /**
80
-   * @Route("/api/{version}/packages/{id}/related/", methods={"GET"}, options={"expose"=true}, defaults={"version"="v2"}, name="swp_api_core_packages_related_articles", requirements={"id"="\d+"})
81
-   */
82
-  public function getRelatedAction(string $id) {
79
+    /**
80
+     * @Route("/api/{version}/packages/{id}/related/", methods={"GET"}, options={"expose"=true}, defaults={"version"="v2"}, name="swp_api_core_packages_related_articles", requirements={"id"="\d+"})
81
+     */
82
+    public function getRelatedAction(string $id) {
83 83
     $package = $this->findOr404((int)$id);
84 84
 
85 85
     $relatedArticlesList = $this->getRelated($package);
86 86
 
87 87
     return new SingleResourceResponse($relatedArticlesList);
88
-  }
88
+    }
89 89
 
90
-  private function getRelated(PackageInterface $package): RelatedArticleList {
90
+    private function getRelated(PackageInterface $package): RelatedArticleList {
91 91
     $relatedItemsGroups = $package->getItems()->filter(static function ($group) {
92
-      return ItemInterface::TYPE_TEXT === $group->getType();
92
+        return ItemInterface::TYPE_TEXT === $group->getType();
93 93
     });
94 94
 
95 95
     $relatedArticlesList = new RelatedArticleList();
96 96
 
97 97
     if (null === $package || (null !== $package && 0 === \count($relatedItemsGroups))) {
98
-      return $relatedArticlesList;
98
+        return $relatedArticlesList;
99 99
     }
100 100
 
101 101
     $this->eventDispatcher->dispatch(new GenericEvent(), MultiTenancyEvents::TENANTABLE_DISABLE);
102 102
     $articleRepository = $this->articleRepository;
103 103
 
104 104
     foreach ($relatedItemsGroups as $item) {
105
-      if (null === ($existingArticles = $articleRepository->findBy(['code' => $item->getGuid()]))) {
105
+        if (null === ($existingArticles = $articleRepository->findBy(['code' => $item->getGuid()]))) {
106 106
         continue;
107
-      }
107
+        }
108 108
 
109
-      $tenants = [];
110
-      foreach ($existingArticles as $existingArticle) {
109
+        $tenants = [];
110
+        foreach ($existingArticles as $existingArticle) {
111 111
         $tenantCode = $existingArticle->getTenantCode();
112 112
         $tenant = $this->tenantRepository->findOneByCode($tenantCode);
113 113
 
114 114
         $tenants[] = $tenant;
115
-      }
115
+        }
116 116
 
117
-      $relatedArticleListItem = new RelatedArticleListItem();
118
-      $relatedArticleListItem->setTenants($tenants);
119
-      $relatedArticleListItem->setTitle($item->getHeadline());
117
+        $relatedArticleListItem = new RelatedArticleListItem();
118
+        $relatedArticleListItem->setTenants($tenants);
119
+        $relatedArticleListItem->setTitle($item->getHeadline());
120 120
 
121
-      $relatedArticlesList->addRelatedArticleItem($relatedArticleListItem);
121
+        $relatedArticlesList->addRelatedArticleItem($relatedArticleListItem);
122 122
     }
123 123
 
124 124
     return $relatedArticlesList;
125
-  }
125
+    }
126 126
 
127
-  private function findOr404(int $id): PackageInterface {
127
+    private function findOr404(int $id): PackageInterface {
128 128
     $this->eventDispatcher->dispatch(new GenericEvent(), MultiTenancyEvents::TENANTABLE_DISABLE);
129 129
     $tenantContext = $this->cachedTenantContext;
130 130
     if (null === $package = $this->packageRepository->findOneBy(['id' => $id, 'organization' => $tenantContext->getTenant()->getOrganization()])) {
131
-      throw new NotFoundHttpException('Package was not found.');
131
+        throw new NotFoundHttpException('Package was not found.');
132 132
     }
133 133
 
134 134
     return $package;
135
-  }
135
+    }
136 136
 }
Please login to merge, or discard this patch.
src/SWP/Bundle/CoreBundle/Controller/SeoMediaController.php 1 patch
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -37,75 +37,75 @@
 block discarded – undo
37 37
 use FOS\RestBundle\Controller\Annotations\Route as FOSRoute;
38 38
 
39 39
 class SeoMediaController extends AbstractMediaController {
40
-  private FactoryInterface $seoMetadataFactory;
41
-  private ArticleProviderInterface $articleProvider;
42
-  private EntityManagerInterface $seoObjectManager;
43
-  private FormFactoryInterface $formFactory;
44
-
45
-  public function __construct(
46
-      FactoryInterface              $seoMetadataFactory,
47
-      ArticleProviderInterface      $articleProvider,
48
-      FormFactoryInterface          $formFactory,
49
-      EntityManagerInterface        $seoObjectManager,
50
-      MediaManagerInterface         $seoMediaManager,
51
-      CacheInterface                $cacheProvider,
52
-      FileProviderInterface         $fileProvider,
53
-      FileExtensionCheckerInterface $fileExtensionChecker
54
-  ) {
40
+    private FactoryInterface $seoMetadataFactory;
41
+    private ArticleProviderInterface $articleProvider;
42
+    private EntityManagerInterface $seoObjectManager;
43
+    private FormFactoryInterface $formFactory;
44
+
45
+    public function __construct(
46
+        FactoryInterface              $seoMetadataFactory,
47
+        ArticleProviderInterface      $articleProvider,
48
+        FormFactoryInterface          $formFactory,
49
+        EntityManagerInterface        $seoObjectManager,
50
+        MediaManagerInterface         $seoMediaManager,
51
+        CacheInterface                $cacheProvider,
52
+        FileProviderInterface         $fileProvider,
53
+        FileExtensionCheckerInterface $fileExtensionChecker
54
+    ) {
55 55
     $this->seoMetadataFactory = $seoMetadataFactory;
56 56
     $this->formFactory = $formFactory;
57 57
     $this->articleProvider = $articleProvider;
58 58
     $this->seoObjectManager = $seoObjectManager;
59 59
 
60 60
     parent::__construct($seoMediaManager, $cacheProvider, $fileProvider, $fileExtensionChecker);
61
-  }
61
+    }
62 62
 
63
-  /**
64
-   * @Route("/seo/media/{mediaId}.{extension}", methods={"GET"}, options={"expose"=true}, requirements={"mediaId"=".+"}, name="swp_seo_media_get")
65
-   */
66
-  public function getAction(string $mediaId, string $extension): Response {
63
+    /**
64
+     * @Route("/seo/media/{mediaId}.{extension}", methods={"GET"}, options={"expose"=true}, requirements={"mediaId"=".+"}, name="swp_seo_media_get")
65
+     */
66
+    public function getAction(string $mediaId, string $extension): Response {
67 67
     return $this->getMedia($mediaId, $extension);
68
-  }
68
+    }
69 69
 
70
-  /**
71
-   * @FOSRoute("/api/{version}/upload/seo_image/{id}", options={"expose"=true}, defaults={"version"="v2"}, methods={"POST"}, name="swp_api_upload_seo_image")
72
-   */
73
-  public function uploadSeoImageAction(Request                   $request, string $id,
74
-                                       SeoImageUploaderInterface $seoImageUploader): SingleResourceResponse {
70
+    /**
71
+     * @FOSRoute("/api/{version}/upload/seo_image/{id}", options={"expose"=true}, defaults={"version"="v2"}, methods={"POST"}, name="swp_api_upload_seo_image")
72
+     */
73
+    public function uploadSeoImageAction(Request                   $request, string $id,
74
+                                        SeoImageUploaderInterface $seoImageUploader): SingleResourceResponse {
75 75
     $article = $this->findOr404($id);
76 76
     $seoMetadata = $article->getSeoMetadata();
77 77
 
78 78
     if (null === $seoMetadata) {
79
-      $seoMetadata = $this->seoMetadataFactory->create();
79
+        $seoMetadata = $this->seoMetadataFactory->create();
80 80
     }
81 81
 
82 82
     $form = $this->formFactory->createNamed('', SeoImageType::class, $seoMetadata);
83 83
     $form->handleRequest($request);
84 84
 
85 85
     if ($form->isSubmitted() && $form->isValid()) {
86
-      try {
86
+        try {
87 87
         $seoImageUploader->handleUpload($seoMetadata);
88 88
 
89 89
         if (null === $article->getSeoMetadata()) {
90
-          $article->setSeoMetadata($seoMetadata);
90
+            $article->setSeoMetadata($seoMetadata);
91 91
         }
92 92
 
93 93
         $this->seoObjectManager->flush();
94
-      } catch (\Exception $e) {
94
+        } catch (\Exception $e) {
95 95
         return new SingleResourceResponse(['message' => 'Could not upload an image.'], new ResponseContext(400));
96
-      }
96
+        }
97 97
 
98
-      return new SingleResourceResponse($seoMetadata, new ResponseContext(201));
98
+        return new SingleResourceResponse($seoMetadata, new ResponseContext(201));
99 99
     }
100 100
 
101 101
     return new SingleResourceResponse($form, new ResponseContext(400));
102
-  }
102
+    }
103 103
 
104
-  private function findOr404(string $id): ArticleInterface {
104
+    private function findOr404(string $id): ArticleInterface {
105 105
     if (null === $article = $this->articleProvider->getOneById($id)) {
106
-      throw new NotFoundHttpException('Article was not found.');
106
+        throw new NotFoundHttpException('Article was not found.');
107 107
     }
108 108
 
109 109
     return $article;
110
-  }
110
+    }
111 111
 }
Please login to merge, or discard this patch.