Completed
Pull Request — develop (#1272)
by
unknown
45s
created
src/SWP/Component/TemplatesSystem/Gimme/Context/Context.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -131,14 +131,14 @@  discard block
 block discarded – undo
131 131
                 $finder->in($configsPath)->files()->name('*.{yaml,yml}');
132 132
                 $files = [];
133 133
                 foreach ($finder as $file) {
134
-                  $files[] = $file->getRealPath();
134
+                    $files[] = $file->getRealPath();
135 135
                 }
136 136
                 return $files;
137 137
             });
138 138
 
139
-          foreach ($files as $file) {
139
+            foreach ($files as $file) {
140 140
             $this->addNewConfig($file);
141
-          }
141
+            }
142 142
         }
143 143
     }
144 144
 
@@ -190,11 +190,11 @@  discard block
 block discarded – undo
190 190
     {
191 191
         $cacheKey = md5($filePath);
192 192
         $configuration  = $this->metadataCache->get($cacheKey, function () use ($filePath) {
193
-              if (!is_readable($filePath)) {
194
-                  throw new \InvalidArgumentException('Configuration file is not readable for parser');
195
-              }
196
-              $parser = new Parser();
197
-              return $parser->parse(file_get_contents($filePath));
193
+                if (!is_readable($filePath)) {
194
+                    throw new \InvalidArgumentException('Configuration file is not readable for parser');
195
+                }
196
+                $parser = new Parser();
197
+                return $parser->parse(file_get_contents($filePath));
198 198
         });
199 199
         $this->addAvailableConfig($configuration);
200 200
         $this->supportedCache = [];
@@ -222,15 +222,15 @@  discard block
 block discarded – undo
222 222
     {
223 223
         $configuration = $meta->getConfiguration();
224 224
         if(array_key_exists("name" ,$configuration)) {
225
-          $name = $configuration['name'];
226
-          if (!array_key_exists($name, $this->registeredMeta)) {
225
+            $name = $configuration['name'];
226
+            if (!array_key_exists($name, $this->registeredMeta)) {
227 227
             $this->registeredMeta[$name] = $configuration;
228 228
             if (null !== $meta) {
229
-              $this[$name] = $meta;
229
+                $this[$name] = $meta;
230 230
             }
231 231
 
232 232
             return true;
233
-          }
233
+            }
234 234
         }
235 235
 
236 236
         return false;
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
     public function loadConfigsFromPath($configsPath)
127 127
     {
128 128
         if (file_exists($configsPath)) {
129
-            $files = $this->metadataCache->get('metadata_config_files', function () use ($configsPath) {
129
+            $files = $this->metadataCache->get('metadata_config_files', function() use ($configsPath) {
130 130
                 $finder = new Finder();
131 131
                 $finder->in($configsPath)->files()->name('*.{yaml,yml}');
132 132
                 $files = [];
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
     public function addNewConfig(string $filePath)
190 190
     {
191 191
         $cacheKey = md5($filePath);
192
-        $configuration  = $this->metadataCache->get($cacheKey, function () use ($filePath) {
192
+        $configuration = $this->metadataCache->get($cacheKey, function() use ($filePath) {
193 193
               if (!is_readable($filePath)) {
194 194
                   throw new \InvalidArgumentException('Configuration file is not readable for parser');
195 195
               }
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
     public function registerMeta(Meta $meta = null)
222 222
     {
223 223
         $configuration = $meta->getConfiguration();
224
-        if(array_key_exists("name" ,$configuration)) {
224
+        if (array_key_exists("name", $configuration)) {
225 225
           $name = $configuration['name'];
226 226
           if (!array_key_exists($name, $this->registeredMeta)) {
227 227
             $this->registeredMeta[$name] = $configuration;
Please login to merge, or discard this patch.
src/SWP/Bundle/CoreBundle/Controller/OrganizationRuleController.php 1 patch
Indentation   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -41,29 +41,29 @@  discard block
 block discarded – undo
41 41
 use FOS\RestBundle\Controller\Annotations\Route;
42 42
 
43 43
 class OrganizationRuleController extends AbstractController {
44
-  private FormFactoryInterface $formFactory;
45
-  private EventDispatcherInterface $eventDispatcher;
46
-  private CachedTenantContextInterface $cachedTenantContext;
47
-  private EntityManagerInterface $entityManager;
48
-  private RuleRepositoryInterface $ruleRepository;
49
-  private RulesMatcherInterface $rulesMatcher;
50
-  private FactoryInterface $ruleFactory;
51
-  private DataTransformerInterface $dataTransformer;
52
-
53
-  /**
54
-   * @param FormFactoryInterface $formFactory
55
-   * @param EventDispatcherInterface $eventDispatcher
56
-   * @param CachedTenantContextInterface $cachedTenantContext
57
-   * @param EntityManagerInterface $entityManager
58
-   * @param RuleRepositoryInterface $ruleRepository
59
-   * @param RulesMatcherInterface $rulesMatcher
60
-   * @param FactoryInterface $ruleFactory
61
-   * @param DataTransformerInterface $dataTransformer
62
-   */
63
-  public function __construct(FormFactoryInterface         $formFactory, EventDispatcherInterface $eventDispatcher,
64
-                              CachedTenantContextInterface $cachedTenantContext, EntityManagerInterface $entityManager,
65
-                              RuleRepositoryInterface      $ruleRepository, RulesMatcherInterface $rulesMatcher,
66
-                              FactoryInterface             $ruleFactory, DataTransformerInterface $dataTransformer) {
44
+    private FormFactoryInterface $formFactory;
45
+    private EventDispatcherInterface $eventDispatcher;
46
+    private CachedTenantContextInterface $cachedTenantContext;
47
+    private EntityManagerInterface $entityManager;
48
+    private RuleRepositoryInterface $ruleRepository;
49
+    private RulesMatcherInterface $rulesMatcher;
50
+    private FactoryInterface $ruleFactory;
51
+    private DataTransformerInterface $dataTransformer;
52
+
53
+    /**
54
+     * @param FormFactoryInterface $formFactory
55
+     * @param EventDispatcherInterface $eventDispatcher
56
+     * @param CachedTenantContextInterface $cachedTenantContext
57
+     * @param EntityManagerInterface $entityManager
58
+     * @param RuleRepositoryInterface $ruleRepository
59
+     * @param RulesMatcherInterface $rulesMatcher
60
+     * @param FactoryInterface $ruleFactory
61
+     * @param DataTransformerInterface $dataTransformer
62
+     */
63
+    public function __construct(FormFactoryInterface         $formFactory, EventDispatcherInterface $eventDispatcher,
64
+                                CachedTenantContextInterface $cachedTenantContext, EntityManagerInterface $entityManager,
65
+                                RuleRepositoryInterface      $ruleRepository, RulesMatcherInterface $rulesMatcher,
66
+                                FactoryInterface             $ruleFactory, DataTransformerInterface $dataTransformer) {
67 67
     $this->formFactory = $formFactory;
68 68
     $this->eventDispatcher = $eventDispatcher;
69 69
     $this->cachedTenantContext = $cachedTenantContext;
@@ -72,13 +72,13 @@  discard block
 block discarded – undo
72 72
     $this->rulesMatcher = $rulesMatcher;
73 73
     $this->ruleFactory = $ruleFactory;
74 74
     $this->dataTransformer = $dataTransformer;
75
-  }
75
+    }
76 76
 
77 77
 
78
-  /**
79
-   * @Route("/api/{version}/organization/rules/evaluate", options={"expose"=true}, defaults={"version"="v2"}, methods={"POST"}, name="swp_api_core_organization_rules_evaluate")
80
-   */
81
-  public function rulesEvaluationAction(Request $request): SingleResourceResponseInterface {
78
+    /**
79
+     * @Route("/api/{version}/organization/rules/evaluate", options={"expose"=true}, defaults={"version"="v2"}, methods={"POST"}, name="swp_api_core_organization_rules_evaluate")
80
+     */
81
+    public function rulesEvaluationAction(Request $request): SingleResourceResponseInterface {
82 82
     $content = $request->getContent();
83 83
     $dispatcher = $this->eventDispatcher;
84 84
     $package = $this->dataTransformer->transform($content);
@@ -89,12 +89,12 @@  discard block
 block discarded – undo
89 89
     $context = new ResponseContext();
90 90
     $context->setSerializationGroups(['Default', 'api']);
91 91
     return new SingleResourceResponse($rules, $context);
92
-  }
92
+    }
93 93
 
94
-  /**
95
-   * @Route("/api/{version}/organization/rules/", options={"expose"=true}, defaults={"version"="v2"}, methods={"GET"}, name="swp_api_core_list_organization_rules")
96
-   */
97
-  public function rulesAction(Request $request): ResourcesListResponseInterface {
94
+    /**
95
+     * @Route("/api/{version}/organization/rules/", options={"expose"=true}, defaults={"version"="v2"}, methods={"GET"}, name="swp_api_core_list_organization_rules")
96
+     */
97
+    public function rulesAction(Request $request): ResourcesListResponseInterface {
98 98
     $tenantContext = $this->cachedTenantContext;
99 99
 
100 100
     $this->getEventDispatcher()->dispatch(new GenericEvent(), MultiTenancyEvents::TENANTABLE_DISABLE);
@@ -111,12 +111,12 @@  discard block
 block discarded – undo
111 111
     );
112 112
 
113 113
     return new ResourcesListResponse($rules);
114
-  }
114
+    }
115 115
 
116
-  /**
117
-   * @Route("/api/{version}/organization/rules/", options={"expose"=true}, defaults={"version"="v2"}, methods={"POST"}, name="swp_api_core_create_organization_rule")
118
-   */
119
-  public function createAction(Request $request): SingleResourceResponseInterface {
116
+    /**
117
+     * @Route("/api/{version}/organization/rules/", options={"expose"=true}, defaults={"version"="v2"}, methods={"POST"}, name="swp_api_core_create_organization_rule")
118
+     */
119
+    public function createAction(Request $request): SingleResourceResponseInterface {
120 120
     $ruleRepository = $this->getRuleRepository();
121 121
 
122 122
     $rule = $this->ruleFactory->create();
@@ -124,54 +124,54 @@  discard block
 block discarded – undo
124 124
     $form->handleRequest($request);
125 125
 
126 126
     if ($form->isSubmitted() && $form->isValid()) {
127
-      $ruleRepository->add($rule);
128
-      $rule->setTenantCode(null);
129
-      $ruleRepository->flush();
127
+        $ruleRepository->add($rule);
128
+        $rule->setTenantCode(null);
129
+        $ruleRepository->flush();
130 130
 
131
-      return new SingleResourceResponse($rule, new ResponseContext(201));
131
+        return new SingleResourceResponse($rule, new ResponseContext(201));
132 132
     }
133 133
 
134 134
     return new SingleResourceResponse($form, new ResponseContext(400));
135
-  }
135
+    }
136 136
 
137
-  /**
138
-   * @Route("/api/{version}/organization/rules/{id}", options={"expose"=true}, defaults={"version"="v2"}, methods={"GET"}, name="swp_api_core_show_organization_rule", requirements={"id"="\d+"})
139
-   */
140
-  public function getAction(int $id): SingleResourceResponseInterface {
137
+    /**
138
+     * @Route("/api/{version}/organization/rules/{id}", options={"expose"=true}, defaults={"version"="v2"}, methods={"GET"}, name="swp_api_core_show_organization_rule", requirements={"id"="\d+"})
139
+     */
140
+    public function getAction(int $id): SingleResourceResponseInterface {
141 141
     return new SingleResourceResponse($this->findOr404($id));
142
-  }
142
+    }
143 143
 
144
-  /**
145
-   * @Route("/api/{version}/organization/rules/{id}", options={"expose"=true}, defaults={"version"="v2"}, methods={"PATCH"}, name="swp_api_core_update_organization_rule", requirements={"id"="\d+"})
146
-   */
147
-  public function updateRuleAction(Request $request, int $id) {
144
+    /**
145
+     * @Route("/api/{version}/organization/rules/{id}", options={"expose"=true}, defaults={"version"="v2"}, methods={"PATCH"}, name="swp_api_core_update_organization_rule", requirements={"id"="\d+"})
146
+     */
147
+    public function updateRuleAction(Request $request, int $id) {
148 148
     $objectManager = $this->entityManager;
149 149
     $rule = $this->findOr404($id);
150 150
     $form = $this->formFactory->createNamed('', RuleType::class, $rule, ['method' => $request->getMethod()]);
151 151
 
152 152
     $form->handleRequest($request);
153 153
     if ($form->isSubmitted() && $form->isValid()) {
154
-      $objectManager->flush();
155
-      $objectManager->refresh($rule);
154
+        $objectManager->flush();
155
+        $objectManager->refresh($rule);
156 156
 
157
-      return new SingleResourceResponse($rule);
157
+        return new SingleResourceResponse($rule);
158 158
     }
159 159
 
160 160
     return new SingleResourceResponse($form, new ResponseContext(500));
161
-  }
161
+    }
162 162
 
163
-  /**
164
-   * @Route("/api/{version}/organization/rules/{id}", options={"expose"=true}, defaults={"version"="v2"}, methods={"DELETE"}, name="swp_api_core_delete_organization_rule", requirements={"id"="\d+"})
165
-   */
166
-  public function deleteAction(int $id) {
163
+    /**
164
+     * @Route("/api/{version}/organization/rules/{id}", options={"expose"=true}, defaults={"version"="v2"}, methods={"DELETE"}, name="swp_api_core_delete_organization_rule", requirements={"id"="\d+"})
165
+     */
166
+    public function deleteAction(int $id) {
167 167
     $rule = $this->findOr404($id);
168 168
     $ruleRepository = $this->ruleRepository;
169 169
     $ruleRepository->remove($rule);
170 170
 
171 171
     return new SingleResourceResponse(null, new ResponseContext(204));
172
-  }
172
+    }
173 173
 
174
-  private function findOr404(int $id) {
174
+    private function findOr404(int $id) {
175 175
     $tenantContext = $this->cachedTenantContext;
176 176
     $this->getEventDispatcher()->dispatch(new GenericEvent(), MultiTenancyEvents::TENANTABLE_DISABLE);
177 177
 
@@ -180,17 +180,17 @@  discard block
 block discarded – undo
180 180
             'organization' => $tenantContext->getTenant()->getOrganization(),
181 181
             'tenantCode' => null,
182 182
         ]))) {
183
-      throw new NotFoundHttpException('Organization rule was not found.');
183
+        throw new NotFoundHttpException('Organization rule was not found.');
184 184
     }
185 185
 
186 186
     return $rule;
187
-  }
187
+    }
188 188
 
189
-  private function getRuleRepository() {
189
+    private function getRuleRepository() {
190 190
     return $this->ruleRepository;
191
-  }
191
+    }
192 192
 
193
-  private function getEventDispatcher() {
193
+    private function getEventDispatcher() {
194 194
     return $this->eventDispatcher;
195
-  }
195
+    }
196 196
 }
Please login to merge, or discard this patch.
src/SWP/Bundle/ContentBundle/Model/Article.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
     {
334 334
         return $this->getExtraCollection()
335 335
             ->map(
336
-                function (ArticleExtraFieldInterface $field) {
336
+                function(ArticleExtraFieldInterface $field) {
337 337
                     return $field->toApiFormat();
338 338
                 }
339 339
             )->toArray();
@@ -536,8 +536,8 @@  discard block
 block discarded – undo
536 536
             if (is_array($value)) {
537 537
                 $this->addEmbedExtra(ArticleExtraEmbedField::newFromValue($key, $value));
538 538
             } else {
539
-                if(is_int($value)) {
540
-                    $value = (string)$value;
539
+                if (is_int($value)) {
540
+                    $value = (string) $value;
541 541
                 }
542 542
                 $this->addTextExtra(ArticleExtraTextField::newFromValue($key, $value));
543 543
             }
Please login to merge, or discard this patch.
src/SWP/Bundle/MenuBundle/Model/MenuItem.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -691,7 +691,7 @@
 block discarded – undo
691 691
      */
692 692
     public function isCurrent(): bool
693 693
     {
694
-        return ($this->isCurrent?true:false);
694
+        return ($this->isCurrent ?true:false);
695 695
     }
696 696
 
697 697
     /**
Please login to merge, or discard this patch.
src/SWP/Bundle/CoreBundle/Migrations/Version20170207132939.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
     {
18 18
         // this up() migration is auto-generated, please modify it to your needs
19 19
         $this->abortIf('postgresql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'postgresql\'.');
20
-	$this->addSql('ALTER TABLE swp_article ADD COLUMN IF NOT EXISTS feature_media INT DEFAULT NULL');
20
+    $this->addSql('ALTER TABLE swp_article ADD COLUMN IF NOT EXISTS feature_media INT DEFAULT NULL');
21 21
         $this->addSql('ALTER TABLE swp_article ADD CONSTRAINT FK_FB21E858A372AB05 FOREIGN KEY (feature_media) REFERENCES swp_article_media (id) ON DELETE SET NULL NOT DEFERRABLE INITIALLY IMMEDIATE');
22 22
         $this->addSql('CREATE INDEX IDX_FB21E858A372AB05 ON swp_article (feature_media)');
23 23
     }
Please login to merge, or discard this patch.
src/SWP/Bundle/MultiTenancyBundle/Command/GetPublicSuffixListCommand.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -31,18 +31,18 @@
 block discarded – undo
31 31
 
32 32
     public function execute(InputInterface $input, OutputInterface $output)
33 33
     {
34
-        $output->writeln('<info>Fetching data from </info> ' . $this->suffixListEndpoint);
34
+        $output->writeln('<info>Fetching data from </info> '.$this->suffixListEndpoint);
35 35
         $filesystem = new Filesystem();
36
-        $dir = $this->container->getParameter('kernel.project_dir') . '/src/SWP/Component/MultiTenancy/';
37
-        if ($filesystem->exists($dir . $this->suffixListFilename)) {
38
-            $filesystem->remove($dir . $this->suffixListFilename);
36
+        $dir = $this->container->getParameter('kernel.project_dir').'/src/SWP/Component/MultiTenancy/';
37
+        if ($filesystem->exists($dir.$this->suffixListFilename)) {
38
+            $filesystem->remove($dir.$this->suffixListFilename);
39 39
         }
40 40
         $filesystem->mkdir($dir);
41
-        $filesystem->touch($dir . $this->suffixListFilename);
41
+        $filesystem->touch($dir.$this->suffixListFilename);
42 42
         $data = file_get_contents($this->suffixListEndpoint);
43
-        $filesystem->dumpFile($dir . $this->suffixListFilename, $data);
43
+        $filesystem->dumpFile($dir.$this->suffixListFilename, $data);
44 44
 
45
-        $output->writeln('<info>Data saved into:</info> ' . $dir . $this->suffixListFilename);
45
+        $output->writeln('<info>Data saved into:</info> '.$dir.$this->suffixListFilename);
46 46
         return 0;
47 47
     }
48 48
 }
49 49
\ No newline at end of file
Please login to merge, or discard this patch.
src/SWP/Bundle/ContentBundle/Asset/GoogleAssetUrlGenerator.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
      */
26 26
     public function generateUrl(FileInterface $file, string $basePath): string
27 27
     {
28
-        $key = $basePath . '/' . $file->getAssetId() . '.' . $file->getFileExtension();
29
-        return 'https://storage.googleapis.com/' . $this->bucket->name() . '/' . $key;
28
+        $key = $basePath.'/'.$file->getAssetId().'.'.$file->getFileExtension();
29
+        return 'https://storage.googleapis.com/'.$this->bucket->name().'/'.$key;
30 30
     }
31 31
 }
32 32
\ No newline at end of file
Please login to merge, or discard this patch.
src/SWP/Bundle/ContentBundle/Factory/GCSClientFactory.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
      */
16 16
     public static function createGCSClient(ContainerInterface $container, string $keyFilePath): StorageClient
17 17
     {
18
-        $path = $container->getParameter('kernel.project_dir') . '/config/gcs/' . $keyFilePath;
18
+        $path = $container->getParameter('kernel.project_dir').'/config/gcs/'.$keyFilePath;
19 19
         return new StorageClient([
20 20
             'keyFilePath' => $path,
21 21
         ]);
Please login to merge, or discard this patch.
src/SWP/Component/MultiTenancy/Resolver/TenantResolver.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
             return $domainString;
87 87
         }
88 88
 
89
-        return $domainString . '.' . $result->suffix()->toString();
89
+        return $domainString.'.'.$result->suffix()->toString();
90 90
     }
91 91
 
92 92
     protected function extractSubdomain(string $host = null): string
@@ -119,15 +119,15 @@  discard block
 block discarded – undo
119 119
      */
120 120
     private function getPublicSuffixList(): string
121 121
     {
122
-        return $this->cacheProvider->get('suffix_list', function (ItemInterface $item) {
123
-            $dir = __DIR__ . '/../';
122
+        return $this->cacheProvider->get('suffix_list', function(ItemInterface $item) {
123
+            $dir = __DIR__.'/../';
124 124
             $filesystem = new Filesystem();
125
-            if (!$filesystem->exists($dir . $this->suffixListFilename)) {
125
+            if (!$filesystem->exists($dir.$this->suffixListFilename)) {
126 126
                 throw new \LogicException(
127 127
                     'Public suffix list file not found. Run swp:public-suffix-list:get command'
128 128
                 );
129 129
             }
130
-            return file_get_contents($dir . $this->suffixListFilename);
130
+            return file_get_contents($dir.$this->suffixListFilename);
131 131
         });
132 132
     }
133 133
 }
Please login to merge, or discard this patch.