@@ -50,7 +50,7 @@ |
||
| 50 | 50 | */ |
| 51 | 51 | public function getLogoAction(string $id) { |
| 52 | 52 | $cacheKey = md5(serialize(['upload', $id])); |
| 53 | - return $this->cacheInterface->get($cacheKey, function (CacheItemInterface $item, &$save) use ($id) { |
|
| 53 | + return $this->cacheInterface->get($cacheKey, function(CacheItemInterface $item, &$save) use ($id) { |
|
| 54 | 54 | $item->expiresAfter(63072000); |
| 55 | 55 | |
| 56 | 56 | $fileSystem = $this->filesystem; |
@@ -29,50 +29,50 @@ |
||
| 29 | 29 | |
| 30 | 30 | class ThemeLogoController extends Controller { |
| 31 | 31 | |
| 32 | - private Filesystem $filesystem; |
|
| 33 | - private ThemeLogoUploaderInterface $themeLogoUploader; |
|
| 34 | - private CacheInterface $cacheInterface; |
|
| 32 | + private Filesystem $filesystem; |
|
| 33 | + private ThemeLogoUploaderInterface $themeLogoUploader; |
|
| 34 | + private CacheInterface $cacheInterface; |
|
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * @param Filesystem $filesystem |
|
| 38 | - * @param ThemeLogoUploaderInterface $themeLogoUploader |
|
| 39 | - * @param CacheInterface $cacheInterface |
|
| 40 | - */ |
|
| 41 | - public function __construct(Filesystem $filesystem, ThemeLogoUploaderInterface $themeLogoUploader, |
|
| 42 | - CacheInterface $cacheInterface) { |
|
| 36 | + /** |
|
| 37 | + * @param Filesystem $filesystem |
|
| 38 | + * @param ThemeLogoUploaderInterface $themeLogoUploader |
|
| 39 | + * @param CacheInterface $cacheInterface |
|
| 40 | + */ |
|
| 41 | + public function __construct(Filesystem $filesystem, ThemeLogoUploaderInterface $themeLogoUploader, |
|
| 42 | + CacheInterface $cacheInterface) { |
|
| 43 | 43 | $this->filesystem = $filesystem; |
| 44 | 44 | $this->themeLogoUploader = $themeLogoUploader; |
| 45 | 45 | $this->cacheInterface = $cacheInterface; |
| 46 | - } |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - /** |
|
| 49 | - * @Route("/theme_logo/{id}", options={"expose"=true}, requirements={"id"=".+"}, methods={"GET"}, name="swp_theme_logo_get") |
|
| 50 | - */ |
|
| 51 | - public function getLogoAction(string $id) { |
|
| 48 | + /** |
|
| 49 | + * @Route("/theme_logo/{id}", options={"expose"=true}, requirements={"id"=".+"}, methods={"GET"}, name="swp_theme_logo_get") |
|
| 50 | + */ |
|
| 51 | + public function getLogoAction(string $id) { |
|
| 52 | 52 | $cacheKey = md5(serialize(['upload', $id])); |
| 53 | 53 | return $this->cacheInterface->get($cacheKey, function (CacheItemInterface $item, &$save) use ($id) { |
| 54 | - $item->expiresAfter(63072000); |
|
| 54 | + $item->expiresAfter(63072000); |
|
| 55 | 55 | |
| 56 | - $fileSystem = $this->filesystem; |
|
| 57 | - $themeLogoUploader = $this->themeLogoUploader; |
|
| 58 | - $id = $themeLogoUploader->getThemeLogoUploadPath($id); |
|
| 59 | - $file = $fileSystem->has($id); |
|
| 60 | - if (!$file) { |
|
| 56 | + $fileSystem = $this->filesystem; |
|
| 57 | + $themeLogoUploader = $this->themeLogoUploader; |
|
| 58 | + $id = $themeLogoUploader->getThemeLogoUploadPath($id); |
|
| 59 | + $file = $fileSystem->has($id); |
|
| 60 | + if (!$file) { |
|
| 61 | 61 | $save = false; |
| 62 | 62 | throw new NotFoundHttpException('File was not found.'); |
| 63 | - } |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | - $path = $fileSystem->get($id)->getPath(); |
|
| 66 | - $response = new Response(); |
|
| 67 | - $disposition = $response->headers->makeDisposition(ResponseHeaderBag::DISPOSITION_INLINE, pathinfo($path, PATHINFO_BASENAME)); |
|
| 68 | - $response->headers->set('Content-Disposition', $disposition); |
|
| 69 | - $response->headers->set('Content-Type', MimeTypeHelper::getByPath($path)); |
|
| 70 | - $response->setPublic(); |
|
| 71 | - $response->setMaxAge(63072000); |
|
| 72 | - $response->setSharedMaxAge(63072000); |
|
| 73 | - $response->setContent($fileSystem->read($path)); |
|
| 65 | + $path = $fileSystem->get($id)->getPath(); |
|
| 66 | + $response = new Response(); |
|
| 67 | + $disposition = $response->headers->makeDisposition(ResponseHeaderBag::DISPOSITION_INLINE, pathinfo($path, PATHINFO_BASENAME)); |
|
| 68 | + $response->headers->set('Content-Disposition', $disposition); |
|
| 69 | + $response->headers->set('Content-Type', MimeTypeHelper::getByPath($path)); |
|
| 70 | + $response->setPublic(); |
|
| 71 | + $response->setMaxAge(63072000); |
|
| 72 | + $response->setSharedMaxAge(63072000); |
|
| 73 | + $response->setContent($fileSystem->read($path)); |
|
| 74 | 74 | |
| 75 | - return $response; |
|
| 75 | + return $response; |
|
| 76 | 76 | }); |
| 77 | - } |
|
| 77 | + } |
|
| 78 | 78 | } |
@@ -29,32 +29,32 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | class FbiaArticleController extends Controller { |
| 31 | 31 | |
| 32 | - private FacebookInstantArticlesArticleRepository $facebookInstantArticlesArticleRepository; |
|
| 33 | - private FacebookInstantArticlesService $facebookInstantArticlesService; |
|
| 34 | - private EventDispatcherInterface $eventDispatcher; |
|
| 32 | + private FacebookInstantArticlesArticleRepository $facebookInstantArticlesArticleRepository; |
|
| 33 | + private FacebookInstantArticlesService $facebookInstantArticlesService; |
|
| 34 | + private EventDispatcherInterface $eventDispatcher; |
|
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * @param FacebookInstantArticlesArticleRepository $facebookInstantArticlesArticleRepository |
|
| 38 | - * @param FacebookInstantArticlesService $facebookInstantArticlesService |
|
| 39 | - * @param EventDispatcherInterface $eventDispatcher |
|
| 40 | - */ |
|
| 41 | - public function __construct(FacebookInstantArticlesArticleRepository $facebookInstantArticlesArticleRepository, |
|
| 42 | - FacebookInstantArticlesService $facebookInstantArticlesService, |
|
| 43 | - EventDispatcherInterface $eventDispatcher) { |
|
| 36 | + /** |
|
| 37 | + * @param FacebookInstantArticlesArticleRepository $facebookInstantArticlesArticleRepository |
|
| 38 | + * @param FacebookInstantArticlesService $facebookInstantArticlesService |
|
| 39 | + * @param EventDispatcherInterface $eventDispatcher |
|
| 40 | + */ |
|
| 41 | + public function __construct(FacebookInstantArticlesArticleRepository $facebookInstantArticlesArticleRepository, |
|
| 42 | + FacebookInstantArticlesService $facebookInstantArticlesService, |
|
| 43 | + EventDispatcherInterface $eventDispatcher) { |
|
| 44 | 44 | $this->facebookInstantArticlesArticleRepository = $facebookInstantArticlesArticleRepository; |
| 45 | 45 | $this->facebookInstantArticlesService = $facebookInstantArticlesService; |
| 46 | 46 | $this->eventDispatcher = $eventDispatcher; |
| 47 | - } |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | 49 | |
| 50 | - /** |
|
| 51 | - * @Route("/api/{version}/facebook/instantarticles/articles/", options={"expose"=true}, defaults={"version"="v2"}, methods={"GET"}, name="swp_api_list_facebook_instant_articles_articles") |
|
| 52 | - */ |
|
| 53 | - public function listAction(Request $request): ResourcesListResponseInterface { |
|
| 50 | + /** |
|
| 51 | + * @Route("/api/{version}/facebook/instantarticles/articles/", options={"expose"=true}, defaults={"version"="v2"}, methods={"GET"}, name="swp_api_list_facebook_instant_articles_articles") |
|
| 52 | + */ |
|
| 53 | + public function listAction(Request $request): ResourcesListResponseInterface { |
|
| 54 | 54 | $repository = $this->facebookInstantArticlesArticleRepository; |
| 55 | 55 | $sort = $request->query->all('sorting'); |
| 56 | 56 | if (empty($sort)) { |
| 57 | - $sort = ['createdAt' => 'desc']; |
|
| 57 | + $sort = ['createdAt' => 'desc']; |
|
| 58 | 58 | } |
| 59 | 59 | $items = $repository->getPaginatedByCriteria( |
| 60 | 60 | $this->eventDispatcher, |
@@ -64,15 +64,15 @@ discard block |
||
| 64 | 64 | ); |
| 65 | 65 | |
| 66 | 66 | return new ResourcesListResponse($items); |
| 67 | - } |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | - /** |
|
| 70 | - * @Route("/api/{version}/facebook/instantarticles/articles/{submissionId}", options={"expose"=true}, defaults={"version"="v2"}, methods={"POST"}, name="swp_api_facebook_instant_articles_articles_update") |
|
| 71 | - */ |
|
| 72 | - public function updateSubmissionAction(string $submissionId): SingleResourceResponseInterface { |
|
| 69 | + /** |
|
| 70 | + * @Route("/api/{version}/facebook/instantarticles/articles/{submissionId}", options={"expose"=true}, defaults={"version"="v2"}, methods={"POST"}, name="swp_api_facebook_instant_articles_articles_update") |
|
| 71 | + */ |
|
| 72 | + public function updateSubmissionAction(string $submissionId): SingleResourceResponseInterface { |
|
| 73 | 73 | $instantArticlesService = $this->facebookInstantArticlesService; |
| 74 | 74 | $instantArticle = $instantArticlesService->updateSubmissionStatus($submissionId); |
| 75 | 75 | |
| 76 | 76 | return new SingleResourceResponse($instantArticle); |
| 77 | - } |
|
| 77 | + } |
|
| 78 | 78 | } |
@@ -43,29 +43,29 @@ |
||
| 43 | 43 | { |
| 44 | 44 | $collectionRouteCacheKey = md5('route_'.$url); |
| 45 | 45 | return $this->cacheProvider->get($collectionRouteCacheKey, function (ItemInterface $item, &$save) use ($url) { |
| 46 | - try { |
|
| 46 | + try { |
|
| 47 | 47 | $route = $this->matcher->match($this->getFragmentFromUrl($url, 'path')); |
| 48 | - } catch(ResourceNotFoundException $e) { |
|
| 48 | + } catch(ResourceNotFoundException $e) { |
|
| 49 | 49 | $save = false; |
| 50 | 50 | return null; |
| 51 | - } |
|
| 52 | - if(!isset($route['_article_meta'])) { |
|
| 51 | + } |
|
| 52 | + if(!isset($route['_article_meta'])) { |
|
| 53 | 53 | $save = false; |
| 54 | 54 | return null; |
| 55 | - } |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - if(!($route['_article_meta'] instanceof Meta)) { |
|
| 57 | + if(!($route['_article_meta'] instanceof Meta)) { |
|
| 58 | 58 | $save = false; |
| 59 | 59 | return null; |
| 60 | - } |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | - $values = $route['_article_meta']->getValues(); |
|
| 63 | - if(!($values instanceof ArticleInterface)) { |
|
| 62 | + $values = $route['_article_meta']->getValues(); |
|
| 63 | + if(!($values instanceof ArticleInterface)) { |
|
| 64 | 64 | $save = false; |
| 65 | 65 | return null; |
| 66 | - } |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - return $values; |
|
| 68 | + return $values; |
|
| 69 | 69 | }); |
| 70 | 70 | } |
| 71 | 71 | |
@@ -42,25 +42,25 @@ |
||
| 42 | 42 | public function resolve(string $url): ?ArticleInterface |
| 43 | 43 | { |
| 44 | 44 | $collectionRouteCacheKey = md5('route_'.$url); |
| 45 | - return $this->cacheProvider->get($collectionRouteCacheKey, function (ItemInterface $item, &$save) use ($url) { |
|
| 45 | + return $this->cacheProvider->get($collectionRouteCacheKey, function(ItemInterface $item, &$save) use ($url) { |
|
| 46 | 46 | try { |
| 47 | 47 | $route = $this->matcher->match($this->getFragmentFromUrl($url, 'path')); |
| 48 | - } catch(ResourceNotFoundException $e) { |
|
| 48 | + } catch (ResourceNotFoundException $e) { |
|
| 49 | 49 | $save = false; |
| 50 | 50 | return null; |
| 51 | 51 | } |
| 52 | - if(!isset($route['_article_meta'])) { |
|
| 52 | + if (!isset($route['_article_meta'])) { |
|
| 53 | 53 | $save = false; |
| 54 | 54 | return null; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - if(!($route['_article_meta'] instanceof Meta)) { |
|
| 57 | + if (!($route['_article_meta'] instanceof Meta)) { |
|
| 58 | 58 | $save = false; |
| 59 | 59 | return null; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | $values = $route['_article_meta']->getValues(); |
| 63 | - if(!($values instanceof ArticleInterface)) { |
|
| 63 | + if (!($values instanceof ArticleInterface)) { |
|
| 64 | 64 | $save = false; |
| 65 | 65 | return null; |
| 66 | 66 | } |
@@ -52,7 +52,7 @@ |
||
| 52 | 52 | |
| 53 | 53 | if ($isPublishedToAppleNews = (bool) $configuration[$this->supportedKeys[0]]) { |
| 54 | 54 | $subject->setPublishedToAppleNews($isPublishedToAppleNews); |
| 55 | - $this->eventDispatcher->dispatch( new ArticleEvent($subject, null, ArticleEvents::PUBLISH), ArticleEvents::PUBLISH); |
|
| 55 | + $this->eventDispatcher->dispatch(new ArticleEvent($subject, null, ArticleEvents::PUBLISH), ArticleEvents::PUBLISH); |
|
| 56 | 56 | |
| 57 | 57 | $this->logger->info(sprintf( |
| 58 | 58 | 'Configuration: "%s" for "%s" rule has been applied!', |
@@ -60,7 +60,7 @@ |
||
| 60 | 60 | |
| 61 | 61 | if ($isPublishedFBIA = (bool) $configuration['isPublishedFbia']) { |
| 62 | 62 | $subject->setPublishedFBIA($isPublishedFBIA); |
| 63 | - $this->eventDispatcher->dispatch( new ArticleEvent($subject, null, ArticleEvents::PUBLISH), ArticleEvents::PUBLISH); |
|
| 63 | + $this->eventDispatcher->dispatch(new ArticleEvent($subject, null, ArticleEvents::PUBLISH), ArticleEvents::PUBLISH); |
|
| 64 | 64 | |
| 65 | 65 | $this->logger->info(sprintf( |
| 66 | 66 | 'Configuration: "%s" for "%s" rule has been applied!', |
@@ -101,14 +101,14 @@ |
||
| 101 | 101 | |
| 102 | 102 | $this->articleRepository->persist($articleStatistics); |
| 103 | 103 | |
| 104 | - $this->eventDispatcher->dispatch( new GenericEvent($article), Events::SWP_VALIDATION); |
|
| 104 | + $this->eventDispatcher->dispatch(new GenericEvent($article), Events::SWP_VALIDATION); |
|
| 105 | 105 | |
| 106 | 106 | $article->setPackage($package); |
| 107 | 107 | $article->setArticleStatistics($articleStatistics); |
| 108 | 108 | $this->articleRepository->persist($article); |
| 109 | - $this->eventDispatcher->dispatch( new ArticleEvent($article, $package, ArticleEvents::PRE_CREATE), ArticleEvents::PRE_CREATE); |
|
| 109 | + $this->eventDispatcher->dispatch(new ArticleEvent($article, $package, ArticleEvents::PRE_CREATE), ArticleEvents::PRE_CREATE); |
|
| 110 | 110 | $this->articleRepository->flush(); |
| 111 | - $this->eventDispatcher->dispatch( new ArticleEvent($article, $package, ArticleEvents::POST_CREATE),ArticleEvents::POST_CREATE); |
|
| 111 | + $this->eventDispatcher->dispatch(new ArticleEvent($article, $package, ArticleEvents::POST_CREATE), ArticleEvents::POST_CREATE); |
|
| 112 | 112 | $this->entityManager->flush($article); |
| 113 | 113 | } |
| 114 | 114 | $this->tenantContext->setTenant($originalTenant); |
@@ -50,13 +50,13 @@ |
||
| 50 | 50 | TenantContextInterface $tenantContext, |
| 51 | 51 | ParameterBagInterface $parameterBag, |
| 52 | 52 | ArticleRepositoryInterface $articleRepository, |
| 53 | - ArticleBodyProcessorChain $articleBodyProcessorChain ) |
|
| 53 | + ArticleBodyProcessorChain $articleBodyProcessorChain) |
|
| 54 | 54 | { |
| 55 | 55 | $this->repositoryManager = $repositoryManager; |
| 56 | 56 | $this->tenantContext = $tenantContext; |
| 57 | 57 | $this->parameterBag = $parameterBag; |
| 58 | 58 | $this->articleRepository = $articleRepository; |
| 59 | - $this->articleBodyProcessorChain = $articleBodyProcessorChain; |
|
| 59 | + $this->articleBodyProcessorChain = $articleBodyProcessorChain; |
|
| 60 | 60 | |
| 61 | 61 | parent::__construct(); |
| 62 | 62 | } |
@@ -64,16 +64,16 @@ |
||
| 64 | 64 | ParameterBagInterface $parameterBag, |
| 65 | 65 | ThemeServiceInterface $themeService |
| 66 | 66 | ) { |
| 67 | - $this->tenantContext = $tenantContext; |
|
| 68 | - $this->tenantRepository = $tenantRepository; |
|
| 69 | - $this->eventDispatcher = $eventDispatcher; |
|
| 70 | - $this->parameterBag = $parameterBag; |
|
| 71 | - $this->themeService = $themeService; |
|
| 72 | - parent::__construct(); |
|
| 67 | + $this->tenantContext = $tenantContext; |
|
| 68 | + $this->tenantRepository = $tenantRepository; |
|
| 69 | + $this->eventDispatcher = $eventDispatcher; |
|
| 70 | + $this->parameterBag = $parameterBag; |
|
| 71 | + $this->themeService = $themeService; |
|
| 72 | + parent::__construct(); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | |
| 76 | - /** |
|
| 76 | + /** |
|
| 77 | 77 | * {@inheritdoc} |
| 78 | 78 | */ |
| 79 | 79 | protected function configure() |
@@ -45,9 +45,9 @@ |
||
| 45 | 45 | * @param OrganizationRepositoryInterface $organizationRepository |
| 46 | 46 | */ |
| 47 | 47 | public function __construct(ParameterBagInterface $parameterBag, OrganizationRepositoryInterface $organizationRepository) { |
| 48 | - $this->parameterBag = $parameterBag; |
|
| 49 | - $this->organizationRepository = $organizationRepository; |
|
| 50 | - parent::__construct(); |
|
| 48 | + $this->parameterBag = $parameterBag; |
|
| 49 | + $this->organizationRepository = $organizationRepository; |
|
| 50 | + parent::__construct(); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | /** |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | */ |
| 114 | 114 | protected function getTenant(InputInterface $input, OutputInterface $output) |
| 115 | 115 | { |
| 116 | - $organizationRepository =$this->organizationRepository; |
|
| 116 | + $organizationRepository = $this->organizationRepository; |
|
| 117 | 117 | $organizationName = $input->getArgument('organizationName'); |
| 118 | 118 | $organization = $organizationRepository->findOneByName($organizationName); |
| 119 | 119 | if (null === $organization) { |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | |
| 132 | 132 | $tenant = reset($tenants); |
| 133 | 133 | if ($numTenants > 1) { |
| 134 | - $tenantNames = array_map(function ($tenant) { |
|
| 134 | + $tenantNames = array_map(function($tenant) { |
|
| 135 | 135 | return $tenant->getName(); |
| 136 | 136 | }, $tenants); |
| 137 | 137 | |