Completed
Push — master ( b71be9...f56dee )
by Craig
12:15 queued 07:32
created
src/system/ExtensionsModule/Helper/BundleSyncHelper.php 1 patch
Braces   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -36,8 +36,8 @@  discard block
 block discarded – undo
36 36
 /**
37 37
  * Helper functions for the extensions bundle
38 38
  */
39
-class BundleSyncHelper
40
-{
39
+class BundleSyncHelper
40
+{
41 41
     /**
42 42
      * @var ZikulaHttpKernelInterface
43 43
      */
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
         BundlesSchemaHelper $bundlesSchemaHelper,
100 100
         ComposerValidationHelper $composerValidationHelper,
101 101
         SessionInterface $session
102
-    ) {
102
+    ) {
103 103
         $this->kernel = $kernel;
104 104
         $this->extensionRepository = $extensionRepository;
105 105
         $this->extensionVarRepository = $extensionVarRepository;
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
         // sync the extensions directory and the bundles table
121 121
         $this->bundlesSchemaHelper->load();
122 122
         $scanner = $this->bundlesSchemaHelper->getScanner();
123
-        foreach ($scanner->getInvalid() as $invalidName) {
123
+        foreach ($scanner->getInvalid() as $invalidName) {
124 124
             $this->session->getFlashBag()->add(
125 125
                 'warning',
126 126
                 $this->translator->trans(
@@ -134,8 +134,8 @@  discard block
 block discarded – undo
134 134
         $bundles = [];
135 135
         $srcDir = $this->kernel->getProjectDir() . '/src/';
136 136
         /** @var MetaData $bundleMetaData */
137
-        foreach ($extensions as $name => $bundleMetaData) {
138
-            foreach ($bundleMetaData->getPsr4() as $ns => $path) {
137
+        foreach ($extensions as $name => $bundleMetaData) {
138
+            foreach ($bundleMetaData->getPsr4() as $ns => $path) {
139 139
                 $this->kernel->getAutoloader()->addPsr4($ns, $srcDir . $path);
140 140
             }
141 141
 
@@ -148,13 +148,13 @@  discard block
 block discarded – undo
148 148
 
149 149
             $finder = new Finder();
150 150
             $finder->files()->in($bundle->getPath())->depth(0)->name('composer.json');
151
-            foreach ($finder as $splFileInfo) {
151
+            foreach ($finder as $splFileInfo) {
152 152
                 // there will only be one loop here
153 153
                 $this->composerValidationHelper->check($splFileInfo);
154
-                if ($this->composerValidationHelper->isValid()) {
154
+                if ($this->composerValidationHelper->isValid()) {
155 155
                     $bundles[$bundle->getName()] = $bundleVersionArray;
156 156
                     $bundles[$bundle->getName()]['oldnames'] = $bundleVersionArray['oldnames'] ?? '';
157
-                } else {
157
+                } else {
158 158
                     $this->session->getFlashBag()->add(
159 159
                         'error',
160 160
                         $this->translator->trans(
@@ -162,14 +162,14 @@  discard block
 block discarded – undo
162 162
                             ['%extension%' => $bundle->getName()]
163 163
                         )
164 164
                     );
165
-                    foreach ($this->composerValidationHelper->getErrors() as $error) {
165
+                    foreach ($this->composerValidationHelper->getErrors() as $error) {
166 166
                         $this->session->getFlashBag()->add('error', $error);
167 167
                     }
168 168
                 }
169 169
             }
170 170
         }
171 171
 
172
-        if ($includeCore) {
172
+        if ($includeCore) {
173 173
             $this->appendCoreExtensionsMetaData($bundles);
174 174
         }
175 175
         $this->validate($bundles);
@@ -179,9 +179,9 @@  discard block
 block discarded – undo
179 179
 
180 180
     private function appendCoreExtensionsMetaData(array &$extensions): void
181 181
     {
182
-        foreach (ZikulaKernel::$coreExtension as $systemModule => $bundleClass) {
182
+        foreach (ZikulaKernel::$coreExtension as $systemModule => $bundleClass) {
183 183
             $bundle = $this->kernel->getBundle($systemModule);
184
-            if ($bundle instanceof AbstractExtension) {
184
+            if ($bundle instanceof AbstractExtension) {
185 185
                 $extensions[$systemModule] = $bundle->getMetaData()->getFilteredVersionInfoArray();
186 186
             }
187 187
         }
@@ -202,10 +202,10 @@  discard block
 block discarded – undo
202 202
         ];
203 203
 
204 204
         // check for duplicate name, display name or url
205
-        foreach ($extensions as $dir => $modInfo) {
206
-            foreach ($fieldNames as $fieldName) {
205
+        foreach ($extensions as $dir => $modInfo) {
206
+            foreach ($fieldNames as $fieldName) {
207 207
                 $key = mb_strtolower($modInfo[$fieldName]);
208
-                if (!empty($moduleValues[$fieldName][$key]) && !empty($modInfo[$fieldName])) {
208
+                if (!empty($moduleValues[$fieldName][$key]) && !empty($modInfo[$fieldName])) {
209 209
                     $message = $this->translator->trans('Fatal error: Two extensions share the same %field%. [%ext1%] and [%ext2%]', [
210 210
                         '%field%' => $fieldName,
211 211
                         '%ext1%' => $modInfo['name'],
@@ -256,9 +256,9 @@  discard block
 block discarded – undo
256 256
         array &$extensionsFromDB,
257 257
         bool $forceDefaults = false
258 258
     ): void {
259
-        foreach ($extensionsFromFile as $name => $extensionFromFile) {
260
-            foreach ($extensionsFromDB as $dbname => $extensionFromDB) {
261
-                if (isset($extensionFromDB['name']) && in_array($extensionFromDB['name'], (array)$extensionFromFile['oldnames'], true)) {
259
+        foreach ($extensionsFromFile as $name => $extensionFromFile) {
260
+            foreach ($extensionsFromDB as $dbname => $extensionFromDB) {
261
+                if (isset($extensionFromDB['name']) && in_array($extensionFromDB['name'], (array)$extensionFromFile['oldnames'], true)) {
262 262
                     // migrate its modvars
263 263
                     $this->extensionVarRepository->updateName($dbname, $name);
264 264
                     // rename the extension register
@@ -270,18 +270,18 @@  discard block
 block discarded – undo
270 270
             }
271 271
 
272 272
             // If extension was previously determined to be incompatible with the core. return to original state
273
-            if (isset($extensionsFromDB[$name]) && $extensionsFromDB[$name]['state'] > 10) {
273
+            if (isset($extensionsFromDB[$name]) && $extensionsFromDB[$name]['state'] > 10) {
274 274
                 $extensionsFromDB[$name]['state'] -= Constant::INCOMPATIBLE_CORE_SHIFT;
275 275
                 $this->extensionStateHelper->updateState($extensionsFromDB[$name]['id'], $extensionsFromDB[$name]['state']);
276 276
             }
277 277
 
278 278
             // update the DB information for this extension to reflect user settings (e.g. url)
279
-            if (isset($extensionsFromDB[$name]['id'])) {
279
+            if (isset($extensionsFromDB[$name]['id'])) {
280 280
                 $extensionFromFile['id'] = $extensionsFromDB[$name]['id'];
281
-                if (Constant::STATE_UNINITIALISED !== $extensionsFromDB[$name]['state'] && Constant::STATE_INVALID !== $extensionsFromDB[$name]['state']) {
281
+                if (Constant::STATE_UNINITIALISED !== $extensionsFromDB[$name]['state'] && Constant::STATE_INVALID !== $extensionsFromDB[$name]['state']) {
282 282
                     unset($extensionFromFile['version']);
283 283
                 }
284
-                if (!$forceDefaults) {
284
+                if (!$forceDefaults) {
285 285
                     unset($extensionFromFile['displayname'], $extensionFromFile['description'], $extensionFromFile['url']);
286 286
                 }
287 287
 
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
                 /** @var ExtensionEntity $extension */
291 291
                 $extension = $this->extensionRepository->find($extensionFromFile['id']);
292 292
                 $extension->merge($extensionFromFile);
293
-                if (empty($extension->getIcon())) {
293
+                if (empty($extension->getIcon())) {
294 294
                     $extension->setIcon($extensionFromFile['capabilities']['admin']['icon']);
295 295
                 }
296 296
                 $this->extensionRepository->persistAndFlush($extension);
@@ -298,13 +298,13 @@  discard block
 block discarded – undo
298 298
 
299 299
             // check extension core requirement is compatible with current core
300 300
             $coreCompatibility = $extensionFromFile['coreCompatibility'];
301
-            if (isset($extensionsFromDB[$name])) {
302
-                if (!Semver::satisfies(ZikulaKernel::VERSION, $coreCompatibility)) {
301
+            if (isset($extensionsFromDB[$name])) {
302
+                if (!Semver::satisfies(ZikulaKernel::VERSION, $coreCompatibility)) {
303 303
                     // extension is incompatible with current core
304 304
                     $extensionsFromDB[$name]['state'] += Constant::INCOMPATIBLE_CORE_SHIFT;
305 305
                     $this->extensionStateHelper->updateState($extensionsFromDB[$name]['id'], $extensionsFromDB[$name]['state']);
306 306
                 }
307
-                if (isset($extensionsFromDB[$name]['state'])) {
307
+                if (isset($extensionsFromDB[$name]['state'])) {
308 308
                     $extensionFromFile['state'] = $extensionsFromDB[$name]['state'];
309 309
                 }
310 310
             }
@@ -316,26 +316,26 @@  discard block
 block discarded – undo
316 316
      */
317 317
     private function syncLostExtensions(array $extensionsFromFile, array &$extensionsFromDB): void
318 318
     {
319
-        foreach ($extensionsFromDB as $extensionName => $unusedVariable) {
320
-            if ($this->kernel::isCoreExtension($extensionName) || array_key_exists($extensionName, $extensionsFromFile)) {
319
+        foreach ($extensionsFromDB as $extensionName => $unusedVariable) {
320
+            if ($this->kernel::isCoreExtension($extensionName) || array_key_exists($extensionName, $extensionsFromFile)) {
321 321
                 continue;
322 322
             }
323 323
 
324 324
             $lostExtension = $this->extensionRepository->get($extensionName); // must obtain Entity because value from $extensionsFromDB is only an array
325
-            if (!$lostExtension) {
325
+            if (!$lostExtension) {
326 326
                 throw new RuntimeException($this->translator->trans('Error! Could not load data for %extension%.', ['%extension%' => $extensionName]));
327 327
             }
328 328
             $lostExtensionState = $lostExtension->getState();
329 329
             if ((Constant::STATE_INVALID === $lostExtensionState)
330
-                || ($lostExtensionState === Constant::STATE_INVALID + Constant::INCOMPATIBLE_CORE_SHIFT)) {
330
+                || ($lostExtensionState === Constant::STATE_INVALID + Constant::INCOMPATIBLE_CORE_SHIFT)) {
331 331
                 // extension was invalid and subsequently removed from file system,
332 332
                 // or extension was incompatible with core and subsequently removed, delete it
333 333
                 $this->extensionRepository->removeAndFlush($lostExtension);
334 334
             } elseif ((Constant::STATE_UNINITIALISED === $lostExtensionState)
335
-                || ($lostExtensionState === Constant::STATE_UNINITIALISED + Constant::INCOMPATIBLE_CORE_SHIFT)) {
335
+                || ($lostExtensionState === Constant::STATE_UNINITIALISED + Constant::INCOMPATIBLE_CORE_SHIFT)) {
336 336
                 // extension was uninitialised and subsequently removed from file system, delete it
337 337
                 $this->extensionRepository->removeAndFlush($lostExtension);
338
-            } else {
338
+            } else {
339 339
                 // Set state of extension to 'missing'
340 340
                 // This state cannot be reached in with an ACTIVE bundle. - ACTIVE bundles are part of the pre-compiled Kernel.
341 341
                 // extensions that are inactive can be marked as missing.
@@ -357,13 +357,13 @@  discard block
 block discarded – undo
357 357
     {
358 358
         $upgradedExtensions = [];
359 359
 
360
-        foreach ($extensionsFromFile as $name => $extensionFromFile) {
361
-            if (empty($extensionsFromDB[$name])) {
360
+        foreach ($extensionsFromFile as $name => $extensionFromFile) {
361
+            if (empty($extensionsFromDB[$name])) {
362 362
                 $extensionFromFile['state'] = Constant::STATE_UNINITIALISED;
363
-                if (!$extensionFromFile['version']) {
363
+                if (!$extensionFromFile['version']) {
364 364
                     // set state to invalid if we can't determine a version
365 365
                     $extensionFromFile['state'] = Constant::STATE_INVALID;
366
-                } else {
366
+                } else {
367 367
                     $coreCompatibility = $extensionFromFile['coreCompatibility'];
368 368
                     // shift state if extension is incompatible with core version
369 369
                     $extensionFromFile['state'] = Semver::satisfies(ZikulaKernel::VERSION, $coreCompatibility)
@@ -377,33 +377,33 @@  discard block
 block discarded – undo
377 377
                 // insert new extension to db
378 378
                 $newExtension = new ExtensionEntity();
379 379
                 $newExtension->merge($extensionFromFile);
380
-                if (empty($newExtension->getIcon())) {
380
+                if (empty($newExtension->getIcon())) {
381 381
                     $newExtension->setIcon($extensionFromFile['capabilities']['admin']['icon']);
382 382
                 }
383 383
                 $vetoEvent = new GenericEvent($newExtension);
384 384
                 $this->dispatcher->dispatch($vetoEvent, ExtensionEvents::INSERT_VETO);
385
-                if (!$vetoEvent->isPropagationStopped()) {
385
+                if (!$vetoEvent->isPropagationStopped()) {
386 386
                     $this->extensionRepository->persistAndFlush($newExtension);
387 387
                 }
388
-            } else {
388
+            } else {
389 389
                 // extension is in the db already
390 390
                 if ((Constant::STATE_MISSING === $extensionsFromDB[$name]['state'])
391
-                    || ($extensionsFromDB[$name]['state'] === Constant::STATE_MISSING + Constant::INCOMPATIBLE_CORE_SHIFT)) {
391
+                    || ($extensionsFromDB[$name]['state'] === Constant::STATE_MISSING + Constant::INCOMPATIBLE_CORE_SHIFT)) {
392 392
                     // extension was lost, now it is here again
393 393
                     $this->extensionStateHelper->updateState($extensionsFromDB[$name]['id'], Constant::STATE_INACTIVE);
394 394
                 } elseif (((Constant::STATE_INVALID === $extensionsFromDB[$name]['state'])
395 395
                         || ($extensionsFromDB[$name]['state'] === Constant::STATE_INVALID + Constant::INCOMPATIBLE_CORE_SHIFT))
396
-                    && $extensionFromFile['version']) {
396
+                    && $extensionFromFile['version']) {
397 397
                     $coreCompatibility = $extensionFromFile['coreCompatibility'];
398
-                    if (Semver::satisfies(ZikulaKernel::VERSION, $coreCompatibility)) {
398
+                    if (Semver::satisfies(ZikulaKernel::VERSION, $coreCompatibility)) {
399 399
                         // extension was invalid, now it is valid
400 400
                         $this->extensionStateHelper->updateState($extensionsFromDB[$name]['id'], Constant::STATE_UNINITIALISED);
401 401
                     }
402 402
                 }
403 403
 
404
-                if ($extensionsFromDB[$name]['version'] !== $extensionFromFile['version']) {
404
+                if ($extensionsFromDB[$name]['version'] !== $extensionFromFile['version']) {
405 405
                     if (Constant::STATE_UNINITIALISED !== $extensionsFromDB[$name]['state'] &&
406
-                        Constant::STATE_INVALID !== $extensionsFromDB[$name]['state']) {
406
+                        Constant::STATE_INVALID !== $extensionsFromDB[$name]['state']) {
407 407
                         $this->extensionStateHelper->updateState($extensionsFromDB[$name]['id'], Constant::STATE_UPGRADED);
408 408
                         $upgradedExtensions[$name] = $extensionFromFile['version'];
409 409
                     }
Please login to merge, or discard this patch.
src/system/ExtensionsModule/Helper/ComposerValidationHelper.php 1 patch
Braces   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -20,8 +20,8 @@  discard block
 block discarded – undo
20 20
 use Symfony\Contracts\Translation\TranslatorInterface;
21 21
 use Zikula\Bundle\CoreBundle\HttpKernel\ZikulaHttpKernelInterface;
22 22
 
23
-class ComposerValidationHelper
24
-{
23
+class ComposerValidationHelper
24
+{
25 25
     /**
26 26
      * @var ZikulaHttpKernelInterface
27 27
      */
@@ -75,8 +75,8 @@  discard block
 block discarded – undo
75 75
      */
76 76
     private $errors = [];
77 77
 
78
-    public function __construct(ZikulaHttpKernelInterface $kernel, TranslatorInterface $translator)
79
-    {
78
+    public function __construct(ZikulaHttpKernelInterface $kernel, TranslatorInterface $translator)
79
+    {
80 80
         $this->kernel = $kernel;
81 81
         $this->translator = $translator;
82 82
     }
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
         $this->filePath = $file->getRelativePath();
99 99
         $this->rawContent = $file->getContents();
100 100
 
101
-        if ($this->decodeContent()) {
101
+        if ($this->decodeContent()) {
102 102
             $this->validateAgainstSchema();
103 103
         }
104 104
     }
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
     private function decodeContent(): bool
110 110
     {
111 111
         $this->content = json_decode($this->rawContent); // returns null on failure
112
-        if (empty($this->content)) {
112
+        if (empty($this->content)) {
113 113
             $error = $this->jsonErrorCodes[json_last_error()];
114 114
             $this->errors[] = $this->translator->trans('Unable to decode composer file of %component% (%filePath%): %error%. Ensure the composer.json file has a valid syntax.', [
115 115
                 '%component%' => $this->bundleName,
@@ -138,8 +138,8 @@  discard block
 block discarded – undo
138 138
         $validator = new Validator();
139 139
         $validator->check($this->content, $schemaFile);
140 140
 
141
-        if (!$validator->isValid()) {
142
-            foreach ($validator->getErrors() as $errorDetails) {
141
+        if (!$validator->isValid()) {
142
+            foreach ($validator->getErrors() as $errorDetails) {
143 143
                 $this->errors[] = $this->translator->trans('Error found in composer file of %component% (%filePath%) in property "%property%": %error%.', [
144 144
                     '%component%' => $this->bundleName,
145 145
                     '%filePath%' => $this->filePath,
Please login to merge, or discard this patch.
src/system/ExtensionsModule/Helper/ExtensionHelper.php 1 patch
Braces   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -37,8 +37,8 @@  discard block
 block discarded – undo
37 37
 use Zikula\ExtensionsModule\ExtensionEvents;
38 38
 use Zikula\ExtensionsModule\Installer\ExtensionInstallerInterface;
39 39
 
40
-class ExtensionHelper
41
-{
40
+class ExtensionHelper
41
+{
42 42
     /**
43 43
      * @var ContainerInterface
44 44
      */
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
         ExtensionStateHelper $stateHelper,
83 83
         CacheClearer $cacheClearer,
84 84
         EventDispatcherInterface $eventDispatcher
85
-    ) {
85
+    ) {
86 86
         $this->container = $container;
87 87
         $this->translator = $translator;
88 88
         $this->variableApi = $variableApi;
@@ -97,10 +97,10 @@  discard block
 block discarded – undo
97 97
      */
98 98
     public function install(ExtensionEntity $extension): bool
99 99
     {
100
-        if (Constant::STATE_NOTALLOWED === $extension->getState()) {
100
+        if (Constant::STATE_NOTALLOWED === $extension->getState()) {
101 101
             throw new RuntimeException($this->translator->trans('Error! Not allowed to install %extension%.', ['%extension%' => $extension->getName()]));
102 102
         }
103
-        if (10 < $extension->getState()) {
103
+        if (10 < $extension->getState()) {
104 104
             throw new RuntimeException($this->translator->trans('Error! %extension% is not compatible with this version of Zikula.', ['%extension%' => $extension->getName()]));
105 105
         }
106 106
 
@@ -108,9 +108,9 @@  discard block
 block discarded – undo
108 108
         $extensionBundle = $this->container->get('kernel')->getBundle($extension->getName());
109 109
 
110 110
         $installer = $this->getExtensionInstallerInstance($extensionBundle);
111
-        if (null !== $installer) {
111
+        if (null !== $installer) {
112 112
             $result = $installer->install();
113
-            if (!$result) {
113
+            if (!$result) {
114 114
                 return false;
115 115
             }
116 116
         }
@@ -129,10 +129,10 @@  discard block
 block discarded – undo
129 129
      */
130 130
     public function upgrade(ExtensionEntity $extension): bool
131 131
     {
132
-        if (Constant::STATE_NOTALLOWED === $extension->getState()) {
132
+        if (Constant::STATE_NOTALLOWED === $extension->getState()) {
133 133
             throw new RuntimeException($this->translator->trans('Error! Not allowed to upgrade %extension%.', ['%extension%' => $extension->getDisplayname()]));
134 134
         }
135
-        if (10 < $extension->getState()) {
135
+        if (10 < $extension->getState()) {
136 136
             throw new RuntimeException($this->translator->trans('Error! %extension% is not compatible with this version of Zikula.', ['%extension%' => $extension->getDisplayname()]));
137 137
         }
138 138
 
@@ -142,10 +142,10 @@  discard block
 block discarded – undo
142 142
         // Check status of Dependencies here to be sure they are met for upgraded extension. #3647
143 143
 
144 144
         $installer = $this->getExtensionInstallerInstance($extensionBundle);
145
-        if (null !== $installer) {
145
+        if (null !== $installer) {
146 146
             $result = $installer->upgrade($extension->getVersion());
147
-            if (is_string($result)) {
148
-                if ($result !== $extension->getVersion()) {
147
+            if (is_string($result)) {
148
+                if ($result !== $extension->getVersion()) {
149 149
                     // persist the last successful updated version
150 150
                     $extension->setVersion($result);
151 151
                     $this->container->get('doctrine')->getManager()->flush();
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 
154 154
                 return false;
155 155
             }
156
-            if (true !== $result) {
156
+            if (true !== $result) {
157 157
                 return false;
158 158
             }
159 159
         }
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
         $this->stateHelper->updateState($extension->getId(), Constant::STATE_ACTIVE);
167 167
         $this->cacheClearer->clear('symfony');
168 168
 
169
-        if ($this->container->getParameter('installed')) {
169
+        if ($this->container->getParameter('installed')) {
170 170
             // Upgrade succeeded, issue event.
171 171
             $event = new ExtensionStateEvent($extensionBundle, $extension->toArray());
172 172
             $this->eventDispatcher->dispatch($event, ExtensionEvents::EXTENSION_UPGRADE);
@@ -181,17 +181,17 @@  discard block
 block discarded – undo
181 181
     public function uninstall(ExtensionEntity $extension): bool
182 182
     {
183 183
         if (Constant::STATE_NOTALLOWED === $extension->getState()
184
-            || ZikulaKernel::isCoreExtension($extension->getName())) {
184
+            || ZikulaKernel::isCoreExtension($extension->getName())) {
185 185
             throw new RuntimeException($this->translator->trans('Error! No permission to uninstall %extension%.', ['%extension%' => $extension->getDisplayname()]));
186 186
         }
187
-        if (Constant::STATE_UNINITIALISED === $extension->getState()) {
187
+        if (Constant::STATE_UNINITIALISED === $extension->getState()) {
188 188
             throw new RuntimeException($this->translator->trans('Error! %extension% is not yet installed, therefore it cannot be uninstalled.', ['%extension%' => $extension->getDisplayname()]));
189 189
         }
190 190
 
191 191
         // allow event to prevent extension removal
192 192
         $vetoEvent = new GenericEvent($extension);
193 193
         $this->eventDispatcher->dispatch($vetoEvent, ExtensionEvents::REMOVE_VETO);
194
-        if ($vetoEvent->isPropagationStopped()) {
194
+        if ($vetoEvent->isPropagationStopped()) {
195 195
             return false;
196 196
         }
197 197
 
@@ -199,9 +199,9 @@  discard block
 block discarded – undo
199 199
         $extensionBundle = $this->container->get('kernel')->getBundle($extension->getName());
200 200
 
201 201
         $installer = $this->getExtensionInstallerInstance($extensionBundle);
202
-        if (null !== $installer) {
202
+        if (null !== $installer) {
203 203
             $result = $installer->uninstall();
204
-            if (!$result) {
204
+            if (!$result) {
205 205
                 return false;
206 206
             }
207 207
         }
@@ -227,12 +227,12 @@  discard block
 block discarded – undo
227 227
      */
228 228
     public function uninstallArray(array $extensions): bool
229 229
     {
230
-        foreach ($extensions as $extension) {
231
-            if (!$extension instanceof ExtensionEntity) {
230
+        foreach ($extensions as $extension) {
231
+            if (!$extension instanceof ExtensionEntity) {
232 232
                 throw new InvalidArgumentException();
233 233
             }
234 234
             $result = $this->uninstall($extension);
235
-            if (!$result) {
235
+            if (!$result) {
236 236
                 return false;
237 237
             }
238 238
         }
@@ -266,17 +266,17 @@  discard block
 block discarded – undo
266 266
     private function getExtensionInstallerInstance(AbstractExtension $extension): ?ExtensionInstallerInterface
267 267
     {
268 268
         $className = $extension->getInstallerClass();
269
-        if (!class_exists($className)) {
269
+        if (!class_exists($className)) {
270 270
             return null;
271 271
         }
272 272
         $reflectionInstaller = new ReflectionClass($className);
273
-        if (!$reflectionInstaller->isSubclassOf(ExtensionInstallerInterface::class)) {
273
+        if (!$reflectionInstaller->isSubclassOf(ExtensionInstallerInterface::class)) {
274 274
             throw new RuntimeException($this->translator->trans('%extension% must implement ExtensionInstallerInterface', ['%extension%' => $className]));
275 275
         }
276 276
         /** @var ExtensionInstallerInterface $installer */
277 277
         $installer = $reflectionInstaller->newInstance();
278 278
         $installer->setExtension($extension);
279
-        if ($installer instanceof ContainerAwareInterface) {
279
+        if ($installer instanceof ContainerAwareInterface) {
280 280
             $installer->setContainer($this->container);
281 281
         }
282 282
 
Please login to merge, or discard this patch.
src/system/PrinterTheme/ZikulaPrinterTheme.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
45 45
     {
46 46
         $text = preg_replace_callback(
47 47
             '/<a [^>]*href\s*=\s*\"?([^>\"]*)\"?[^>]*>(.*?)<\/a.*?>/i',
48
-            function ($matches) {
48
+            function($matches) {
49 49
                 $this->links[] = html_entity_decode($matches[1]);
50 50
                 // return the replaced link
51 51
                 return '<strong><em>' . $matches[2] . '</em></strong> <small>[' . count($this->links) . ']</small>';
Please login to merge, or discard this patch.
Braces   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -17,8 +17,8 @@  discard block
 block discarded – undo
17 17
 use Twig\Environment;
18 18
 use Zikula\ExtensionsModule\AbstractCoreTheme;
19 19
 
20
-class ZikulaPrinterTheme extends AbstractCoreTheme
21
-{
20
+class ZikulaPrinterTheme extends AbstractCoreTheme
21
+{
22 22
     private $links = [];
23 23
 
24 24
     /**
@@ -63,19 +63,19 @@  discard block
 block discarded – undo
63 63
     {
64 64
         $translator = $this->getContainer()->get('translator');
65 65
         $text = '';
66
-        if (empty($this->links)) {
66
+        if (empty($this->links)) {
67 67
             return $text;
68 68
         }
69 69
 
70 70
         $text .= '<div><strong>' . $translator->trans('Links') . '</strong>';
71 71
         $text .= '<ol>';
72 72
         $this->links = array_unique($this->links);
73
-        foreach ($this->links as $key => $link) {
73
+        foreach ($this->links as $key => $link) {
74 74
             // check for an e-mail address
75
-            if (preg_match("/^([a-z0-9_]|\\-|\\.)+@(([a-z0-9_]|\\-)+\\.)+[a-z]{2,4}$/i", $link)) {
75
+            if (preg_match("/^([a-z0-9_]|\\-|\\.)+@(([a-z0-9_]|\\-)+\\.)+[a-z]{2,4}$/i", $link)) {
76 76
                 $linkText = $link;
77 77
                 $link = 'mailto:' . $link;
78
-            } else {
78
+            } else {
79 79
                 $linkText = $link;
80 80
             }
81 81
             $linkText = htmlspecialchars($linkText, ENT_QUOTES);
Please login to merge, or discard this patch.
src/system/BootstrapTheme/ZikulaBootstrapTheme.php 1 patch
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,6 +15,6 @@
 block discarded – undo
15 15
 
16 16
 use Zikula\ExtensionsModule\AbstractCoreTheme;
17 17
 
18
-class ZikulaBootstrapTheme extends AbstractCoreTheme
19
-{
18
+class ZikulaBootstrapTheme extends AbstractCoreTheme
19
+{
20 20
 }
Please login to merge, or discard this patch.
src/Zikula/CoreInstallerBundle/Helper/BlockHelper.php 1 patch
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -23,8 +23,8 @@  discard block
 block discarded – undo
23 23
 use Zikula\ExtensionsModule\Entity\ExtensionEntity;
24 24
 use Zikula\MenuModule\Block\MenuBlock;
25 25
 
26
-class BlockHelper
27
-{
26
+class BlockHelper
27
+{
28 28
     /**
29 29
      * @var EntityManagerInterface
30 30
      */
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
         EntityManagerInterface $entityManager,
45 45
         TranslatorInterface $translator,
46 46
         ContainerInterface $container
47
-    ) {
47
+    ) {
48 48
         $this->entityManager = $entityManager;
49 49
         $this->translator = $translator;
50 50
         $this->container = $container;
Please login to merge, or discard this patch.
src/Zikula/CoreBundle/Controller/AbstractController.php 1 patch
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -27,8 +27,8 @@  discard block
 block discarded – undo
27 27
 use Zikula\ExtensionsModule\ExtensionVariablesTrait;
28 28
 use Zikula\PermissionsModule\Api\ApiInterface\PermissionApiInterface;
29 29
 
30
-abstract class AbstractController extends BaseController
31
-{
30
+abstract class AbstractController extends BaseController
31
+{
32 32
     use TranslatorTrait;
33 33
     use ExtensionVariablesTrait;
34 34
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
         PermissionApiInterface $permissionApi,
56 56
         VariableApiInterface $variableApi,
57 57
         TranslatorInterface $translator
58
-    ) {
58
+    ) {
59 59
         $this->extension = $extension;
60 60
         $this->name = $extension->getName();
61 61
         $this->permissionApi = $permissionApi;
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
     {
73 73
         // load optional bootstrap
74 74
         $bootstrap = $extension->getPath() . '/bootstrap.php';
75
-        if (file_exists($bootstrap)) {
75
+        if (file_exists($bootstrap)) {
76 76
             include_once $bootstrap;
77 77
         }
78 78
     }
Please login to merge, or discard this patch.
src/Zikula/CoreBundle/HttpKernel/ZikulaKernel.php 1 patch
Braces   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
 define('ACCESS_DELETE', 700);
55 55
 define('ACCESS_ADMIN', 800);
56 56
 
57
-abstract class ZikulaKernel extends Kernel implements ZikulaHttpKernelInterface
58
-{
57
+abstract class ZikulaKernel extends Kernel implements ZikulaHttpKernelInterface
58
+{
59 59
     public const VERSION = '3.0.0';
60 60
 
61 61
     public const PHP_MINIMUM_VERSION = '7.2.5';
@@ -113,18 +113,18 @@  discard block
 block discarded – undo
113 113
      */
114 114
     private $autoloader;
115 115
 
116
-    public function boot()
117
-    {
118
-        if (null === $this->autoloader) {
116
+    public function boot()
117
+    {
118
+        if (null === $this->autoloader) {
119 119
             $this->getAutoloader();
120 120
         }
121 121
 
122 122
         parent::boot();
123 123
 
124
-        foreach ($this->bundles as $name => $bundle) {
125
-            if ($bundle instanceof AbstractModule && !isset($this->modules[$name])) {
124
+        foreach ($this->bundles as $name => $bundle) {
125
+            if ($bundle instanceof AbstractModule && !isset($this->modules[$name])) {
126 126
                 $this->modules[$name] = $bundle;
127
-            } elseif ($bundle instanceof AbstractTheme && !isset($this->themes[$name])) {
127
+            } elseif ($bundle instanceof AbstractTheme && !isset($this->themes[$name])) {
128 128
                 $this->themes[$name] = $bundle;
129 129
             }
130 130
         }
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 
133 133
     public function getModule(string $moduleName): AbstractModule
134 134
     {
135
-        if (!isset($this->modules[$moduleName])) {
135
+        if (!isset($this->modules[$moduleName])) {
136 136
             throw new InvalidArgumentException(sprintf('Module "%s" does not exist or it is not enabled.', $moduleName));
137 137
         }
138 138
 
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 
152 152
     public function getTheme(string $themeName): AbstractTheme
153 153
     {
154
-        if (!isset($this->themes[$themeName])) {
154
+        if (!isset($this->themes[$themeName])) {
155 155
             throw new InvalidArgumentException(sprintf('Theme "%s" does not exist or it is not enabled.', $themeName));
156 156
         }
157 157
 
@@ -166,8 +166,8 @@  discard block
 block discarded – undo
166 166
     public function getJustBundles(): array
167 167
     {
168 168
         $bundles = [];
169
-        foreach ($this->bundles as $bundle) {
170
-            if (!$bundle instanceof AbstractExtension) {
169
+        foreach ($this->bundles as $bundle) {
170
+            if (!$bundle instanceof AbstractExtension) {
171 171
                 $bundles[] = $bundle;
172 172
             }
173 173
         }
@@ -177,11 +177,11 @@  discard block
 block discarded – undo
177 177
 
178 178
     public function isBundle(string $name): bool
179 179
     {
180
-        try {
180
+        try {
181 181
             $this->getBundle($name);
182 182
 
183 183
             return true;
184
-        } catch (Exception $exception) {
184
+        } catch (Exception $exception) {
185 185
             return false;
186 186
         }
187 187
     }
@@ -193,16 +193,16 @@  discard block
 block discarded – undo
193 193
 
194 194
     public function getAutoloader(): object
195 195
     {
196
-        if (null === $this->autoloader) {
196
+        if (null === $this->autoloader) {
197 197
             $loaders = spl_autoload_functions();
198
-            if ($loaders[0][0] instanceof DebugClassLoader) {
198
+            if ($loaders[0][0] instanceof DebugClassLoader) {
199 199
                 $classLoader = $loaders[0][0]->getClassLoader();
200
-                if (is_callable($classLoader) && is_object($classLoader[0])) {
200
+                if (is_callable($classLoader) && is_object($classLoader[0])) {
201 201
                     $this->autoloader = $classLoader[0];
202
-                } elseif (is_object($classLoader)) {
202
+                } elseif (is_object($classLoader)) {
203 203
                     $this->autoloader = $classLoader;
204 204
                 }
205
-            } else {
205
+            } else {
206 206
                 $this->autoloader = $loaders[0][0];
207 207
             }
208 208
         }
@@ -213,8 +213,8 @@  discard block
 block discarded – undo
213 213
     public function isClassInBundle(string $class): bool
214 214
     {
215 215
         /* @var BundleInterface $bundle */
216
-        foreach ($this->getBundles() as $bundle) {
217
-            if (0 === mb_strpos($class, $bundle->getNamespace())) {
216
+        foreach ($this->getBundles() as $bundle) {
217
+            if (0 === mb_strpos($class, $bundle->getNamespace())) {
218 218
                 return $bundle instanceof AbstractExtension;
219 219
             }
220 220
         }
Please login to merge, or discard this patch.