Completed
Pull Request — develop (#1701)
by
unknown
01:22
created
src/modules/include-exclude-push-config/load.php 2 patches
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -5,31 +5,31 @@  discard block
 block discarded – undo
5 5
 use Wordlift\Modules\Common\Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
6 6
 use Wordlift\Modules\Include_Exclude_Push_Config\Include_Exclude_API;
7 7
 
8
-if ( ! defined( 'ABSPATH' ) ) {
8
+if ( ! defined('ABSPATH')) {
9 9
 	exit;
10 10
 }
11 11
 
12 12
 // Bail out if the feature isn't enabled.
13
-if ( ! apply_filters( 'wl_feature__enable__include-exclude', false ) ) { // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
13
+if ( ! apply_filters('wl_feature__enable__include-exclude', false)) { // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
14 14
 	return;
15 15
 }
16 16
 
17 17
 // Autoloader for dependencies.
18
-if ( file_exists( __DIR__ . '/third-party/vendor/scoper-autoload.php' ) ) {
19
-	require __DIR__ . '/third-party/vendor/scoper-autoload.php';
18
+if (file_exists(__DIR__.'/third-party/vendor/scoper-autoload.php')) {
19
+	require __DIR__.'/third-party/vendor/scoper-autoload.php';
20 20
 }
21 21
 
22 22
 // Autoloader for plugin itself.
23
-if ( file_exists( __DIR__ . '/includes/vendor/autoload.php' ) ) {
24
-	require __DIR__ . '/includes/vendor/autoload.php';
23
+if (file_exists(__DIR__.'/includes/vendor/autoload.php')) {
24
+	require __DIR__.'/includes/vendor/autoload.php';
25 25
 }
26 26
 
27 27
 function __wl_include_exclude_push_config() {
28 28
 	// Get the configuration.
29
-	$config = get_option( 'wl_exclude_include_urls_settings', array() );
29
+	$config = get_option('wl_exclude_include_urls_settings', array());
30 30
 
31 31
 	// Set the default data.
32
-	if ( ! is_array( $config ) || empty( $config ) || ! isset( $config['include_exclude'] ) || ! isset( $config['urls'] ) ) {
32
+	if ( ! is_array($config) || empty($config) || ! isset($config['include_exclude']) || ! isset($config['urls'])) {
33 33
 		$config = get_option(
34 34
 			'wl_exclude_include_urls_settings',
35 35
 			array(
@@ -41,34 +41,34 @@  discard block
 block discarded – undo
41 41
 
42 42
 	// Map the configuration to the payload.
43 43
 	$payload = array_map(
44
-		function ( $item ) use ( $config ) {
44
+		function($item) use ($config) {
45 45
 			return array(
46 46
 				'url'  =>
47
-					( 1 === preg_match( '@^https?://.*$@', $item ) ? $item : get_home_url( null, $item ) ),
48
-				'flag' => strtoupper( $config['include_exclude'] ),
47
+					(1 === preg_match('@^https?://.*$@', $item) ? $item : get_home_url(null, $item)),
48
+				'flag' => strtoupper($config['include_exclude']),
49 49
 			);
50 50
 		},
51
-		array_filter( preg_split( '/[\r\n]+/', $config['urls'] ) )
51
+		array_filter(preg_split('/[\r\n]+/', $config['urls']))
52 52
 	);
53 53
 
54 54
 	// Load the service.
55 55
 	$container_builder = new ContainerBuilder();
56
-	$loader            = new YamlFileLoader( $container_builder, new FileLocator( __DIR__ ) );
57
-	$loader->load( 'services.yml' );
56
+	$loader            = new YamlFileLoader($container_builder, new FileLocator(__DIR__));
57
+	$loader->load('services.yml');
58 58
 	$container_builder->compile();
59 59
 
60 60
 	/** @var Include_Exclude_API $api */
61
-	$api = $container_builder->get( 'Wordlift\Modules\Include_Exclude_Push_Config\Include_Exclude_API' );
62
-	$api->update( $payload );
61
+	$api = $container_builder->get('Wordlift\Modules\Include_Exclude_Push_Config\Include_Exclude_API');
62
+	$api->update($payload);
63 63
 
64 64
 }
65 65
 
66 66
 /**
67 67
  * Fires after the value of a specific option has been successfully updated.
68 68
  */
69
-add_action( 'update_option_wl_exclude_include_urls_settings', '__wl_include_exclude_push_config', 10, 0 );
69
+add_action('update_option_wl_exclude_include_urls_settings', '__wl_include_exclude_push_config', 10, 0);
70 70
 
71 71
 /**
72 72
  * Fires daily.
73 73
  */
74
-add_action( 'wl_daily_cron', '__wl_include_exclude_push_config', 10, 0 );
74
+add_action('wl_daily_cron', '__wl_include_exclude_push_config', 10, 0);
Please login to merge, or discard this patch.
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -6,60 +6,60 @@
 block discarded – undo
6 6
 use Wordlift\Modules\Include_Exclude_Push_Config\Include_Exclude_API;
7 7
 
8 8
 if ( ! defined( 'ABSPATH' ) ) {
9
-	exit;
9
+    exit;
10 10
 }
11 11
 
12 12
 // Bail out if the feature isn't enabled.
13 13
 if ( ! apply_filters( 'wl_feature__enable__include-exclude', false ) ) { // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
14
-	return;
14
+    return;
15 15
 }
16 16
 
17 17
 // Autoloader for dependencies.
18 18
 if ( file_exists( __DIR__ . '/third-party/vendor/scoper-autoload.php' ) ) {
19
-	require __DIR__ . '/third-party/vendor/scoper-autoload.php';
19
+    require __DIR__ . '/third-party/vendor/scoper-autoload.php';
20 20
 }
21 21
 
22 22
 // Autoloader for plugin itself.
23 23
 if ( file_exists( __DIR__ . '/includes/vendor/autoload.php' ) ) {
24
-	require __DIR__ . '/includes/vendor/autoload.php';
24
+    require __DIR__ . '/includes/vendor/autoload.php';
25 25
 }
26 26
 
27 27
 function __wl_include_exclude_push_config() {
28
-	// Get the configuration.
29
-	$config = get_option( 'wl_exclude_include_urls_settings', array() );
28
+    // Get the configuration.
29
+    $config = get_option( 'wl_exclude_include_urls_settings', array() );
30 30
 
31
-	// Set the default data.
32
-	if ( ! is_array( $config ) || empty( $config ) || ! isset( $config['include_exclude'] ) || ! isset( $config['urls'] ) ) {
33
-		$config = get_option(
34
-			'wl_exclude_include_urls_settings',
35
-			array(
36
-				'include_exclude' => 'exclude',
37
-				'urls'            => '',
38
-			)
39
-		);
40
-	}
31
+    // Set the default data.
32
+    if ( ! is_array( $config ) || empty( $config ) || ! isset( $config['include_exclude'] ) || ! isset( $config['urls'] ) ) {
33
+        $config = get_option(
34
+            'wl_exclude_include_urls_settings',
35
+            array(
36
+                'include_exclude' => 'exclude',
37
+                'urls'            => '',
38
+            )
39
+        );
40
+    }
41 41
 
42
-	// Map the configuration to the payload.
43
-	$payload = array_map(
44
-		function ( $item ) use ( $config ) {
45
-			return array(
46
-				'url'  =>
47
-					( 1 === preg_match( '@^https?://.*$@', $item ) ? $item : get_home_url( null, $item ) ),
48
-				'flag' => strtoupper( $config['include_exclude'] ),
49
-			);
50
-		},
51
-		array_filter( preg_split( '/[\r\n]+/', $config['urls'] ) )
52
-	);
42
+    // Map the configuration to the payload.
43
+    $payload = array_map(
44
+        function ( $item ) use ( $config ) {
45
+            return array(
46
+                'url'  =>
47
+                    ( 1 === preg_match( '@^https?://.*$@', $item ) ? $item : get_home_url( null, $item ) ),
48
+                'flag' => strtoupper( $config['include_exclude'] ),
49
+            );
50
+        },
51
+        array_filter( preg_split( '/[\r\n]+/', $config['urls'] ) )
52
+    );
53 53
 
54
-	// Load the service.
55
-	$container_builder = new ContainerBuilder();
56
-	$loader            = new YamlFileLoader( $container_builder, new FileLocator( __DIR__ ) );
57
-	$loader->load( 'services.yml' );
58
-	$container_builder->compile();
54
+    // Load the service.
55
+    $container_builder = new ContainerBuilder();
56
+    $loader            = new YamlFileLoader( $container_builder, new FileLocator( __DIR__ ) );
57
+    $loader->load( 'services.yml' );
58
+    $container_builder->compile();
59 59
 
60
-	/** @var Include_Exclude_API $api */
61
-	$api = $container_builder->get( 'Wordlift\Modules\Include_Exclude_Push_Config\Include_Exclude_API' );
62
-	$api->update( $payload );
60
+    /** @var Include_Exclude_API $api */
61
+    $api = $container_builder->get( 'Wordlift\Modules\Include_Exclude_Push_Config\Include_Exclude_API' );
62
+    $api->update( $payload );
63 63
 }
64 64
 
65 65
 /**
Please login to merge, or discard this patch.
src/modules/food-kg/vendor/composer/InstalledVersions.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
     public static function getVersionRanges($packageName)
138 138
     {
139 139
         foreach (self::getInstalled() as $installed) {
140
-            if (!isset($installed['versions'][$packageName])) {
140
+            if ( ! isset($installed['versions'][$packageName])) {
141 141
                 continue;
142 142
             }
143 143
 
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
             return implode(' || ', $ranges);
159 159
         }
160 160
 
161
-        throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
161
+        throw new \OutOfBoundsException('Package "'.$packageName.'" is not installed');
162 162
     }
163 163
 
164 164
     /**
@@ -168,18 +168,18 @@  discard block
 block discarded – undo
168 168
     public static function getVersion($packageName)
169 169
     {
170 170
         foreach (self::getInstalled() as $installed) {
171
-            if (!isset($installed['versions'][$packageName])) {
171
+            if ( ! isset($installed['versions'][$packageName])) {
172 172
                 continue;
173 173
             }
174 174
 
175
-            if (!isset($installed['versions'][$packageName]['version'])) {
175
+            if ( ! isset($installed['versions'][$packageName]['version'])) {
176 176
                 return null;
177 177
             }
178 178
 
179 179
             return $installed['versions'][$packageName]['version'];
180 180
         }
181 181
 
182
-        throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
182
+        throw new \OutOfBoundsException('Package "'.$packageName.'" is not installed');
183 183
     }
184 184
 
185 185
     /**
@@ -189,18 +189,18 @@  discard block
 block discarded – undo
189 189
     public static function getPrettyVersion($packageName)
190 190
     {
191 191
         foreach (self::getInstalled() as $installed) {
192
-            if (!isset($installed['versions'][$packageName])) {
192
+            if ( ! isset($installed['versions'][$packageName])) {
193 193
                 continue;
194 194
             }
195 195
 
196
-            if (!isset($installed['versions'][$packageName]['pretty_version'])) {
196
+            if ( ! isset($installed['versions'][$packageName]['pretty_version'])) {
197 197
                 return null;
198 198
             }
199 199
 
200 200
             return $installed['versions'][$packageName]['pretty_version'];
201 201
         }
202 202
 
203
-        throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
203
+        throw new \OutOfBoundsException('Package "'.$packageName.'" is not installed');
204 204
     }
205 205
 
206 206
     /**
@@ -210,18 +210,18 @@  discard block
 block discarded – undo
210 210
     public static function getReference($packageName)
211 211
     {
212 212
         foreach (self::getInstalled() as $installed) {
213
-            if (!isset($installed['versions'][$packageName])) {
213
+            if ( ! isset($installed['versions'][$packageName])) {
214 214
                 continue;
215 215
             }
216 216
 
217
-            if (!isset($installed['versions'][$packageName]['reference'])) {
217
+            if ( ! isset($installed['versions'][$packageName]['reference'])) {
218 218
                 return null;
219 219
             }
220 220
 
221 221
             return $installed['versions'][$packageName]['reference'];
222 222
         }
223 223
 
224
-        throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
224
+        throw new \OutOfBoundsException('Package "'.$packageName.'" is not installed');
225 225
     }
226 226
 
227 227
     /**
@@ -231,14 +231,14 @@  discard block
 block discarded – undo
231 231
     public static function getInstallPath($packageName)
232 232
     {
233 233
         foreach (self::getInstalled() as $installed) {
234
-            if (!isset($installed['versions'][$packageName])) {
234
+            if ( ! isset($installed['versions'][$packageName])) {
235 235
                 continue;
236 236
             }
237 237
 
238 238
             return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
239 239
         }
240 240
 
241
-        throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
241
+        throw new \OutOfBoundsException('Package "'.$packageName.'" is not installed');
242 242
     }
243 243
 
244 244
     /**
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
             // only require the installed.php file if this file is loaded from its dumped location,
268 268
             // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
269 269
             if (substr(__DIR__, -8, 1) !== 'C') {
270
-                self::$installed = include __DIR__ . '/installed.php';
270
+                self::$installed = include __DIR__.'/installed.php';
271 271
             } else {
272 272
                 self::$installed = array();
273 273
             }
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
             // only require the installed.php file if this file is loaded from its dumped location,
341 341
             // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
342 342
             if (substr(__DIR__, -8, 1) !== 'C') {
343
-                self::$installed = require __DIR__ . '/installed.php';
343
+                self::$installed = require __DIR__.'/installed.php';
344 344
             } else {
345 345
                 self::$installed = array();
346 346
             }
Please login to merge, or discard this patch.
src/modules/food-kg/vendor/composer/ClassLoader.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
      */
114 114
     public function getPrefixes()
115 115
     {
116
-        if (!empty($this->prefixesPsr0)) {
116
+        if ( ! empty($this->prefixesPsr0)) {
117 117
             return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
118 118
         }
119 119
 
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
      */
184 184
     public function add($prefix, $paths, $prepend = false)
185 185
     {
186
-        if (!$prefix) {
186
+        if ( ! $prefix) {
187 187
             if ($prepend) {
188 188
                 $this->fallbackDirsPsr0 = array_merge(
189 189
                     (array) $paths,
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
         }
201 201
 
202 202
         $first = $prefix[0];
203
-        if (!isset($this->prefixesPsr0[$first][$prefix])) {
203
+        if ( ! isset($this->prefixesPsr0[$first][$prefix])) {
204 204
             $this->prefixesPsr0[$first][$prefix] = (array) $paths;
205 205
 
206 206
             return;
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
      */
233 233
     public function addPsr4($prefix, $paths, $prepend = false)
234 234
     {
235
-        if (!$prefix) {
235
+        if ( ! $prefix) {
236 236
             // Register directories for the root namespace.
237 237
             if ($prepend) {
238 238
                 $this->fallbackDirsPsr4 = array_merge(
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
                     (array) $paths
246 246
                 );
247 247
             }
248
-        } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
248
+        } elseif ( ! isset($this->prefixDirsPsr4[$prefix])) {
249 249
             // Register directories for a new namespace.
250 250
             $length = strlen($prefix);
251 251
             if ('\\' !== $prefix[$length - 1]) {
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
      */
280 280
     public function set($prefix, $paths)
281 281
     {
282
-        if (!$prefix) {
282
+        if ( ! $prefix) {
283 283
             $this->fallbackDirsPsr0 = (array) $paths;
284 284
         } else {
285 285
             $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
      */
300 300
     public function setPsr4($prefix, $paths)
301 301
     {
302
-        if (!$prefix) {
302
+        if ( ! $prefix) {
303 303
             $this->fallbackDirsPsr4 = (array) $paths;
304 304
         } else {
305 305
             $length = strlen($prefix);
@@ -493,18 +493,18 @@  discard block
 block discarded – undo
493 493
     private function findFileWithExtension($class, $ext)
494 494
     {
495 495
         // PSR-4 lookup
496
-        $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
496
+        $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR).$ext;
497 497
 
498 498
         $first = $class[0];
499 499
         if (isset($this->prefixLengthsPsr4[$first])) {
500 500
             $subPath = $class;
501 501
             while (false !== $lastPos = strrpos($subPath, '\\')) {
502 502
                 $subPath = substr($subPath, 0, $lastPos);
503
-                $search = $subPath . '\\';
503
+                $search = $subPath.'\\';
504 504
                 if (isset($this->prefixDirsPsr4[$search])) {
505
-                    $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
505
+                    $pathEnd = DIRECTORY_SEPARATOR.substr($logicalPathPsr4, $lastPos + 1);
506 506
                     foreach ($this->prefixDirsPsr4[$search] as $dir) {
507
-                        if (file_exists($file = $dir . $pathEnd)) {
507
+                        if (file_exists($file = $dir.$pathEnd)) {
508 508
                             return $file;
509 509
                         }
510 510
                     }
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
 
515 515
         // PSR-4 fallback dirs
516 516
         foreach ($this->fallbackDirsPsr4 as $dir) {
517
-            if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
517
+            if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr4)) {
518 518
                 return $file;
519 519
             }
520 520
         }
@@ -526,14 +526,14 @@  discard block
 block discarded – undo
526 526
                 . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
527 527
         } else {
528 528
             // PEAR-like class name
529
-            $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
529
+            $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR).$ext;
530 530
         }
531 531
 
532 532
         if (isset($this->prefixesPsr0[$first])) {
533 533
             foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
534 534
                 if (0 === strpos($class, $prefix)) {
535 535
                     foreach ($dirs as $dir) {
536
-                        if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
536
+                        if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) {
537 537
                             return $file;
538 538
                         }
539 539
                     }
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
 
544 544
         // PSR-0 fallback dirs
545 545
         foreach ($this->fallbackDirsPsr0 as $dir) {
546
-            if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
546
+            if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) {
547 547
                 return $file;
548 548
             }
549 549
         }
Please login to merge, or discard this patch.
src/modules/food-kg/vendor/composer/autoload_real.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
     public static function loadClassLoader($class)
10 10
     {
11 11
         if ('Composer\Autoload\ClassLoader' === $class) {
12
-            require __DIR__ . '/ClassLoader.php';
12
+            require __DIR__.'/ClassLoader.php';
13 13
         }
14 14
     }
15 15
 
@@ -22,13 +22,13 @@  discard block
 block discarded – undo
22 22
             return self::$loader;
23 23
         }
24 24
 
25
-        require __DIR__ . '/platform_check.php';
25
+        require __DIR__.'/platform_check.php';
26 26
 
27 27
         spl_autoload_register(array('ComposerAutoloaderInit718e370ed095fd597a1f1d468c2b59f4', 'loadClassLoader'), true, true);
28 28
         self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
29 29
         spl_autoload_unregister(array('ComposerAutoloaderInit718e370ed095fd597a1f1d468c2b59f4', 'loadClassLoader'));
30 30
 
31
-        require __DIR__ . '/autoload_static.php';
31
+        require __DIR__.'/autoload_static.php';
32 32
         call_user_func(\Composer\Autoload\ComposerStaticInit718e370ed095fd597a1f1d468c2b59f4::getInitializer($loader));
33 33
 
34 34
         $loader->register(true);
Please login to merge, or discard this patch.
src/modules/food-kg/vendor/composer/platform_check.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -4,23 +4,23 @@
 block discarded – undo
4 4
 
5 5
 $issues = array();
6 6
 
7
-if (!(PHP_VERSION_ID >= 50600)) {
8
-    $issues[] = 'Your Composer dependencies require a PHP version ">= 5.6.0". You are running ' . PHP_VERSION . '.';
7
+if ( ! (PHP_VERSION_ID >= 50600)) {
8
+    $issues[] = 'Your Composer dependencies require a PHP version ">= 5.6.0". You are running '.PHP_VERSION.'.';
9 9
 }
10 10
 
11 11
 if ($issues) {
12
-    if (!headers_sent()) {
12
+    if ( ! headers_sent()) {
13 13
         header('HTTP/1.1 500 Internal Server Error');
14 14
     }
15
-    if (!ini_get('display_errors')) {
15
+    if ( ! ini_get('display_errors')) {
16 16
         if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
17
-            fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL);
18
-        } elseif (!headers_sent()) {
19
-            echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL;
17
+            fwrite(STDERR, 'Composer detected issues in your platform:'.PHP_EOL.PHP_EOL.implode(PHP_EOL, $issues).PHP_EOL.PHP_EOL);
18
+        } elseif ( ! headers_sent()) {
19
+            echo 'Composer detected issues in your platform:'.PHP_EOL.PHP_EOL.str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)).PHP_EOL.PHP_EOL;
20 20
         }
21 21
     }
22 22
     trigger_error(
23
-        'Composer detected issues in your platform: ' . implode(' ', $issues),
23
+        'Composer detected issues in your platform: '.implode(' ', $issues),
24 24
         E_USER_ERROR
25 25
     );
26 26
 }
Please login to merge, or discard this patch.
libraries/action-scheduler/deprecated/ActionScheduler_Store_Deprecated.php 2 patches
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -6,44 +6,44 @@
 block discarded – undo
6 6
  */
7 7
 abstract class ActionScheduler_Store_Deprecated {
8 8
 
9
-	/**
10
-	 * Mark an action that failed to fetch correctly as failed.
11
-	 *
12
-	 * @since 2.2.6
13
-	 *
14
-	 * @param int $action_id The ID of the action.
15
-	 */
16
-	public function mark_failed_fetch_action( $action_id ) {
17
-		_deprecated_function( __METHOD__, '3.0.0', 'ActionScheduler_Store::mark_failure()' );
18
-		self::$store->mark_failure( $action_id );
19
-	}
9
+    /**
10
+     * Mark an action that failed to fetch correctly as failed.
11
+     *
12
+     * @since 2.2.6
13
+     *
14
+     * @param int $action_id The ID of the action.
15
+     */
16
+    public function mark_failed_fetch_action( $action_id ) {
17
+        _deprecated_function( __METHOD__, '3.0.0', 'ActionScheduler_Store::mark_failure()' );
18
+        self::$store->mark_failure( $action_id );
19
+    }
20 20
 
21
-	/**
22
-	 * Add base hooks
23
-	 *
24
-	 * @since 2.2.6
25
-	 */
26
-	protected static function hook() {
27
-		_deprecated_function( __METHOD__, '3.0.0' );
28
-	}
21
+    /**
22
+     * Add base hooks
23
+     *
24
+     * @since 2.2.6
25
+     */
26
+    protected static function hook() {
27
+        _deprecated_function( __METHOD__, '3.0.0' );
28
+    }
29 29
 
30
-	/**
31
-	 * Remove base hooks
32
-	 *
33
-	 * @since 2.2.6
34
-	 */
35
-	protected static function unhook() {
36
-		_deprecated_function( __METHOD__, '3.0.0' );
37
-	}
30
+    /**
31
+     * Remove base hooks
32
+     *
33
+     * @since 2.2.6
34
+     */
35
+    protected static function unhook() {
36
+        _deprecated_function( __METHOD__, '3.0.0' );
37
+    }
38 38
 
39
-	/**
40
-	 * Get the site's local time.
41
-	 *
42
-	 * @deprecated 2.1.0
43
-	 * @return DateTimeZone
44
-	 */
45
-	protected function get_local_timezone() {
46
-		_deprecated_function( __FUNCTION__, '2.1.0', 'ActionScheduler_TimezoneHelper::set_local_timezone()' );
47
-		return ActionScheduler_TimezoneHelper::get_local_timezone();
48
-	}
39
+    /**
40
+     * Get the site's local time.
41
+     *
42
+     * @deprecated 2.1.0
43
+     * @return DateTimeZone
44
+     */
45
+    protected function get_local_timezone() {
46
+        _deprecated_function( __FUNCTION__, '2.1.0', 'ActionScheduler_TimezoneHelper::set_local_timezone()' );
47
+        return ActionScheduler_TimezoneHelper::get_local_timezone();
48
+    }
49 49
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -13,9 +13,9 @@  discard block
 block discarded – undo
13 13
 	 *
14 14
 	 * @param int $action_id The ID of the action.
15 15
 	 */
16
-	public function mark_failed_fetch_action( $action_id ) {
17
-		_deprecated_function( __METHOD__, '3.0.0', 'ActionScheduler_Store::mark_failure()' );
18
-		self::$store->mark_failure( $action_id );
16
+	public function mark_failed_fetch_action($action_id) {
17
+		_deprecated_function(__METHOD__, '3.0.0', 'ActionScheduler_Store::mark_failure()');
18
+		self::$store->mark_failure($action_id);
19 19
 	}
20 20
 
21 21
 	/**
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	 * @since 2.2.6
25 25
 	 */
26 26
 	protected static function hook() {
27
-		_deprecated_function( __METHOD__, '3.0.0' );
27
+		_deprecated_function(__METHOD__, '3.0.0');
28 28
 	}
29 29
 
30 30
 	/**
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	 * @since 2.2.6
34 34
 	 */
35 35
 	protected static function unhook() {
36
-		_deprecated_function( __METHOD__, '3.0.0' );
36
+		_deprecated_function(__METHOD__, '3.0.0');
37 37
 	}
38 38
 
39 39
 	/**
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 * @return DateTimeZone
44 44
 	 */
45 45
 	protected function get_local_timezone() {
46
-		_deprecated_function( __FUNCTION__, '2.1.0', 'ActionScheduler_TimezoneHelper::set_local_timezone()' );
46
+		_deprecated_function(__FUNCTION__, '2.1.0', 'ActionScheduler_TimezoneHelper::set_local_timezone()');
47 47
 		return ActionScheduler_TimezoneHelper::get_local_timezone();
48 48
 	}
49 49
 }
Please login to merge, or discard this patch.
deprecated/ActionScheduler_Abstract_QueueRunner_Deprecated.php 2 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -5,23 +5,23 @@
 block discarded – undo
5 5
  */
6 6
 abstract class ActionScheduler_Abstract_QueueRunner_Deprecated {
7 7
 
8
-	/**
9
-	 * Get the maximum number of seconds a batch can run for.
10
-	 *
11
-	 * @deprecated 2.1.1
12
-	 * @return int The number of seconds.
13
-	 */
14
-	protected function get_maximum_execution_time() {
15
-		_deprecated_function( __METHOD__, '2.1.1', 'ActionScheduler_Abstract_QueueRunner::get_time_limit()' );
8
+    /**
9
+     * Get the maximum number of seconds a batch can run for.
10
+     *
11
+     * @deprecated 2.1.1
12
+     * @return int The number of seconds.
13
+     */
14
+    protected function get_maximum_execution_time() {
15
+        _deprecated_function( __METHOD__, '2.1.1', 'ActionScheduler_Abstract_QueueRunner::get_time_limit()' );
16 16
 
17
-		$maximum_execution_time = 30;
17
+        $maximum_execution_time = 30;
18 18
 
19
-		// Apply deprecated filter
20
-		if ( has_filter( 'action_scheduler_maximum_execution_time' ) ) {
21
-			_deprecated_function( 'action_scheduler_maximum_execution_time', '2.1.1', 'action_scheduler_queue_runner_time_limit' );
22
-			$maximum_execution_time = apply_filters( 'action_scheduler_maximum_execution_time', $maximum_execution_time );
23
-		}
19
+        // Apply deprecated filter
20
+        if ( has_filter( 'action_scheduler_maximum_execution_time' ) ) {
21
+            _deprecated_function( 'action_scheduler_maximum_execution_time', '2.1.1', 'action_scheduler_queue_runner_time_limit' );
22
+            $maximum_execution_time = apply_filters( 'action_scheduler_maximum_execution_time', $maximum_execution_time );
23
+        }
24 24
 
25
-		return absint( $maximum_execution_time );
26
-	}
25
+        return absint( $maximum_execution_time );
26
+    }
27 27
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -12,16 +12,16 @@
 block discarded – undo
12 12
 	 * @return int The number of seconds.
13 13
 	 */
14 14
 	protected function get_maximum_execution_time() {
15
-		_deprecated_function( __METHOD__, '2.1.1', 'ActionScheduler_Abstract_QueueRunner::get_time_limit()' );
15
+		_deprecated_function(__METHOD__, '2.1.1', 'ActionScheduler_Abstract_QueueRunner::get_time_limit()');
16 16
 
17 17
 		$maximum_execution_time = 30;
18 18
 
19 19
 		// Apply deprecated filter
20
-		if ( has_filter( 'action_scheduler_maximum_execution_time' ) ) {
21
-			_deprecated_function( 'action_scheduler_maximum_execution_time', '2.1.1', 'action_scheduler_queue_runner_time_limit' );
22
-			$maximum_execution_time = apply_filters( 'action_scheduler_maximum_execution_time', $maximum_execution_time );
20
+		if (has_filter('action_scheduler_maximum_execution_time')) {
21
+			_deprecated_function('action_scheduler_maximum_execution_time', '2.1.1', 'action_scheduler_queue_runner_time_limit');
22
+			$maximum_execution_time = apply_filters('action_scheduler_maximum_execution_time', $maximum_execution_time);
23 23
 		}
24 24
 
25
-		return absint( $maximum_execution_time );
25
+		return absint($maximum_execution_time);
26 26
 	}
27 27
 }
Please login to merge, or discard this patch.
action-scheduler/deprecated/ActionScheduler_Schedule_Deprecated.php 2 patches
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -5,25 +5,25 @@
 block discarded – undo
5 5
  */
6 6
 abstract class ActionScheduler_Schedule_Deprecated implements ActionScheduler_Schedule {
7 7
 
8
-	/**
9
-	 * Get the date & time this schedule was created to run, or calculate when it should be run
10
-	 * after a given date & time.
11
-	 *
12
-	 * @param DateTime $after DateTime to calculate against.
13
-	 *
14
-	 * @return DateTime|null
15
-	 */
16
-	public function next( DateTime $after = null ) {
17
-		if ( empty( $after ) ) {
18
-			$return_value       = $this->get_date();
19
-			$replacement_method = 'get_date()';
20
-		} else {
21
-			$return_value       = $this->get_next( $after );
22
-			$replacement_method = 'get_next( $after )';
23
-		}
8
+    /**
9
+     * Get the date & time this schedule was created to run, or calculate when it should be run
10
+     * after a given date & time.
11
+     *
12
+     * @param DateTime $after DateTime to calculate against.
13
+     *
14
+     * @return DateTime|null
15
+     */
16
+    public function next( DateTime $after = null ) {
17
+        if ( empty( $after ) ) {
18
+            $return_value       = $this->get_date();
19
+            $replacement_method = 'get_date()';
20
+        } else {
21
+            $return_value       = $this->get_next( $after );
22
+            $replacement_method = 'get_next( $after )';
23
+        }
24 24
 
25
-		_deprecated_function( __METHOD__, '3.0.0', __CLASS__ . '::' . $replacement_method ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
25
+        _deprecated_function( __METHOD__, '3.0.0', __CLASS__ . '::' . $replacement_method ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
26 26
 
27
-		return $return_value;
28
-	}
27
+        return $return_value;
28
+    }
29 29
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -13,16 +13,16 @@
 block discarded – undo
13 13
 	 *
14 14
 	 * @return DateTime|null
15 15
 	 */
16
-	public function next( DateTime $after = null ) {
17
-		if ( empty( $after ) ) {
16
+	public function next(DateTime $after = null) {
17
+		if (empty($after)) {
18 18
 			$return_value       = $this->get_date();
19 19
 			$replacement_method = 'get_date()';
20 20
 		} else {
21
-			$return_value       = $this->get_next( $after );
21
+			$return_value       = $this->get_next($after);
22 22
 			$replacement_method = 'get_next( $after )';
23 23
 		}
24 24
 
25
-		_deprecated_function( __METHOD__, '3.0.0', __CLASS__ . '::' . $replacement_method ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
25
+		_deprecated_function(__METHOD__, '3.0.0', __CLASS__.'::'.$replacement_method); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
26 26
 
27 27
 		return $return_value;
28 28
 	}
Please login to merge, or discard this patch.
src/libraries/action-scheduler/functions.php 2 patches
Indentation   +137 added lines, -137 removed lines patch added patch discarded remove patch
@@ -16,10 +16,10 @@  discard block
 block discarded – undo
16 16
  * @return int The action ID.
17 17
  */
18 18
 function as_enqueue_async_action( $hook, $args = array(), $group = '', $unique = false ) {
19
-	if ( ! ActionScheduler::is_initialized( __FUNCTION__ ) ) {
20
-		return 0;
21
-	}
22
-	return ActionScheduler::factory()->async_unique( $hook, $args, $group, $unique );
19
+    if ( ! ActionScheduler::is_initialized( __FUNCTION__ ) ) {
20
+        return 0;
21
+    }
22
+    return ActionScheduler::factory()->async_unique( $hook, $args, $group, $unique );
23 23
 }
24 24
 
25 25
 /**
@@ -34,10 +34,10 @@  discard block
 block discarded – undo
34 34
  * @return int The action ID.
35 35
  */
36 36
 function as_schedule_single_action( $timestamp, $hook, $args = array(), $group = '', $unique = false ) {
37
-	if ( ! ActionScheduler::is_initialized( __FUNCTION__ ) ) {
38
-		return 0;
39
-	}
40
-	return ActionScheduler::factory()->single_unique( $hook, $args, $timestamp, $group, $unique );
37
+    if ( ! ActionScheduler::is_initialized( __FUNCTION__ ) ) {
38
+        return 0;
39
+    }
40
+    return ActionScheduler::factory()->single_unique( $hook, $args, $timestamp, $group, $unique );
41 41
 }
42 42
 
43 43
 /**
@@ -53,10 +53,10 @@  discard block
 block discarded – undo
53 53
  * @return int The action ID.
54 54
  */
55 55
 function as_schedule_recurring_action( $timestamp, $interval_in_seconds, $hook, $args = array(), $group = '', $unique = false ) {
56
-	if ( ! ActionScheduler::is_initialized( __FUNCTION__ ) ) {
57
-		return 0;
58
-	}
59
-	return ActionScheduler::factory()->recurring_unique( $hook, $args, $timestamp, $interval_in_seconds, $group, $unique );
56
+    if ( ! ActionScheduler::is_initialized( __FUNCTION__ ) ) {
57
+        return 0;
58
+    }
59
+    return ActionScheduler::factory()->recurring_unique( $hook, $args, $timestamp, $interval_in_seconds, $group, $unique );
60 60
 }
61 61
 
62 62
 /**
@@ -84,10 +84,10 @@  discard block
 block discarded – undo
84 84
  * @return int The action ID.
85 85
  */
86 86
 function as_schedule_cron_action( $timestamp, $schedule, $hook, $args = array(), $group = '', $unique = false ) {
87
-	if ( ! ActionScheduler::is_initialized( __FUNCTION__ ) ) {
88
-		return 0;
89
-	}
90
-	return ActionScheduler::factory()->cron_unique( $hook, $args, $timestamp, $schedule, $group, $unique );
87
+    if ( ! ActionScheduler::is_initialized( __FUNCTION__ ) ) {
88
+        return 0;
89
+    }
90
+    return ActionScheduler::factory()->cron_unique( $hook, $args, $timestamp, $schedule, $group, $unique );
91 91
 }
92 92
 
93 93
 /**
@@ -107,40 +107,40 @@  discard block
 block discarded – undo
107 107
  * @return int|null The scheduled action ID if a scheduled action was found, or null if no matching action found.
108 108
  */
109 109
 function as_unschedule_action( $hook, $args = array(), $group = '' ) {
110
-	if ( ! ActionScheduler::is_initialized( __FUNCTION__ ) ) {
111
-		return 0;
112
-	}
113
-	$params = array(
114
-		'hook'    => $hook,
115
-		'status'  => ActionScheduler_Store::STATUS_PENDING,
116
-		'orderby' => 'date',
117
-		'order'   => 'ASC',
118
-		'group'   => $group,
119
-	);
120
-	if ( is_array( $args ) ) {
121
-		$params['args'] = $args;
122
-	}
110
+    if ( ! ActionScheduler::is_initialized( __FUNCTION__ ) ) {
111
+        return 0;
112
+    }
113
+    $params = array(
114
+        'hook'    => $hook,
115
+        'status'  => ActionScheduler_Store::STATUS_PENDING,
116
+        'orderby' => 'date',
117
+        'order'   => 'ASC',
118
+        'group'   => $group,
119
+    );
120
+    if ( is_array( $args ) ) {
121
+        $params['args'] = $args;
122
+    }
123 123
 
124
-	$action_id = ActionScheduler::store()->query_action( $params );
124
+    $action_id = ActionScheduler::store()->query_action( $params );
125 125
 
126
-	if ( $action_id ) {
127
-		try {
128
-			ActionScheduler::store()->cancel_action( $action_id );
129
-		} catch ( Exception $exception ) {
130
-			ActionScheduler::logger()->log(
131
-				$action_id,
132
-				sprintf(
133
-					/* translators: %s is the name of the hook to be cancelled. */
134
-					__( 'Caught exception while cancelling action: %s', 'action-scheduler' ),
135
-					esc_attr( $hook )
136
-				)
137
-			);
126
+    if ( $action_id ) {
127
+        try {
128
+            ActionScheduler::store()->cancel_action( $action_id );
129
+        } catch ( Exception $exception ) {
130
+            ActionScheduler::logger()->log(
131
+                $action_id,
132
+                sprintf(
133
+                    /* translators: %s is the name of the hook to be cancelled. */
134
+                    __( 'Caught exception while cancelling action: %s', 'action-scheduler' ),
135
+                    esc_attr( $hook )
136
+                )
137
+            );
138 138
 
139
-			$action_id = null;
140
-		}
141
-	}
139
+            $action_id = null;
140
+        }
141
+    }
142 142
 
143
-	return $action_id;
143
+    return $action_id;
144 144
 }
145 145
 
146 146
 /**
@@ -151,22 +151,22 @@  discard block
 block discarded – undo
151 151
  * @param string $group The group the job is assigned to.
152 152
  */
153 153
 function as_unschedule_all_actions( $hook, $args = array(), $group = '' ) {
154
-	if ( ! ActionScheduler::is_initialized( __FUNCTION__ ) ) {
155
-		return;
156
-	}
157
-	if ( empty( $args ) ) {
158
-		if ( ! empty( $hook ) && empty( $group ) ) {
159
-			ActionScheduler_Store::instance()->cancel_actions_by_hook( $hook );
160
-			return;
161
-		}
162
-		if ( ! empty( $group ) && empty( $hook ) ) {
163
-			ActionScheduler_Store::instance()->cancel_actions_by_group( $group );
164
-			return;
165
-		}
166
-	}
167
-	do {
168
-		$unscheduled_action = as_unschedule_action( $hook, $args, $group );
169
-	} while ( ! empty( $unscheduled_action ) );
154
+    if ( ! ActionScheduler::is_initialized( __FUNCTION__ ) ) {
155
+        return;
156
+    }
157
+    if ( empty( $args ) ) {
158
+        if ( ! empty( $hook ) && empty( $group ) ) {
159
+            ActionScheduler_Store::instance()->cancel_actions_by_hook( $hook );
160
+            return;
161
+        }
162
+        if ( ! empty( $group ) && empty( $hook ) ) {
163
+            ActionScheduler_Store::instance()->cancel_actions_by_group( $group );
164
+            return;
165
+        }
166
+    }
167
+    do {
168
+        $unscheduled_action = as_unschedule_action( $hook, $args, $group );
169
+    } while ( ! empty( $unscheduled_action ) );
170 170
 }
171 171
 
172 172
 /**
@@ -185,42 +185,42 @@  discard block
 block discarded – undo
185 185
  * @return int|bool The timestamp for the next occurrence of a pending scheduled action, true for an async or in-progress action or false if there is no matching action.
186 186
  */
187 187
 function as_next_scheduled_action( $hook, $args = null, $group = '' ) {
188
-	if ( ! ActionScheduler::is_initialized( __FUNCTION__ ) ) {
189
-		return false;
190
-	}
188
+    if ( ! ActionScheduler::is_initialized( __FUNCTION__ ) ) {
189
+        return false;
190
+    }
191 191
 
192
-	$params = array(
193
-		'hook'    => $hook,
194
-		'orderby' => 'date',
195
-		'order'   => 'ASC',
196
-		'group'   => $group,
197
-	);
192
+    $params = array(
193
+        'hook'    => $hook,
194
+        'orderby' => 'date',
195
+        'order'   => 'ASC',
196
+        'group'   => $group,
197
+    );
198 198
 
199
-	if ( is_array( $args ) ) {
200
-		$params['args'] = $args;
201
-	}
199
+    if ( is_array( $args ) ) {
200
+        $params['args'] = $args;
201
+    }
202 202
 
203
-	$params['status'] = ActionScheduler_Store::STATUS_RUNNING;
204
-	$action_id        = ActionScheduler::store()->query_action( $params );
205
-	if ( $action_id ) {
206
-		return true;
207
-	}
203
+    $params['status'] = ActionScheduler_Store::STATUS_RUNNING;
204
+    $action_id        = ActionScheduler::store()->query_action( $params );
205
+    if ( $action_id ) {
206
+        return true;
207
+    }
208 208
 
209
-	$params['status'] = ActionScheduler_Store::STATUS_PENDING;
210
-	$action_id        = ActionScheduler::store()->query_action( $params );
211
-	if ( null === $action_id ) {
212
-		return false;
213
-	}
209
+    $params['status'] = ActionScheduler_Store::STATUS_PENDING;
210
+    $action_id        = ActionScheduler::store()->query_action( $params );
211
+    if ( null === $action_id ) {
212
+        return false;
213
+    }
214 214
 
215
-	$action         = ActionScheduler::store()->fetch_action( $action_id );
216
-	$scheduled_date = $action->get_schedule()->get_date();
217
-	if ( $scheduled_date ) {
218
-		return (int) $scheduled_date->format( 'U' );
219
-	} elseif ( null === $scheduled_date ) { // pending async action with NullSchedule.
220
-		return true;
221
-	}
215
+    $action         = ActionScheduler::store()->fetch_action( $action_id );
216
+    $scheduled_date = $action->get_schedule()->get_date();
217
+    if ( $scheduled_date ) {
218
+        return (int) $scheduled_date->format( 'U' );
219
+    } elseif ( null === $scheduled_date ) { // pending async action with NullSchedule.
220
+        return true;
221
+    }
222 222
 
223
-	return false;
223
+    return false;
224 224
 }
225 225
 
226 226
 /**
@@ -238,24 +238,24 @@  discard block
 block discarded – undo
238 238
  * @return bool True if a matching action is pending or in-progress, false otherwise.
239 239
  */
240 240
 function as_has_scheduled_action( $hook, $args = null, $group = '' ) {
241
-	if ( ! ActionScheduler::is_initialized( __FUNCTION__ ) ) {
242
-		return false;
243
-	}
241
+    if ( ! ActionScheduler::is_initialized( __FUNCTION__ ) ) {
242
+        return false;
243
+    }
244 244
 
245
-	$query_args = array(
246
-		'hook'    => $hook,
247
-		'status'  => array( ActionScheduler_Store::STATUS_RUNNING, ActionScheduler_Store::STATUS_PENDING ),
248
-		'group'   => $group,
249
-		'orderby' => 'none',
250
-	);
245
+    $query_args = array(
246
+        'hook'    => $hook,
247
+        'status'  => array( ActionScheduler_Store::STATUS_RUNNING, ActionScheduler_Store::STATUS_PENDING ),
248
+        'group'   => $group,
249
+        'orderby' => 'none',
250
+    );
251 251
 
252
-	if ( null !== $args ) {
253
-		$query_args['args'] = $args;
254
-	}
252
+    if ( null !== $args ) {
253
+        $query_args['args'] = $args;
254
+    }
255 255
 
256
-	$action_id = ActionScheduler::store()->query_action( $query_args );
256
+    $action_id = ActionScheduler::store()->query_action( $query_args );
257 257
 
258
-	return null !== $action_id;
258
+    return null !== $action_id;
259 259
 }
260 260
 
261 261
 /**
@@ -281,33 +281,33 @@  discard block
 block discarded – undo
281 281
  * @return array
282 282
  */
283 283
 function as_get_scheduled_actions( $args = array(), $return_format = OBJECT ) {
284
-	if ( ! ActionScheduler::is_initialized( __FUNCTION__ ) ) {
285
-		return array();
286
-	}
287
-	$store = ActionScheduler::store();
288
-	foreach ( array( 'date', 'modified' ) as $key ) {
289
-		if ( isset( $args[ $key ] ) ) {
290
-			$args[ $key ] = as_get_datetime_object( $args[ $key ] );
291
-		}
292
-	}
293
-	$ids = $store->query_actions( $args );
284
+    if ( ! ActionScheduler::is_initialized( __FUNCTION__ ) ) {
285
+        return array();
286
+    }
287
+    $store = ActionScheduler::store();
288
+    foreach ( array( 'date', 'modified' ) as $key ) {
289
+        if ( isset( $args[ $key ] ) ) {
290
+            $args[ $key ] = as_get_datetime_object( $args[ $key ] );
291
+        }
292
+    }
293
+    $ids = $store->query_actions( $args );
294 294
 
295
-	if ( 'ids' === $return_format || 'int' === $return_format ) {
296
-		return $ids;
297
-	}
295
+    if ( 'ids' === $return_format || 'int' === $return_format ) {
296
+        return $ids;
297
+    }
298 298
 
299
-	$actions = array();
300
-	foreach ( $ids as $action_id ) {
301
-		$actions[ $action_id ] = $store->fetch_action( $action_id );
302
-	}
299
+    $actions = array();
300
+    foreach ( $ids as $action_id ) {
301
+        $actions[ $action_id ] = $store->fetch_action( $action_id );
302
+    }
303 303
 
304
-	if ( ARRAY_A == $return_format ) {
305
-		foreach ( $actions as $action_id => $action_object ) {
306
-			$actions[ $action_id ] = get_object_vars( $action_object );
307
-		}
308
-	}
304
+    if ( ARRAY_A == $return_format ) {
305
+        foreach ( $actions as $action_id => $action_object ) {
306
+            $actions[ $action_id ] = get_object_vars( $action_object );
307
+        }
308
+    }
309 309
 
310
-	return $actions;
310
+    return $actions;
311 311
 }
312 312
 
313 313
 /**
@@ -328,12 +328,12 @@  discard block
 block discarded – undo
328 328
  * @return ActionScheduler_DateTime
329 329
  */
330 330
 function as_get_datetime_object( $date_string = null, $timezone = 'UTC' ) {
331
-	if ( is_object( $date_string ) && $date_string instanceof DateTime ) {
332
-		$date = new ActionScheduler_DateTime( $date_string->format( 'Y-m-d H:i:s' ), new DateTimeZone( $timezone ) );
333
-	} elseif ( is_numeric( $date_string ) ) {
334
-		$date = new ActionScheduler_DateTime( '@' . $date_string, new DateTimeZone( $timezone ) );
335
-	} else {
336
-		$date = new ActionScheduler_DateTime( null === $date_string ? 'now' : $date_string, new DateTimeZone( $timezone ) );
337
-	}
338
-	return $date;
331
+    if ( is_object( $date_string ) && $date_string instanceof DateTime ) {
332
+        $date = new ActionScheduler_DateTime( $date_string->format( 'Y-m-d H:i:s' ), new DateTimeZone( $timezone ) );
333
+    } elseif ( is_numeric( $date_string ) ) {
334
+        $date = new ActionScheduler_DateTime( '@' . $date_string, new DateTimeZone( $timezone ) );
335
+    } else {
336
+        $date = new ActionScheduler_DateTime( null === $date_string ? 'now' : $date_string, new DateTimeZone( $timezone ) );
337
+    }
338
+    return $date;
339 339
 }
Please login to merge, or discard this patch.
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -15,11 +15,11 @@  discard block
 block discarded – undo
15 15
  *
16 16
  * @return int The action ID.
17 17
  */
18
-function as_enqueue_async_action( $hook, $args = array(), $group = '', $unique = false ) {
19
-	if ( ! ActionScheduler::is_initialized( __FUNCTION__ ) ) {
18
+function as_enqueue_async_action($hook, $args = array(), $group = '', $unique = false) {
19
+	if ( ! ActionScheduler::is_initialized(__FUNCTION__)) {
20 20
 		return 0;
21 21
 	}
22
-	return ActionScheduler::factory()->async_unique( $hook, $args, $group, $unique );
22
+	return ActionScheduler::factory()->async_unique($hook, $args, $group, $unique);
23 23
 }
24 24
 
25 25
 /**
@@ -33,11 +33,11 @@  discard block
 block discarded – undo
33 33
  *
34 34
  * @return int The action ID.
35 35
  */
36
-function as_schedule_single_action( $timestamp, $hook, $args = array(), $group = '', $unique = false ) {
37
-	if ( ! ActionScheduler::is_initialized( __FUNCTION__ ) ) {
36
+function as_schedule_single_action($timestamp, $hook, $args = array(), $group = '', $unique = false) {
37
+	if ( ! ActionScheduler::is_initialized(__FUNCTION__)) {
38 38
 		return 0;
39 39
 	}
40
-	return ActionScheduler::factory()->single_unique( $hook, $args, $timestamp, $group, $unique );
40
+	return ActionScheduler::factory()->single_unique($hook, $args, $timestamp, $group, $unique);
41 41
 }
42 42
 
43 43
 /**
@@ -52,11 +52,11 @@  discard block
 block discarded – undo
52 52
  *
53 53
  * @return int The action ID.
54 54
  */
55
-function as_schedule_recurring_action( $timestamp, $interval_in_seconds, $hook, $args = array(), $group = '', $unique = false ) {
56
-	if ( ! ActionScheduler::is_initialized( __FUNCTION__ ) ) {
55
+function as_schedule_recurring_action($timestamp, $interval_in_seconds, $hook, $args = array(), $group = '', $unique = false) {
56
+	if ( ! ActionScheduler::is_initialized(__FUNCTION__)) {
57 57
 		return 0;
58 58
 	}
59
-	return ActionScheduler::factory()->recurring_unique( $hook, $args, $timestamp, $interval_in_seconds, $group, $unique );
59
+	return ActionScheduler::factory()->recurring_unique($hook, $args, $timestamp, $interval_in_seconds, $group, $unique);
60 60
 }
61 61
 
62 62
 /**
@@ -83,11 +83,11 @@  discard block
 block discarded – undo
83 83
  *
84 84
  * @return int The action ID.
85 85
  */
86
-function as_schedule_cron_action( $timestamp, $schedule, $hook, $args = array(), $group = '', $unique = false ) {
87
-	if ( ! ActionScheduler::is_initialized( __FUNCTION__ ) ) {
86
+function as_schedule_cron_action($timestamp, $schedule, $hook, $args = array(), $group = '', $unique = false) {
87
+	if ( ! ActionScheduler::is_initialized(__FUNCTION__)) {
88 88
 		return 0;
89 89
 	}
90
-	return ActionScheduler::factory()->cron_unique( $hook, $args, $timestamp, $schedule, $group, $unique );
90
+	return ActionScheduler::factory()->cron_unique($hook, $args, $timestamp, $schedule, $group, $unique);
91 91
 }
92 92
 
93 93
 /**
@@ -106,8 +106,8 @@  discard block
 block discarded – undo
106 106
  *
107 107
  * @return int|null The scheduled action ID if a scheduled action was found, or null if no matching action found.
108 108
  */
109
-function as_unschedule_action( $hook, $args = array(), $group = '' ) {
110
-	if ( ! ActionScheduler::is_initialized( __FUNCTION__ ) ) {
109
+function as_unschedule_action($hook, $args = array(), $group = '') {
110
+	if ( ! ActionScheduler::is_initialized(__FUNCTION__)) {
111 111
 		return 0;
112 112
 	}
113 113
 	$params = array(
@@ -117,22 +117,22 @@  discard block
 block discarded – undo
117 117
 		'order'   => 'ASC',
118 118
 		'group'   => $group,
119 119
 	);
120
-	if ( is_array( $args ) ) {
120
+	if (is_array($args)) {
121 121
 		$params['args'] = $args;
122 122
 	}
123 123
 
124
-	$action_id = ActionScheduler::store()->query_action( $params );
124
+	$action_id = ActionScheduler::store()->query_action($params);
125 125
 
126
-	if ( $action_id ) {
126
+	if ($action_id) {
127 127
 		try {
128
-			ActionScheduler::store()->cancel_action( $action_id );
129
-		} catch ( Exception $exception ) {
128
+			ActionScheduler::store()->cancel_action($action_id);
129
+		} catch (Exception $exception) {
130 130
 			ActionScheduler::logger()->log(
131 131
 				$action_id,
132 132
 				sprintf(
133 133
 					/* translators: %s is the name of the hook to be cancelled. */
134
-					__( 'Caught exception while cancelling action: %s', 'action-scheduler' ),
135
-					esc_attr( $hook )
134
+					__('Caught exception while cancelling action: %s', 'action-scheduler'),
135
+					esc_attr($hook)
136 136
 				)
137 137
 			);
138 138
 
@@ -150,23 +150,23 @@  discard block
 block discarded – undo
150 150
  * @param array  $args Args that would have been passed to the job.
151 151
  * @param string $group The group the job is assigned to.
152 152
  */
153
-function as_unschedule_all_actions( $hook, $args = array(), $group = '' ) {
154
-	if ( ! ActionScheduler::is_initialized( __FUNCTION__ ) ) {
153
+function as_unschedule_all_actions($hook, $args = array(), $group = '') {
154
+	if ( ! ActionScheduler::is_initialized(__FUNCTION__)) {
155 155
 		return;
156 156
 	}
157
-	if ( empty( $args ) ) {
158
-		if ( ! empty( $hook ) && empty( $group ) ) {
159
-			ActionScheduler_Store::instance()->cancel_actions_by_hook( $hook );
157
+	if (empty($args)) {
158
+		if ( ! empty($hook) && empty($group)) {
159
+			ActionScheduler_Store::instance()->cancel_actions_by_hook($hook);
160 160
 			return;
161 161
 		}
162
-		if ( ! empty( $group ) && empty( $hook ) ) {
163
-			ActionScheduler_Store::instance()->cancel_actions_by_group( $group );
162
+		if ( ! empty($group) && empty($hook)) {
163
+			ActionScheduler_Store::instance()->cancel_actions_by_group($group);
164 164
 			return;
165 165
 		}
166 166
 	}
167 167
 	do {
168
-		$unscheduled_action = as_unschedule_action( $hook, $args, $group );
169
-	} while ( ! empty( $unscheduled_action ) );
168
+		$unscheduled_action = as_unschedule_action($hook, $args, $group);
169
+	} while ( ! empty($unscheduled_action));
170 170
 }
171 171
 
172 172
 /**
@@ -184,8 +184,8 @@  discard block
 block discarded – undo
184 184
  *
185 185
  * @return int|bool The timestamp for the next occurrence of a pending scheduled action, true for an async or in-progress action or false if there is no matching action.
186 186
  */
187
-function as_next_scheduled_action( $hook, $args = null, $group = '' ) {
188
-	if ( ! ActionScheduler::is_initialized( __FUNCTION__ ) ) {
187
+function as_next_scheduled_action($hook, $args = null, $group = '') {
188
+	if ( ! ActionScheduler::is_initialized(__FUNCTION__)) {
189 189
 		return false;
190 190
 	}
191 191
 
@@ -196,27 +196,27 @@  discard block
 block discarded – undo
196 196
 		'group'   => $group,
197 197
 	);
198 198
 
199
-	if ( is_array( $args ) ) {
199
+	if (is_array($args)) {
200 200
 		$params['args'] = $args;
201 201
 	}
202 202
 
203 203
 	$params['status'] = ActionScheduler_Store::STATUS_RUNNING;
204
-	$action_id        = ActionScheduler::store()->query_action( $params );
205
-	if ( $action_id ) {
204
+	$action_id        = ActionScheduler::store()->query_action($params);
205
+	if ($action_id) {
206 206
 		return true;
207 207
 	}
208 208
 
209 209
 	$params['status'] = ActionScheduler_Store::STATUS_PENDING;
210
-	$action_id        = ActionScheduler::store()->query_action( $params );
211
-	if ( null === $action_id ) {
210
+	$action_id        = ActionScheduler::store()->query_action($params);
211
+	if (null === $action_id) {
212 212
 		return false;
213 213
 	}
214 214
 
215
-	$action         = ActionScheduler::store()->fetch_action( $action_id );
215
+	$action         = ActionScheduler::store()->fetch_action($action_id);
216 216
 	$scheduled_date = $action->get_schedule()->get_date();
217
-	if ( $scheduled_date ) {
218
-		return (int) $scheduled_date->format( 'U' );
219
-	} elseif ( null === $scheduled_date ) { // pending async action with NullSchedule.
217
+	if ($scheduled_date) {
218
+		return (int) $scheduled_date->format('U');
219
+	} elseif (null === $scheduled_date) { // pending async action with NullSchedule.
220 220
 		return true;
221 221
 	}
222 222
 
@@ -237,23 +237,23 @@  discard block
 block discarded – undo
237 237
  *
238 238
  * @return bool True if a matching action is pending or in-progress, false otherwise.
239 239
  */
240
-function as_has_scheduled_action( $hook, $args = null, $group = '' ) {
241
-	if ( ! ActionScheduler::is_initialized( __FUNCTION__ ) ) {
240
+function as_has_scheduled_action($hook, $args = null, $group = '') {
241
+	if ( ! ActionScheduler::is_initialized(__FUNCTION__)) {
242 242
 		return false;
243 243
 	}
244 244
 
245 245
 	$query_args = array(
246 246
 		'hook'    => $hook,
247
-		'status'  => array( ActionScheduler_Store::STATUS_RUNNING, ActionScheduler_Store::STATUS_PENDING ),
247
+		'status'  => array(ActionScheduler_Store::STATUS_RUNNING, ActionScheduler_Store::STATUS_PENDING),
248 248
 		'group'   => $group,
249 249
 		'orderby' => 'none',
250 250
 	);
251 251
 
252
-	if ( null !== $args ) {
252
+	if (null !== $args) {
253 253
 		$query_args['args'] = $args;
254 254
 	}
255 255
 
256
-	$action_id = ActionScheduler::store()->query_action( $query_args );
256
+	$action_id = ActionScheduler::store()->query_action($query_args);
257 257
 
258 258
 	return null !== $action_id;
259 259
 }
@@ -280,30 +280,30 @@  discard block
 block discarded – undo
280 280
  *
281 281
  * @return array
282 282
  */
283
-function as_get_scheduled_actions( $args = array(), $return_format = OBJECT ) {
284
-	if ( ! ActionScheduler::is_initialized( __FUNCTION__ ) ) {
283
+function as_get_scheduled_actions($args = array(), $return_format = OBJECT) {
284
+	if ( ! ActionScheduler::is_initialized(__FUNCTION__)) {
285 285
 		return array();
286 286
 	}
287 287
 	$store = ActionScheduler::store();
288
-	foreach ( array( 'date', 'modified' ) as $key ) {
289
-		if ( isset( $args[ $key ] ) ) {
290
-			$args[ $key ] = as_get_datetime_object( $args[ $key ] );
288
+	foreach (array('date', 'modified') as $key) {
289
+		if (isset($args[$key])) {
290
+			$args[$key] = as_get_datetime_object($args[$key]);
291 291
 		}
292 292
 	}
293
-	$ids = $store->query_actions( $args );
293
+	$ids = $store->query_actions($args);
294 294
 
295
-	if ( 'ids' === $return_format || 'int' === $return_format ) {
295
+	if ('ids' === $return_format || 'int' === $return_format) {
296 296
 		return $ids;
297 297
 	}
298 298
 
299 299
 	$actions = array();
300
-	foreach ( $ids as $action_id ) {
301
-		$actions[ $action_id ] = $store->fetch_action( $action_id );
300
+	foreach ($ids as $action_id) {
301
+		$actions[$action_id] = $store->fetch_action($action_id);
302 302
 	}
303 303
 
304
-	if ( ARRAY_A == $return_format ) {
305
-		foreach ( $actions as $action_id => $action_object ) {
306
-			$actions[ $action_id ] = get_object_vars( $action_object );
304
+	if (ARRAY_A == $return_format) {
305
+		foreach ($actions as $action_id => $action_object) {
306
+			$actions[$action_id] = get_object_vars($action_object);
307 307
 		}
308 308
 	}
309 309
 
@@ -327,13 +327,13 @@  discard block
 block discarded – undo
327 327
  *
328 328
  * @return ActionScheduler_DateTime
329 329
  */
330
-function as_get_datetime_object( $date_string = null, $timezone = 'UTC' ) {
331
-	if ( is_object( $date_string ) && $date_string instanceof DateTime ) {
332
-		$date = new ActionScheduler_DateTime( $date_string->format( 'Y-m-d H:i:s' ), new DateTimeZone( $timezone ) );
333
-	} elseif ( is_numeric( $date_string ) ) {
334
-		$date = new ActionScheduler_DateTime( '@' . $date_string, new DateTimeZone( $timezone ) );
330
+function as_get_datetime_object($date_string = null, $timezone = 'UTC') {
331
+	if (is_object($date_string) && $date_string instanceof DateTime) {
332
+		$date = new ActionScheduler_DateTime($date_string->format('Y-m-d H:i:s'), new DateTimeZone($timezone));
333
+	} elseif (is_numeric($date_string)) {
334
+		$date = new ActionScheduler_DateTime('@'.$date_string, new DateTimeZone($timezone));
335 335
 	} else {
336
-		$date = new ActionScheduler_DateTime( null === $date_string ? 'now' : $date_string, new DateTimeZone( $timezone ) );
336
+		$date = new ActionScheduler_DateTime(null === $date_string ? 'now' : $date_string, new DateTimeZone($timezone));
337 337
 	}
338 338
 	return $date;
339 339
 }
Please login to merge, or discard this patch.