Completed
Pull Request — master (#1218)
by
unknown
01:23
created
src/SWP/Bundle/CoreBundle/Command/ThemeSetupCommand.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -64,16 +64,16 @@
 block discarded – undo
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()
Please login to merge, or discard this patch.
src/SWP/Bundle/CoreBundle/Command/ThemeGenerateCommand.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -45,9 +45,9 @@
 block discarded – undo
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
     /**
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/SWP/Bundle/CoreBundle/Provider/CachedSubscriptionsProvider.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -65,8 +65,8 @@  discard block
 block discarded – undo
65 65
         $cacheKey = urlencode($this->generateCacheKey($subscriber).implode('_', $filters));
66 66
 
67 67
         return $this->cacheProvider->get($cacheKey, function (ItemInterface $item) use ($subscriber, $filters) {
68
-          $item->expiresAfter($this->cacheLifeTime);
69
-          return $this->decoratedProvider->getSubscriptions($subscriber, $filters);
68
+            $item->expiresAfter($this->cacheLifeTime);
69
+            return $this->decoratedProvider->getSubscriptions($subscriber, $filters);
70 70
         });
71 71
     }
72 72
 
@@ -74,8 +74,8 @@  discard block
 block discarded – undo
74 74
     {
75 75
         $cacheKey = urlencode($this->generateCacheKey($subscriber, self::CACHE_KEY_VALID).implode('_', $filters));
76 76
         return $this->cacheProvider->get($cacheKey, function (ItemInterface $item) use ($subscriber, $filters) {
77
-          $item->expiresAfter($this->cacheLifeTime);
78
-          return $this->decoratedProvider->getSubscription($subscriber, $filters);
77
+            $item->expiresAfter($this->cacheLifeTime);
78
+            return $this->decoratedProvider->getSubscription($subscriber, $filters);
79 79
         });
80 80
     }
81 81
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
     {
65 65
         $cacheKey = urlencode($this->generateCacheKey($subscriber).implode('_', $filters));
66 66
 
67
-        return $this->cacheProvider->get($cacheKey, function (ItemInterface $item) use ($subscriber, $filters) {
67
+        return $this->cacheProvider->get($cacheKey, function(ItemInterface $item) use ($subscriber, $filters) {
68 68
           $item->expiresAfter($this->cacheLifeTime);
69 69
           return $this->decoratedProvider->getSubscriptions($subscriber, $filters);
70 70
         });
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
     public function getSubscription(SubscriberInterface $subscriber, array $filters = []): ?SubscriptionInterface
74 74
     {
75 75
         $cacheKey = urlencode($this->generateCacheKey($subscriber, self::CACHE_KEY_VALID).implode('_', $filters));
76
-        return $this->cacheProvider->get($cacheKey, function (ItemInterface $item) use ($subscriber, $filters) {
76
+        return $this->cacheProvider->get($cacheKey, function(ItemInterface $item) use ($subscriber, $filters) {
77 77
           $item->expiresAfter($this->cacheLifeTime);
78 78
           return $this->decoratedProvider->getSubscription($subscriber, $filters);
79 79
         });
Please login to merge, or discard this patch.
src/SWP/Bundle/MultiTenancyBundle/Command/CreateOrganizationCommand.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -39,18 +39,18 @@
 block discarded – undo
39 39
     /** @var OrganizationFactoryInterface */
40 40
     private  $organizationFactory;
41 41
 
42
-  /**
43
-   * @param OrganizationRepositoryInterface $organizationRepository
44
-   * @param OrganizationFactoryInterface $organizationFactory
45
-   */
46
-  public function __construct( OrganizationRepositoryInterface $organizationRepository, OrganizationFactoryInterface $organizationFactory) {
42
+    /**
43
+     * @param OrganizationRepositoryInterface $organizationRepository
44
+     * @param OrganizationFactoryInterface $organizationFactory
45
+     */
46
+    public function __construct( OrganizationRepositoryInterface $organizationRepository, OrganizationFactoryInterface $organizationFactory) {
47 47
     $this->organizationRepository = $organizationRepository;
48 48
     $this->organizationFactory = $organizationFactory;
49 49
     parent::__construct();
50
-  }
50
+    }
51 51
 
52 52
 
53
-  /**
53
+    /**
54 54
      * {@inheritdoc}
55 55
      */
56 56
     protected function configure()
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
    * @param OrganizationRepositoryInterface $organizationRepository
44 44
    * @param OrganizationFactoryInterface $organizationFactory
45 45
    */
46
-  public function __construct( OrganizationRepositoryInterface $organizationRepository, OrganizationFactoryInterface $organizationFactory) {
46
+  public function __construct(OrganizationRepositoryInterface $organizationRepository, OrganizationFactoryInterface $organizationFactory) {
47 47
     $this->organizationRepository = $organizationRepository;
48 48
     $this->organizationFactory = $organizationFactory;
49 49
     parent::__construct();
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
     {
127 127
         if (!$input->getArgument($name)) {
128 128
             $question = new Question(sprintf('<question>Please enter %s:</question>', $name));
129
-            $question->setValidator(function ($argument) use ($name) {
129
+            $question->setValidator(function($argument) use ($name) {
130 130
                 if (empty($argument)) {
131 131
                     throw new \RuntimeException(sprintf('The %s can not be empty', $name));
132 132
                 }
Please login to merge, or discard this patch.
src/SWP/Bundle/ContentBundle/EventListener/LinkRequestListener.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -123,8 +123,8 @@
 block discarded – undo
123 123
 
124 124
             $subEvent = new ControllerEvent($event->getKernel(), $controller, $stubRequest, HttpKernelInterface::SUB_REQUEST);
125 125
             $kernelSubEvent = new RequestEvent($event->getKernel(), $stubRequest, HttpKernelInterface::SUB_REQUEST);
126
-            $dispatcher->dispatch( $kernelSubEvent, KernelEvents::REQUEST);
127
-            $dispatcher->dispatch( $subEvent, KernelEvents::CONTROLLER);
126
+            $dispatcher->dispatch($kernelSubEvent, KernelEvents::REQUEST);
127
+            $dispatcher->dispatch($subEvent, KernelEvents::CONTROLLER);
128 128
             $controller = $subEvent->getController();
129 129
 
130 130
             $argumentResolver = new ArgumentResolver();
Please login to merge, or discard this patch.
src/SWP/Bundle/ContentBundle/Doctrine/ORM/ArticleRepository.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
             $paginationData = new PaginationData();
152 152
         }
153 153
 
154
-        return $this->getPaginator($eventDispatcher,$queryBuilder, $paginationData);
154
+        return $this->getPaginator($eventDispatcher, $queryBuilder, $paginationData);
155 155
     }
156 156
 
157 157
     /**
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
                 ->leftJoin('a.extraEmbedFields', 'eef');
173 173
 
174 174
             foreach ((array) $criteria->get('extra') as $key => $value) {
175
-                if(is_array($value)) {
175
+                if (is_array($value)) {
176 176
                     $andX = $queryBuilder->expr()->andX();
177 177
                     $andX->add($queryBuilder->expr()->eq('eef.fieldName', $queryBuilder->expr()->literal($key)));
178 178
                     $andX->add($queryBuilder->expr()->eq('eef.embed', $queryBuilder->expr()->literal($value['embed'])));
Please login to merge, or discard this patch.
src/SWP/Bundle/ContentBundle/Doctrine/ORM/RelatedArticleRepository.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@
 block discarded – undo
61 61
             $paginationData = new PaginationData();
62 62
         }
63 63
 
64
-        return $this->getPaginator($eventDispatcher,$queryBuilder, $paginationData);
64
+        return $this->getPaginator($eventDispatcher, $queryBuilder, $paginationData);
65 65
     }
66 66
 
67 67
     private function applyCustomCriteria(QueryBuilder $queryBuilder, Criteria $criteria): void
Please login to merge, or discard this patch.
src/SWP/Bundle/ContentBundle/Controller/AuthorController.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -27,32 +27,32 @@
 block discarded – undo
27 27
 
28 28
 class AuthorController extends AbstractController {
29 29
 
30
-  private ArticleAuthorRepositoryInterface $articleAuthorRepository; // swp.repository.author
30
+    private ArticleAuthorRepositoryInterface $articleAuthorRepository; // swp.repository.author
31 31
 
32
-  /**
33
-   * @param ArticleAuthorRepositoryInterface $articleAuthorRepository
34
-   */
35
-  public function __construct(ArticleAuthorRepositoryInterface $articleAuthorRepository) {
32
+    /**
33
+     * @param ArticleAuthorRepositoryInterface $articleAuthorRepository
34
+     */
35
+    public function __construct(ArticleAuthorRepositoryInterface $articleAuthorRepository) {
36 36
     $this->articleAuthorRepository = $articleAuthorRepository;
37
-  }
37
+    }
38 38
 
39
-  /**
40
-   * @Route("/api/{version}/authors/{id}", methods={"DELETE"}, options={"expose"=true}, defaults={"version"="v2"}, name="swp_api_core_delete_author", requirements={"id"="\d+"})
41
-   */
42
-  public function deleteAction(int $id): SingleResourceResponseInterface {
39
+    /**
40
+     * @Route("/api/{version}/authors/{id}", methods={"DELETE"}, options={"expose"=true}, defaults={"version"="v2"}, name="swp_api_core_delete_author", requirements={"id"="\d+"})
41
+     */
42
+    public function deleteAction(int $id): SingleResourceResponseInterface {
43 43
     $authorRepository = $this->articleAuthorRepository;
44 44
     $author = $this->findOr404($id);
45 45
 
46 46
     $authorRepository->remove($author);
47 47
 
48 48
     return new SingleResourceResponse(null, new ResponseContext(204));
49
-  }
49
+    }
50 50
 
51
-  private function findOr404(int $id): ArticleAuthorInterface {
51
+    private function findOr404(int $id): ArticleAuthorInterface {
52 52
     if (null === $author = $this->articleAuthorRepository->findOneById($id)) {
53
-      throw new NotFoundHttpException('Author was not found.');
53
+        throw new NotFoundHttpException('Author was not found.');
54 54
     }
55 55
 
56 56
     return $author;
57
-  }
57
+    }
58 58
 }
Please login to merge, or discard this patch.
src/SWP/Bundle/ContentBundle/Controller/ContentPushController.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
   private DataTransformerInterface $dataTransformer; // swp_bridge.transformer.json_to_package
49 49
   private MediaManagerInterface $mediaManager; // swp_content_bundle.manager.media
50 50
   private EntityManagerInterface $entityManager; // swp.object_manager.media
51
-  private PackageRepositoryInterface $packageRepository;//swp.repository.package
51
+  private PackageRepositoryInterface $packageRepository; //swp.repository.package
52 52
   private FileProviderInterface $fileProvider;
53 53
 
54 54
   /**
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
         );
127 127
       }
128 128
 
129
-      throw new \Exception('Uploaded file is not valid:' . $uploadedFile->getErrorMessage());
129
+      throw new \Exception('Uploaded file is not valid:'.$uploadedFile->getErrorMessage());
130 130
     }
131 131
 
132 132
     return new SingleResourceResponse($form);
Please login to merge, or discard this patch.
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -41,32 +41,32 @@  discard block
 block discarded – undo
41 41
 use FOS\RestBundle\Controller\Annotations\Route;
42 42
 
43 43
 class ContentPushController extends AbstractController {
44
-  private EventDispatcherInterface $eventDispatcher;
45
-  private FormFactoryInterface $formFactory;
46
-  private MessageBusInterface $messageBus;
47
-  private CachedTenantContextInterface $cachedTenantContext; //swp_multi_tenancy.tenant_context
48
-  private DataTransformerInterface $dataTransformer; // swp_bridge.transformer.json_to_package
49
-  private MediaManagerInterface $mediaManager; // swp_content_bundle.manager.media
50
-  private EntityManagerInterface $entityManager; // swp.object_manager.media
51
-  private PackageRepositoryInterface $packageRepository;//swp.repository.package
52
-  private FileProviderInterface $fileProvider;
53
-
54
-  /**
55
-   * @param EventDispatcherInterface $eventDispatcher
56
-   * @param FormFactoryInterface $formFactory
57
-   * @param MessageBusInterface $messageBus
58
-   * @param CachedTenantContextInterface $cachedTenantContext
59
-   * @param DataTransformerInterface $dataTransformer
60
-   * @param MediaManagerInterface $mediaManager
61
-   * @param EntityManagerInterface $entityManager
62
-   * @param PackageRepositoryInterface $packageRepository
63
-   * @param FileProviderInterface $fileProvider
64
-   */
65
-  public function __construct(EventDispatcherInterface $eventDispatcher, FormFactoryInterface $formFactory,
66
-                              MessageBusInterface      $messageBus, CachedTenantContextInterface $cachedTenantContext,
67
-                              DataTransformerInterface $dataTransformer, MediaManagerInterface $mediaManager,
68
-                              EntityManagerInterface   $entityManager, PackageRepositoryInterface $packageRepository,
69
-                              FileProviderInterface    $fileProvider) {
44
+    private EventDispatcherInterface $eventDispatcher;
45
+    private FormFactoryInterface $formFactory;
46
+    private MessageBusInterface $messageBus;
47
+    private CachedTenantContextInterface $cachedTenantContext; //swp_multi_tenancy.tenant_context
48
+    private DataTransformerInterface $dataTransformer; // swp_bridge.transformer.json_to_package
49
+    private MediaManagerInterface $mediaManager; // swp_content_bundle.manager.media
50
+    private EntityManagerInterface $entityManager; // swp.object_manager.media
51
+    private PackageRepositoryInterface $packageRepository;//swp.repository.package
52
+    private FileProviderInterface $fileProvider;
53
+
54
+    /**
55
+     * @param EventDispatcherInterface $eventDispatcher
56
+     * @param FormFactoryInterface $formFactory
57
+     * @param MessageBusInterface $messageBus
58
+     * @param CachedTenantContextInterface $cachedTenantContext
59
+     * @param DataTransformerInterface $dataTransformer
60
+     * @param MediaManagerInterface $mediaManager
61
+     * @param EntityManagerInterface $entityManager
62
+     * @param PackageRepositoryInterface $packageRepository
63
+     * @param FileProviderInterface $fileProvider
64
+     */
65
+    public function __construct(EventDispatcherInterface $eventDispatcher, FormFactoryInterface $formFactory,
66
+                                MessageBusInterface      $messageBus, CachedTenantContextInterface $cachedTenantContext,
67
+                                DataTransformerInterface $dataTransformer, MediaManagerInterface $mediaManager,
68
+                                EntityManagerInterface   $entityManager, PackageRepositoryInterface $packageRepository,
69
+                                FileProviderInterface    $fileProvider) {
70 70
     $this->eventDispatcher = $eventDispatcher;
71 71
     $this->formFactory = $formFactory;
72 72
     $this->messageBus = $messageBus;
@@ -76,13 +76,13 @@  discard block
 block discarded – undo
76 76
     $this->entityManager = $entityManager;
77 77
     $this->packageRepository = $packageRepository;
78 78
     $this->fileProvider = $fileProvider;
79
-  }
79
+    }
80 80
 
81 81
 
82
-  /**
83
-   * @Route("/api/{version}/content/push", methods={"POST"}, options={"expose"=true}, defaults={"version"="v2"}, name="swp_api_content_push")
84
-   */
85
-  public function pushContentAction(Request $request): SingleResourceResponseInterface {
82
+    /**
83
+     * @Route("/api/{version}/content/push", methods={"POST"}, options={"expose"=true}, defaults={"version"="v2"}, name="swp_api_content_push")
84
+     */
85
+    public function pushContentAction(Request $request): SingleResourceResponseInterface {
86 86
     $package = $this->dataTransformer->transform($request->getContent());
87 87
     $this->eventDispatcher->dispatch(new GenericEvent($package), Events::SWP_VALIDATION);
88 88
 
@@ -91,27 +91,27 @@  discard block
 block discarded – undo
91 91
     $this->messageBus->dispatch(new ContentPushMessage($currentTenant->getId(), $request->getContent()));
92 92
 
93 93
     return new SingleResourceResponse(['status' => 'OK'], new ResponseContext(201));
94
-  }
94
+    }
95 95
 
96
-  /**
97
-   * @Route("/api/{version}/assets/push", methods={"POST"}, options={"expose"=true}, defaults={"version"="v2"}, name="swp_api_assets_push")
98
-   */
99
-  public function pushAssetsAction(Request $request): SingleResourceResponseInterface {
96
+    /**
97
+     * @Route("/api/{version}/assets/push", methods={"POST"}, options={"expose"=true}, defaults={"version"="v2"}, name="swp_api_assets_push")
98
+     */
99
+    public function pushAssetsAction(Request $request): SingleResourceResponseInterface {
100 100
     $form = $this->formFactory->createNamed('', MediaFileType::class);
101 101
     $form->handleRequest($request);
102 102
 
103 103
     if ($form->isSubmitted() && $form->isValid()) {
104
-      $mediaManager = $this->mediaManager;
105
-      $uploadedFile = $form->getData()['media'];
106
-      $mediaId = $request->request->get('mediaId');
104
+        $mediaManager = $this->mediaManager;
105
+        $uploadedFile = $form->getData()['media'];
106
+        $mediaId = $request->request->get('mediaId');
107 107
 
108
-      if ($uploadedFile->isValid()) {
108
+        if ($uploadedFile->isValid()) {
109 109
         $fileProvider = $this->fileProvider;
110 110
         $file = $fileProvider->getFile(ArticleMedia::handleMediaId($mediaId), $uploadedFile->guessExtension());
111 111
 
112 112
         if (null === $file) {
113
-          $file = $mediaManager->handleUploadedFile($uploadedFile, $mediaId);
114
-          $this->entityManager->flush();
113
+            $file = $mediaManager->handleUploadedFile($uploadedFile, $mediaId);
114
+            $this->entityManager->flush();
115 115
         }
116 116
 
117 117
         return new SingleResourceResponse(
@@ -124,23 +124,23 @@  discard block
 block discarded – undo
124 124
             ],
125 125
             new ResponseContext(201)
126 126
         );
127
-      }
127
+        }
128 128
 
129
-      throw new \Exception('Uploaded file is not valid:' . $uploadedFile->getErrorMessage());
129
+        throw new \Exception('Uploaded file is not valid:' . $uploadedFile->getErrorMessage());
130 130
     }
131 131
 
132 132
     return new SingleResourceResponse($form);
133
-  }
133
+    }
134 134
 
135
-  /**
136
-   * @Route("/api/{version}/assets/{action}/{mediaId}.{extension}", methods={"GET"}, options={"expose"=true}, defaults={"version"="v2"}, requirements={"mediaId"=".+", "action"="get|push"}, name="swp_api_assets_get")
137
-   */
138
-  public function getAssetsAction(string $mediaId, string $extension): SingleResourceResponseInterface {
135
+    /**
136
+     * @Route("/api/{version}/assets/{action}/{mediaId}.{extension}", methods={"GET"}, options={"expose"=true}, defaults={"version"="v2"}, requirements={"mediaId"=".+", "action"="get|push"}, name="swp_api_assets_get")
137
+     */
138
+    public function getAssetsAction(string $mediaId, string $extension): SingleResourceResponseInterface {
139 139
     $fileProvider = $this->fileProvider;
140 140
     $file = $fileProvider->getFile(ArticleMedia::handleMediaId($mediaId), $extension);
141 141
 
142 142
     if (null === $file) {
143
-      throw new NotFoundHttpException('Media don\'t exist in storage');
143
+        throw new NotFoundHttpException('Media don\'t exist in storage');
144 144
     }
145 145
 
146 146
     $mediaManager = $this->mediaManager;
@@ -152,9 +152,9 @@  discard block
 block discarded – undo
152 152
         'mime_type' => Mime::getMimeFromExtension($file->getFileExtension()),
153 153
         'filemeta' => [],
154 154
     ]);
155
-  }
155
+    }
156 156
 
157
-  protected function getPackageRepository() {
157
+    protected function getPackageRepository() {
158 158
     return $this->packageRepository;
159
-  }
159
+    }
160 160
 }
Please login to merge, or discard this patch.