Completed
Pull Request — develop (#1272)
by
unknown
45s
created
src/SWP/Bundle/CoreBundle/Theme/Uploader/OrganizationAwareThemeUploader.php 2 patches
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -24,33 +24,33 @@  discard block
 block discarded – undo
24 24
  * Class OrganizationAwareThemeUploader.
25 25
  */
26 26
 final class OrganizationAwareThemeUploader implements ThemeUploaderInterface {
27
-  /**
28
-   * @var TenantContextInterface
29
-   */
30
-  private $tenantContext;
31
-
32
-  /**
33
-   * @var string
34
-   */
35
-  private $baseDir;
36
-
37
-  /**
38
-   * OrganizationAwareThemeUploader constructor.
39
-   *
40
-   * @param TenantContextInterface $tenantContext
41
-   * @param string $baseDir
42
-   */
43
-  public function __construct(TenantContextInterface $tenantContext, string $baseDir) {
27
+    /**
28
+     * @var TenantContextInterface
29
+     */
30
+    private $tenantContext;
31
+
32
+    /**
33
+     * @var string
34
+     */
35
+    private $baseDir;
36
+
37
+    /**
38
+     * OrganizationAwareThemeUploader constructor.
39
+     *
40
+     * @param TenantContextInterface $tenantContext
41
+     * @param string $baseDir
42
+     */
43
+    public function __construct(TenantContextInterface $tenantContext, string $baseDir) {
44 44
     $this->tenantContext = $tenantContext;
45 45
     $this->baseDir = $baseDir;
46
-  }
46
+    }
47 47
 
48
-  /**
49
-   * {@inheritdoc}
50
-   */
51
-  public function upload(UploadedFile $file) {
48
+    /**
49
+     * {@inheritdoc}
50
+     */
51
+    public function upload(UploadedFile $file) {
52 52
     if (null === $this->tenantContext->getTenant()) {
53
-      throw new \Exception('Tenant was not found in context!');
53
+        throw new \Exception('Tenant was not found in context!');
54 54
     }
55 55
 
56 56
     $destinationFolder = $this->getAvailableThemesPath();
@@ -59,48 +59,48 @@  discard block
 block discarded – undo
59 59
 
60 60
     $zip = new \ZipArchive();
61 61
     if (true === $zip->open($filePath)) {
62
-      if (!$filesystem->exists($destinationFolder)) {
62
+        if (!$filesystem->exists($destinationFolder)) {
63 63
         $filesystem->mkdir($destinationFolder);
64
-      }
65
-      $pathInArray = explode('/', $zip->getNameIndex(0));
66
-      $themeDirInZip = array_shift($pathInArray);
64
+        }
65
+        $pathInArray = explode('/', $zip->getNameIndex(0));
66
+        $themeDirInZip = array_shift($pathInArray);
67 67
 
68
-      $themeConfiguration = $zip->getFromName($themeDirInZip . DIRECTORY_SEPARATOR . 'theme.json');
69
-      if (false === $themeConfiguration) {
68
+        $themeConfiguration = $zip->getFromName($themeDirInZip . DIRECTORY_SEPARATOR . 'theme.json');
69
+        if (false === $themeConfiguration) {
70 70
         throw new \Exception('In ZIP file we expect one directory and theme.json file inside');
71
-      }
71
+        }
72 72
 
73
-      $themeConfiguration = \json_decode($themeConfiguration, true);
74
-      if (\JSON_ERROR_NONE !== json_last_error()) {
73
+        $themeConfiguration = \json_decode($themeConfiguration, true);
74
+        if (\JSON_ERROR_NONE !== json_last_error()) {
75 75
         throw new \Exception('Theme configuration is not valid. Syntax error in theme.json');
76
-      }
76
+        }
77 77
 
78
-      $themeName = $themeConfiguration['name'];
79
-      $unpackedThemePath = $destinationFolder . DIRECTORY_SEPARATOR . $themeDirInZip;
78
+        $themeName = $themeConfiguration['name'];
79
+        $unpackedThemePath = $destinationFolder . DIRECTORY_SEPARATOR . $themeDirInZip;
80 80
 
81
-      if ($filesystem->exists($unpackedThemePath)) {
81
+        if ($filesystem->exists($unpackedThemePath)) {
82 82
         $filesystem->remove($unpackedThemePath);
83
-      }
83
+        }
84 84
 
85
-      $zip->extractTo($destinationFolder);
86
-      $zip->close();
85
+        $zip->extractTo($destinationFolder);
86
+        $zip->close();
87 87
 
88
-      $finalPath = $destinationFolder . DIRECTORY_SEPARATOR . str_replace('/', '__', $themeName);
89
-      $filesystem->rename($unpackedThemePath, $finalPath, true);
88
+        $finalPath = $destinationFolder . DIRECTORY_SEPARATOR . str_replace('/', '__', $themeName);
89
+        $filesystem->rename($unpackedThemePath, $finalPath, true);
90 90
 
91
-      return $finalPath;
91
+        return $finalPath;
92 92
     }
93 93
 
94 94
     return false;
95
-  }
95
+    }
96 96
 
97
-  /**
98
-   * @return string
99
-   */
100
-  public function getAvailableThemesPath() {
97
+    /**
98
+     * @return string
99
+     */
100
+    public function getAvailableThemesPath() {
101 101
     $tenant = $this->tenantContext->getTenant();
102 102
     $organization = $tenant->getOrganization();
103 103
     $organizationCode = $organization->getCode();
104 104
     return sprintf($this->baseDir . DIRECTORY_SEPARATOR . ThemeUploaderInterface::AVAILABLE_THEMES_PATH, $organizationCode);
105
-  }
105
+    }
106 106
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
       $pathInArray = explode('/', $zip->getNameIndex(0));
66 66
       $themeDirInZip = array_shift($pathInArray);
67 67
 
68
-      $themeConfiguration = $zip->getFromName($themeDirInZip . DIRECTORY_SEPARATOR . 'theme.json');
68
+      $themeConfiguration = $zip->getFromName($themeDirInZip.DIRECTORY_SEPARATOR.'theme.json');
69 69
       if (false === $themeConfiguration) {
70 70
         throw new \Exception('In ZIP file we expect one directory and theme.json file inside');
71 71
       }
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
       }
77 77
 
78 78
       $themeName = $themeConfiguration['name'];
79
-      $unpackedThemePath = $destinationFolder . DIRECTORY_SEPARATOR . $themeDirInZip;
79
+      $unpackedThemePath = $destinationFolder.DIRECTORY_SEPARATOR.$themeDirInZip;
80 80
 
81 81
       if ($filesystem->exists($unpackedThemePath)) {
82 82
         $filesystem->remove($unpackedThemePath);
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
       $zip->extractTo($destinationFolder);
86 86
       $zip->close();
87 87
 
88
-      $finalPath = $destinationFolder . DIRECTORY_SEPARATOR . str_replace('/', '__', $themeName);
88
+      $finalPath = $destinationFolder.DIRECTORY_SEPARATOR.str_replace('/', '__', $themeName);
89 89
       $filesystem->rename($unpackedThemePath, $finalPath, true);
90 90
 
91 91
       return $finalPath;
@@ -101,6 +101,6 @@  discard block
 block discarded – undo
101 101
     $tenant = $this->tenantContext->getTenant();
102 102
     $organization = $tenant->getOrganization();
103 103
     $organizationCode = $organization->getCode();
104
-    return sprintf($this->baseDir . DIRECTORY_SEPARATOR . ThemeUploaderInterface::AVAILABLE_THEMES_PATH, $organizationCode);
104
+    return sprintf($this->baseDir.DIRECTORY_SEPARATOR.ThemeUploaderInterface::AVAILABLE_THEMES_PATH, $organizationCode);
105 105
   }
106 106
 }
Please login to merge, or discard this patch.
src/SWP/Bundle/CoreBundle/Context/CachedTenantContext.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
     $this->dispatcher->dispatch(new GenericEvent(), MultiTenancyEvents::TENANTABLE_ENABLE);
51 51
 
52 52
     $this->resolvedTenants[self::getCacheKey(
53
-        $tenant->getSubdomain() ? $tenant->getSubdomain() . '.' . $tenant->getDomainName() : $tenant->getDomainName()
53
+        $tenant->getSubdomain() ? $tenant->getSubdomain().'.'.$tenant->getDomainName() : $tenant->getDomainName()
54 54
     )] = $tenant;
55 55
   }
56 56
 
@@ -60,6 +60,6 @@  discard block
 block discarded – undo
60 60
   }
61 61
 
62 62
   private static function getCacheKey(string $host): string {
63
-    return md5('tenant_cache__' . $host);
63
+    return md5('tenant_cache__'.$host);
64 64
   }
65 65
 }
Please login to merge, or discard this patch.
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -24,43 +24,43 @@
 block discarded – undo
24 24
 use SWP\Component\MultiTenancy\Model\TenantInterface;
25 25
 
26 26
 class CachedTenantContext extends TenantContext implements CachedTenantContextInterface {
27
-  private $resolvedTenants = [];
27
+    private $resolvedTenants = [];
28 28
 
29
-  public function getTenant(): ?TenantInterface {
29
+    public function getTenant(): ?TenantInterface {
30 30
     $currentRequest = $this->requestStack->getCurrentRequest();
31 31
     if ($currentRequest && $this->requestStack->getCurrentRequest()->attributes->get('exception') instanceof TenantNotFoundException) {
32
-      return null;
32
+        return null;
33 33
     }
34 34
 
35 35
     if ($currentRequest === null) {
36
-      return $this->tenant;
36
+        return $this->tenant;
37 37
     }
38 38
 
39 39
     $cacheKey = self::getCacheKey($currentRequest->getHost());
40 40
     if (!array_key_exists($cacheKey, $this->resolvedTenants) || $this->resolvedTenants[$cacheKey] instanceof TenantInterface) {
41
-      $this->resolvedTenants[$cacheKey] = parent::getTenant();
41
+        $this->resolvedTenants[$cacheKey] = parent::getTenant();
42 42
     } else {
43
-      $this->tenant = $this->resolvedTenants[$cacheKey];
43
+        $this->tenant = $this->resolvedTenants[$cacheKey];
44 44
     }
45 45
 
46 46
     return $this->tenant;
47
-  }
47
+    }
48 48
 
49
-  public function setTenant(TenantInterface $tenant): void {
49
+    public function setTenant(TenantInterface $tenant): void {
50 50
     parent::setTenant($tenant);
51 51
     $this->dispatcher->dispatch(new GenericEvent(), MultiTenancyEvents::TENANTABLE_ENABLE);
52 52
 
53 53
     $this->resolvedTenants[self::getCacheKey(
54 54
         $tenant->getSubdomain() ? $tenant->getSubdomain() . '.' . $tenant->getDomainName() : $tenant->getDomainName()
55 55
     )] = $tenant;
56
-  }
56
+    }
57 57
 
58
-  public function reset(): void {
58
+    public function reset(): void {
59 59
     $this->tenant = null;
60 60
     $this->resolvedTenants = [];
61
-  }
61
+    }
62 62
 
63
-  private static function getCacheKey(string $host): string {
63
+    private static function getCacheKey(string $host): string {
64 64
     return md5('tenant_cache__' . $host);
65
-  }
65
+    }
66 66
 }
Please login to merge, or discard this patch.
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/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/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/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.
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.
src/SWP/Bundle/CoreBundle/Controller/FailedQueueController.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -23,12 +23,12 @@
 block discarded – undo
23 23
 use FOS\RestBundle\Controller\Annotations\Route;
24 24
 
25 25
 class FailedQueueController extends AbstractController {
26
-  /**
27
-   * @Route("/api/{version}/failed_queue/", methods={"GET"}, options={"expose"=true}, defaults={"version"="v2"}, name="swp_api_core_list_failed_queue")
28
-   */
29
-  public function listAction(Request $request, FailedEntriesProvider $failedEntriesProvider) {
26
+    /**
27
+     * @Route("/api/{version}/failed_queue/", methods={"GET"}, options={"expose"=true}, defaults={"version"="v2"}, name="swp_api_core_list_failed_queue")
28
+     */
29
+    public function listAction(Request $request, FailedEntriesProvider $failedEntriesProvider) {
30 30
     $max = $request->query->getInt('limit', 50);
31 31
 
32 32
     return new SingleResourceResponse($failedEntriesProvider->getFailedEntries($max));
33
-  }
33
+    }
34 34
 }
Please login to merge, or discard this patch.
src/SWP/Bundle/CoreBundle/Controller/AmpController.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@
 block discarded – undo
44 44
   }
45 45
 
46 46
   public function viewAction(AmpInterface $object): Response {
47
-    return $this->cacheService->get($this->getCacheKey($object), function () use ($object) {
47
+    return $this->cacheService->get($this->getCacheKey($object), function() use ($object) {
48 48
       $this->themeLoader->load();
49 49
       $content = $this->twig->render(sprintf('@%s/index.html.twig', ThemeLoaderInterface::THEME_NAMESPACE), [
50 50
           'object' => $object,
Please login to merge, or discard this patch.
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -26,46 +26,46 @@
 block discarded – undo
26 26
 
27 27
 final class AmpController extends AbstractController {
28 28
 
29
-  private Environment $twig;
30
-  private AmpConverterInterface $converter;
31
-  private ThemeLoaderInterface $themeLoader;
32
-  private CacheInterface $cacheService;
29
+    private Environment $twig;
30
+    private AmpConverterInterface $converter;
31
+    private ThemeLoaderInterface $themeLoader;
32
+    private CacheInterface $cacheService;
33 33
 
34
-  public function __construct(
35
-      Environment           $twig,
36
-      AmpConverterInterface $ampConverter,
37
-      ThemeLoaderInterface  $ampThemeLoader,
38
-      CacheInterface        $cacheService
39
-  ) {
34
+    public function __construct(
35
+        Environment           $twig,
36
+        AmpConverterInterface $ampConverter,
37
+        ThemeLoaderInterface  $ampThemeLoader,
38
+        CacheInterface        $cacheService
39
+    ) {
40 40
     $this->twig = $twig;
41 41
     $this->converter = $ampConverter;
42 42
     $this->themeLoader = $ampThemeLoader;
43 43
     $this->cacheService = $cacheService;
44
-  }
44
+    }
45 45
 
46
-  public function viewAction(AmpInterface $object): Response {
46
+    public function viewAction(AmpInterface $object): Response {
47 47
     return $this->cacheService->get($this->getCacheKey($object), function () use ($object) {
48
-      $this->themeLoader->load();
49
-      $content = $this->twig->render(sprintf('@%s/index.html.twig', ThemeLoaderInterface::THEME_NAMESPACE), [
50
-          'object' => $object,
51
-      ]);
48
+        $this->themeLoader->load();
49
+        $content = $this->twig->render(sprintf('@%s/index.html.twig', ThemeLoaderInterface::THEME_NAMESPACE), [
50
+            'object' => $object,
51
+        ]);
52 52
 
53
-      $response = new Response();
54
-      $response->setContent($this->converter->convertToAmp($content));
55
-      return $response;
53
+        $response = new Response();
54
+        $response->setContent($this->converter->convertToAmp($content));
55
+        return $response;
56 56
     });
57
-  }
57
+    }
58 58
 
59
-  private function getCacheKey(AmpInterface $object): string {
59
+    private function getCacheKey(AmpInterface $object): string {
60 60
     $elements = ['amp_article'];
61 61
     if ($object instanceof PersistableInterface) {
62
-      $elements[] = $object->getId();
62
+        $elements[] = $object->getId();
63 63
     }
64 64
 
65 65
     if ($object instanceof TimestampableInterface && null !== $object->getUpdatedAt()) {
66
-      $elements[] = $object->getUpdatedAt()->getTimestamp();
66
+        $elements[] = $object->getUpdatedAt()->getTimestamp();
67 67
     }
68 68
 
69 69
     return md5(implode('__', $elements));
70
-  }
70
+    }
71 71
 }
Please login to merge, or discard this patch.