Passed
Push — main ( aaef5c...e4c121 )
by TARIQ
71:39
created
packages/woocommerce-blocks/vendor/composer/jetpack_autoload_psr4.php 2 patches
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -6,24 +6,24 @@
 block discarded – undo
6 6
 $baseDir   = dirname($vendorDir);
7 7
 
8 8
 return array(
9
-	'Composer\\Installers\\' => array(
10
-		'version' => '1.12.0.0',
11
-		'path'    => array( $vendorDir . '/composer/installers/src/Composer/Installers' )
12
-	),
13
-	'Automattic\\WooCommerce\\StoreApi\\' => array(
14
-		'version' => '8.0.0.0',
15
-		'path'    => array( $baseDir . '/src/StoreApi' )
16
-	),
17
-	'Automattic\\WooCommerce\\Blocks\\Tests\\' => array(
18
-		'version' => '8.0.0.0',
19
-		'path'    => array( $baseDir . '/tests/php' )
20
-	),
21
-	'Automattic\\WooCommerce\\Blocks\\' => array(
22
-		'version' => '8.0.0.0',
23
-		'path'    => array( $baseDir . '/src' )
24
-	),
25
-	'Automattic\\Jetpack\\Autoloader\\' => array(
26
-		'version' => '2.10.7.0',
27
-		'path'    => array( $vendorDir . '/automattic/jetpack-autoloader/src' )
28
-	),
9
+    'Composer\\Installers\\' => array(
10
+        'version' => '1.12.0.0',
11
+        'path'    => array( $vendorDir . '/composer/installers/src/Composer/Installers' )
12
+    ),
13
+    'Automattic\\WooCommerce\\StoreApi\\' => array(
14
+        'version' => '8.0.0.0',
15
+        'path'    => array( $baseDir . '/src/StoreApi' )
16
+    ),
17
+    'Automattic\\WooCommerce\\Blocks\\Tests\\' => array(
18
+        'version' => '8.0.0.0',
19
+        'path'    => array( $baseDir . '/tests/php' )
20
+    ),
21
+    'Automattic\\WooCommerce\\Blocks\\' => array(
22
+        'version' => '8.0.0.0',
23
+        'path'    => array( $baseDir . '/src' )
24
+    ),
25
+    'Automattic\\Jetpack\\Autoloader\\' => array(
26
+        'version' => '2.10.7.0',
27
+        'path'    => array( $vendorDir . '/automattic/jetpack-autoloader/src' )
28
+    ),
29 29
 );
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -8,22 +8,22 @@
 block discarded – undo
8 8
 return array(
9 9
 	'Composer\\Installers\\' => array(
10 10
 		'version' => '1.12.0.0',
11
-		'path'    => array( $vendorDir . '/composer/installers/src/Composer/Installers' )
11
+		'path'    => array($vendorDir . '/composer/installers/src/Composer/Installers')
12 12
 	),
13 13
 	'Automattic\\WooCommerce\\StoreApi\\' => array(
14 14
 		'version' => '8.0.0.0',
15
-		'path'    => array( $baseDir . '/src/StoreApi' )
15
+		'path'    => array($baseDir . '/src/StoreApi')
16 16
 	),
17 17
 	'Automattic\\WooCommerce\\Blocks\\Tests\\' => array(
18 18
 		'version' => '8.0.0.0',
19
-		'path'    => array( $baseDir . '/tests/php' )
19
+		'path'    => array($baseDir . '/tests/php')
20 20
 	),
21 21
 	'Automattic\\WooCommerce\\Blocks\\' => array(
22 22
 		'version' => '8.0.0.0',
23
-		'path'    => array( $baseDir . '/src' )
23
+		'path'    => array($baseDir . '/src')
24 24
 	),
25 25
 	'Automattic\\Jetpack\\Autoloader\\' => array(
26 26
 		'version' => '2.10.7.0',
27
-		'path'    => array( $vendorDir . '/automattic/jetpack-autoloader/src' )
27
+		'path'    => array($vendorDir . '/automattic/jetpack-autoloader/src')
28 28
 	),
29 29
 );
Please login to merge, or discard this patch.
packages/woocommerce-blocks/vendor/jetpack-autoloader/class-container.php 2 patches
Indentation   +131 added lines, -131 removed lines patch added patch discarded remove patch
@@ -7,144 +7,144 @@
 block discarded – undo
7 7
 
8 8
 namespace Automattic\Jetpack\Autoloader\jp526c9128fcc85a1cd942451999a66eb0;
9 9
 
10
- // phpcs:ignore
10
+    // phpcs:ignore
11 11
 
12 12
 /**
13 13
  * This class manages the files and dependencies of the autoloader.
14 14
  */
15 15
 class Container {
16 16
 
17
-	/**
18
-	 * Since each autoloader's class files exist within their own namespace we need a map to
19
-	 * convert between the local class and a shared key. Note that no version checking is
20
-	 * performed on these dependencies and the first autoloader to register will be the
21
-	 * one that is utilized.
22
-	 */
23
-	const SHARED_DEPENDENCY_KEYS = array(
24
-		Hook_Manager::class => 'Hook_Manager',
25
-	);
26
-
27
-	/**
28
-	 * A map of all the dependencies we've registered with the container and created.
29
-	 *
30
-	 * @var array
31
-	 */
32
-	protected $dependencies;
33
-
34
-	/**
35
-	 * The constructor.
36
-	 */
37
-	public function __construct() {
38
-		$this->dependencies = array();
39
-
40
-		$this->register_shared_dependencies();
41
-		$this->register_dependencies();
42
-		$this->initialize_globals();
43
-	}
44
-
45
-	/**
46
-	 * Gets a dependency out of the container.
47
-	 *
48
-	 * @param string $class The class to fetch.
49
-	 *
50
-	 * @return mixed
51
-	 * @throws \InvalidArgumentException When a class that isn't registered with the container is fetched.
52
-	 */
53
-	public function get( $class ) {
54
-		if ( ! isset( $this->dependencies[ $class ] ) ) {
55
-			throw new \InvalidArgumentException( "Class '$class' is not registered with the container." );
56
-		}
57
-
58
-		return $this->dependencies[ $class ];
59
-	}
60
-
61
-	/**
62
-	 * Registers all of the dependencies that are shared between all instances of the autoloader.
63
-	 */
64
-	private function register_shared_dependencies() {
65
-		global $jetpack_autoloader_container_shared;
66
-		if ( ! isset( $jetpack_autoloader_container_shared ) ) {
67
-			$jetpack_autoloader_container_shared = array();
68
-		}
69
-
70
-		$key = self::SHARED_DEPENDENCY_KEYS[ Hook_Manager::class ];
71
-		if ( ! isset( $jetpack_autoloader_container_shared[ $key ] ) ) {
72
-			require_once __DIR__ . '/class-hook-manager.php';
73
-			$jetpack_autoloader_container_shared[ $key ] = new Hook_Manager();
74
-		}
75
-		$this->dependencies[ Hook_Manager::class ] = &$jetpack_autoloader_container_shared[ $key ];
76
-	}
77
-
78
-	/**
79
-	 * Registers all of the dependencies with the container.
80
-	 */
81
-	private function register_dependencies() {
82
-		require_once __DIR__ . '/class-path-processor.php';
83
-		$this->dependencies[ Path_Processor::class ] = new Path_Processor();
84
-
85
-		require_once __DIR__ . '/class-plugin-locator.php';
86
-		$this->dependencies[ Plugin_Locator::class ] = new Plugin_Locator(
87
-			$this->get( Path_Processor::class )
88
-		);
89
-
90
-		require_once __DIR__ . '/class-version-selector.php';
91
-		$this->dependencies[ Version_Selector::class ] = new Version_Selector();
92
-
93
-		require_once __DIR__ . '/class-autoloader-locator.php';
94
-		$this->dependencies[ Autoloader_Locator::class ] = new Autoloader_Locator(
95
-			$this->get( Version_Selector::class )
96
-		);
97
-
98
-		require_once __DIR__ . '/class-php-autoloader.php';
99
-		$this->dependencies[ PHP_Autoloader::class ] = new PHP_Autoloader();
100
-
101
-		require_once __DIR__ . '/class-manifest-reader.php';
102
-		$this->dependencies[ Manifest_Reader::class ] = new Manifest_Reader(
103
-			$this->get( Version_Selector::class )
104
-		);
105
-
106
-		require_once __DIR__ . '/class-plugins-handler.php';
107
-		$this->dependencies[ Plugins_Handler::class ] = new Plugins_Handler(
108
-			$this->get( Plugin_Locator::class ),
109
-			$this->get( Path_Processor::class )
110
-		);
111
-
112
-		require_once __DIR__ . '/class-autoloader-handler.php';
113
-		$this->dependencies[ Autoloader_Handler::class ] = new Autoloader_Handler(
114
-			$this->get( PHP_Autoloader::class ),
115
-			$this->get( Hook_Manager::class ),
116
-			$this->get( Manifest_Reader::class ),
117
-			$this->get( Version_Selector::class )
118
-		);
119
-
120
-		require_once __DIR__ . '/class-latest-autoloader-guard.php';
121
-		$this->dependencies[ Latest_Autoloader_Guard::class ] = new Latest_Autoloader_Guard(
122
-			$this->get( Plugins_Handler::class ),
123
-			$this->get( Autoloader_Handler::class ),
124
-			$this->get( Autoloader_Locator::class )
125
-		);
126
-
127
-		// Register any classes that we will use elsewhere.
128
-		require_once __DIR__ . '/class-version-loader.php';
129
-		require_once __DIR__ . '/class-shutdown-handler.php';
130
-	}
131
-
132
-	/**
133
-	 * Initializes any of the globals needed by the autoloader.
134
-	 */
135
-	private function initialize_globals() {
136
-		/*
17
+    /**
18
+     * Since each autoloader's class files exist within their own namespace we need a map to
19
+     * convert between the local class and a shared key. Note that no version checking is
20
+     * performed on these dependencies and the first autoloader to register will be the
21
+     * one that is utilized.
22
+     */
23
+    const SHARED_DEPENDENCY_KEYS = array(
24
+        Hook_Manager::class => 'Hook_Manager',
25
+    );
26
+
27
+    /**
28
+     * A map of all the dependencies we've registered with the container and created.
29
+     *
30
+     * @var array
31
+     */
32
+    protected $dependencies;
33
+
34
+    /**
35
+     * The constructor.
36
+     */
37
+    public function __construct() {
38
+        $this->dependencies = array();
39
+
40
+        $this->register_shared_dependencies();
41
+        $this->register_dependencies();
42
+        $this->initialize_globals();
43
+    }
44
+
45
+    /**
46
+     * Gets a dependency out of the container.
47
+     *
48
+     * @param string $class The class to fetch.
49
+     *
50
+     * @return mixed
51
+     * @throws \InvalidArgumentException When a class that isn't registered with the container is fetched.
52
+     */
53
+    public function get( $class ) {
54
+        if ( ! isset( $this->dependencies[ $class ] ) ) {
55
+            throw new \InvalidArgumentException( "Class '$class' is not registered with the container." );
56
+        }
57
+
58
+        return $this->dependencies[ $class ];
59
+    }
60
+
61
+    /**
62
+     * Registers all of the dependencies that are shared between all instances of the autoloader.
63
+     */
64
+    private function register_shared_dependencies() {
65
+        global $jetpack_autoloader_container_shared;
66
+        if ( ! isset( $jetpack_autoloader_container_shared ) ) {
67
+            $jetpack_autoloader_container_shared = array();
68
+        }
69
+
70
+        $key = self::SHARED_DEPENDENCY_KEYS[ Hook_Manager::class ];
71
+        if ( ! isset( $jetpack_autoloader_container_shared[ $key ] ) ) {
72
+            require_once __DIR__ . '/class-hook-manager.php';
73
+            $jetpack_autoloader_container_shared[ $key ] = new Hook_Manager();
74
+        }
75
+        $this->dependencies[ Hook_Manager::class ] = &$jetpack_autoloader_container_shared[ $key ];
76
+    }
77
+
78
+    /**
79
+     * Registers all of the dependencies with the container.
80
+     */
81
+    private function register_dependencies() {
82
+        require_once __DIR__ . '/class-path-processor.php';
83
+        $this->dependencies[ Path_Processor::class ] = new Path_Processor();
84
+
85
+        require_once __DIR__ . '/class-plugin-locator.php';
86
+        $this->dependencies[ Plugin_Locator::class ] = new Plugin_Locator(
87
+            $this->get( Path_Processor::class )
88
+        );
89
+
90
+        require_once __DIR__ . '/class-version-selector.php';
91
+        $this->dependencies[ Version_Selector::class ] = new Version_Selector();
92
+
93
+        require_once __DIR__ . '/class-autoloader-locator.php';
94
+        $this->dependencies[ Autoloader_Locator::class ] = new Autoloader_Locator(
95
+            $this->get( Version_Selector::class )
96
+        );
97
+
98
+        require_once __DIR__ . '/class-php-autoloader.php';
99
+        $this->dependencies[ PHP_Autoloader::class ] = new PHP_Autoloader();
100
+
101
+        require_once __DIR__ . '/class-manifest-reader.php';
102
+        $this->dependencies[ Manifest_Reader::class ] = new Manifest_Reader(
103
+            $this->get( Version_Selector::class )
104
+        );
105
+
106
+        require_once __DIR__ . '/class-plugins-handler.php';
107
+        $this->dependencies[ Plugins_Handler::class ] = new Plugins_Handler(
108
+            $this->get( Plugin_Locator::class ),
109
+            $this->get( Path_Processor::class )
110
+        );
111
+
112
+        require_once __DIR__ . '/class-autoloader-handler.php';
113
+        $this->dependencies[ Autoloader_Handler::class ] = new Autoloader_Handler(
114
+            $this->get( PHP_Autoloader::class ),
115
+            $this->get( Hook_Manager::class ),
116
+            $this->get( Manifest_Reader::class ),
117
+            $this->get( Version_Selector::class )
118
+        );
119
+
120
+        require_once __DIR__ . '/class-latest-autoloader-guard.php';
121
+        $this->dependencies[ Latest_Autoloader_Guard::class ] = new Latest_Autoloader_Guard(
122
+            $this->get( Plugins_Handler::class ),
123
+            $this->get( Autoloader_Handler::class ),
124
+            $this->get( Autoloader_Locator::class )
125
+        );
126
+
127
+        // Register any classes that we will use elsewhere.
128
+        require_once __DIR__ . '/class-version-loader.php';
129
+        require_once __DIR__ . '/class-shutdown-handler.php';
130
+    }
131
+
132
+    /**
133
+     * Initializes any of the globals needed by the autoloader.
134
+     */
135
+    private function initialize_globals() {
136
+        /*
137 137
 		 * This global was retired in version 2.9. The value is set to 'false' to maintain
138 138
 		 * compatibility with older versions of the autoloader.
139 139
 		 */
140
-		global $jetpack_autoloader_including_latest;
141
-		$jetpack_autoloader_including_latest = false;
142
-
143
-		// Not all plugins can be found using the locator. In cases where a plugin loads the autoloader
144
-		// but was not discoverable, we will record them in this array to track them as "active".
145
-		global $jetpack_autoloader_activating_plugins_paths;
146
-		if ( ! isset( $jetpack_autoloader_activating_plugins_paths ) ) {
147
-			$jetpack_autoloader_activating_plugins_paths = array();
148
-		}
149
-	}
140
+        global $jetpack_autoloader_including_latest;
141
+        $jetpack_autoloader_including_latest = false;
142
+
143
+        // Not all plugins can be found using the locator. In cases where a plugin loads the autoloader
144
+        // but was not discoverable, we will record them in this array to track them as "active".
145
+        global $jetpack_autoloader_activating_plugins_paths;
146
+        if ( ! isset( $jetpack_autoloader_activating_plugins_paths ) ) {
147
+            $jetpack_autoloader_activating_plugins_paths = array();
148
+        }
149
+    }
150 150
 }
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -42,12 +42,12 @@  discard block
 block discarded – undo
42 42
 	 * @return mixed
43 43
 	 * @throws \InvalidArgumentException When a class that isn't registered with the container is fetched.
44 44
 	 */
45
-	public function get( $class ) {
46
-		if ( ! isset( $this->dependencies[ $class ] ) ) {
47
-			throw new \InvalidArgumentException( "Class '$class' is not registered with the container." );
45
+	public function get($class) {
46
+		if (!isset($this->dependencies[$class])) {
47
+			throw new \InvalidArgumentException("Class '$class' is not registered with the container.");
48 48
 		}
49 49
 
50
-		return $this->dependencies[ $class ];
50
+		return $this->dependencies[$class];
51 51
 	}
52 52
 
53 53
 	/**
@@ -55,16 +55,16 @@  discard block
 block discarded – undo
55 55
 	 */
56 56
 	private function register_shared_dependencies() {
57 57
 		global $jetpack_autoloader_container_shared;
58
-		if ( ! isset( $jetpack_autoloader_container_shared ) ) {
58
+		if (!isset($jetpack_autoloader_container_shared)) {
59 59
 			$jetpack_autoloader_container_shared = array();
60 60
 		}
61 61
 
62
-		$key = self::SHARED_DEPENDENCY_KEYS[ Hook_Manager::class ];
63
-		if ( ! isset( $jetpack_autoloader_container_shared[ $key ] ) ) {
62
+		$key = self::SHARED_DEPENDENCY_KEYS[Hook_Manager::class];
63
+		if (!isset($jetpack_autoloader_container_shared[$key])) {
64 64
 			require_once __DIR__ . '/class-hook-manager.php';
65
-			$jetpack_autoloader_container_shared[ $key ] = new Hook_Manager();
65
+			$jetpack_autoloader_container_shared[$key] = new Hook_Manager();
66 66
 		}
67
-		$this->dependencies[ Hook_Manager::class ] = &$jetpack_autoloader_container_shared[ $key ];
67
+		$this->dependencies[Hook_Manager::class] = &$jetpack_autoloader_container_shared[$key];
68 68
 	}
69 69
 
70 70
 	/**
@@ -72,48 +72,48 @@  discard block
 block discarded – undo
72 72
 	 */
73 73
 	private function register_dependencies() {
74 74
 		require_once __DIR__ . '/class-path-processor.php';
75
-		$this->dependencies[ Path_Processor::class ] = new Path_Processor();
75
+		$this->dependencies[Path_Processor::class] = new Path_Processor();
76 76
 
77 77
 		require_once __DIR__ . '/class-plugin-locator.php';
78
-		$this->dependencies[ Plugin_Locator::class ] = new Plugin_Locator(
79
-			$this->get( Path_Processor::class )
78
+		$this->dependencies[Plugin_Locator::class] = new Plugin_Locator(
79
+			$this->get(Path_Processor::class)
80 80
 		);
81 81
 
82 82
 		require_once __DIR__ . '/class-version-selector.php';
83
-		$this->dependencies[ Version_Selector::class ] = new Version_Selector();
83
+		$this->dependencies[Version_Selector::class] = new Version_Selector();
84 84
 
85 85
 		require_once __DIR__ . '/class-autoloader-locator.php';
86
-		$this->dependencies[ Autoloader_Locator::class ] = new Autoloader_Locator(
87
-			$this->get( Version_Selector::class )
86
+		$this->dependencies[Autoloader_Locator::class] = new Autoloader_Locator(
87
+			$this->get(Version_Selector::class)
88 88
 		);
89 89
 
90 90
 		require_once __DIR__ . '/class-php-autoloader.php';
91
-		$this->dependencies[ PHP_Autoloader::class ] = new PHP_Autoloader();
91
+		$this->dependencies[PHP_Autoloader::class] = new PHP_Autoloader();
92 92
 
93 93
 		require_once __DIR__ . '/class-manifest-reader.php';
94
-		$this->dependencies[ Manifest_Reader::class ] = new Manifest_Reader(
95
-			$this->get( Version_Selector::class )
94
+		$this->dependencies[Manifest_Reader::class] = new Manifest_Reader(
95
+			$this->get(Version_Selector::class)
96 96
 		);
97 97
 
98 98
 		require_once __DIR__ . '/class-plugins-handler.php';
99
-		$this->dependencies[ Plugins_Handler::class ] = new Plugins_Handler(
100
-			$this->get( Plugin_Locator::class ),
101
-			$this->get( Path_Processor::class )
99
+		$this->dependencies[Plugins_Handler::class] = new Plugins_Handler(
100
+			$this->get(Plugin_Locator::class),
101
+			$this->get(Path_Processor::class)
102 102
 		);
103 103
 
104 104
 		require_once __DIR__ . '/class-autoloader-handler.php';
105
-		$this->dependencies[ Autoloader_Handler::class ] = new Autoloader_Handler(
106
-			$this->get( PHP_Autoloader::class ),
107
-			$this->get( Hook_Manager::class ),
108
-			$this->get( Manifest_Reader::class ),
109
-			$this->get( Version_Selector::class )
105
+		$this->dependencies[Autoloader_Handler::class] = new Autoloader_Handler(
106
+			$this->get(PHP_Autoloader::class),
107
+			$this->get(Hook_Manager::class),
108
+			$this->get(Manifest_Reader::class),
109
+			$this->get(Version_Selector::class)
110 110
 		);
111 111
 
112 112
 		require_once __DIR__ . '/class-latest-autoloader-guard.php';
113
-		$this->dependencies[ Latest_Autoloader_Guard::class ] = new Latest_Autoloader_Guard(
114
-			$this->get( Plugins_Handler::class ),
115
-			$this->get( Autoloader_Handler::class ),
116
-			$this->get( Autoloader_Locator::class )
113
+		$this->dependencies[Latest_Autoloader_Guard::class] = new Latest_Autoloader_Guard(
114
+			$this->get(Plugins_Handler::class),
115
+			$this->get(Autoloader_Handler::class),
116
+			$this->get(Autoloader_Locator::class)
117 117
 		);
118 118
 
119 119
 		// Register any classes that we will use elsewhere.
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 		// Not all plugins can be found using the locator. In cases where a plugin loads the autoloader
136 136
 		// but was not discoverable, we will record them in this array to track them as "active".
137 137
 		global $jetpack_autoloader_activating_plugins_paths;
138
-		if ( ! isset( $jetpack_autoloader_activating_plugins_paths ) ) {
138
+		if (!isset($jetpack_autoloader_activating_plugins_paths)) {
139 139
 			$jetpack_autoloader_activating_plugins_paths = array();
140 140
 		}
141 141
 	}
Please login to merge, or discard this patch.
woocommerce-blocks/vendor/jetpack-autoloader/class-plugin-locator.php 2 patches
Indentation   +137 added lines, -137 removed lines patch added patch discarded remove patch
@@ -7,147 +7,147 @@
 block discarded – undo
7 7
 
8 8
 namespace Automattic\Jetpack\Autoloader\jp526c9128fcc85a1cd942451999a66eb0;
9 9
 
10
- // phpcs:ignore
10
+    // phpcs:ignore
11 11
 
12 12
 /**
13 13
  * This class scans the WordPress installation to find active plugins.
14 14
  */
15 15
 class Plugin_Locator {
16 16
 
17
-	/**
18
-	 * The path processor for finding plugin paths.
19
-	 *
20
-	 * @var Path_Processor
21
-	 */
22
-	private $path_processor;
23
-
24
-	/**
25
-	 * The constructor.
26
-	 *
27
-	 * @param Path_Processor $path_processor The Path_Processor instance.
28
-	 */
29
-	public function __construct( $path_processor ) {
30
-		$this->path_processor = $path_processor;
31
-	}
32
-
33
-	/**
34
-	 * Finds the path to the current plugin.
35
-	 *
36
-	 * @return string $path The path to the current plugin.
37
-	 *
38
-	 * @throws \RuntimeException If the current plugin does not have an autoloader.
39
-	 */
40
-	public function find_current_plugin() {
41
-		// Escape from `vendor/__DIR__` to root plugin directory.
42
-		$plugin_directory = dirname( dirname( __DIR__ ) );
43
-
44
-		// Use the path processor to ensure that this is an autoloader we're referencing.
45
-		$path = $this->path_processor->find_directory_with_autoloader( $plugin_directory, array() );
46
-		if ( false === $path ) {
47
-			throw new \RuntimeException( 'Failed to locate plugin ' . $plugin_directory );
48
-		}
49
-
50
-		return $path;
51
-	}
52
-
53
-	/**
54
-	 * Checks a given option for plugin paths.
55
-	 *
56
-	 * @param string $option_name  The option that we want to check for plugin information.
57
-	 * @param bool   $site_option  Indicates whether or not we want to check the site option.
58
-	 *
59
-	 * @return array $plugin_paths The list of absolute paths we've found.
60
-	 */
61
-	public function find_using_option( $option_name, $site_option = false ) {
62
-		$raw = $site_option ? get_site_option( $option_name ) : get_option( $option_name );
63
-		if ( false === $raw ) {
64
-			return array();
65
-		}
66
-
67
-		return $this->convert_plugins_to_paths( $raw );
68
-	}
69
-
70
-	/**
71
-	 * Checks for plugins in the `action` request parameter.
72
-	 *
73
-	 * @param string[] $allowed_actions The actions that we're allowed to return plugins for.
74
-	 *
75
-	 * @return array $plugin_paths The list of absolute paths we've found.
76
-	 */
77
-	public function find_using_request_action( $allowed_actions ) {
78
-		// phpcs:disable WordPress.Security.NonceVerification.Recommended
79
-
80
-		/**
81
-		 * Note: we're not actually checking the nonce here because it's too early
82
-		 * in the execution. The pluggable functions are not yet loaded to give
83
-		 * plugins a chance to plug their versions. Therefore we're doing the bare
84
-		 * minimum: checking whether the nonce exists and it's in the right place.
85
-		 * The request will fail later if the nonce doesn't pass the check.
86
-		 */
87
-		if ( empty( $_REQUEST['_wpnonce'] ) ) {
88
-			return array();
89
-		}
90
-
91
-		$action = isset( $_REQUEST['action'] ) ? wp_unslash( $_REQUEST['action'] ) : false;
92
-		if ( ! in_array( $action, $allowed_actions, true ) ) {
93
-			return array();
94
-		}
95
-
96
-		$plugin_slugs = array();
97
-		switch ( $action ) {
98
-			case 'activate':
99
-			case 'deactivate':
100
-				if ( empty( $_REQUEST['plugin'] ) ) {
101
-					break;
102
-				}
103
-
104
-				$plugin_slugs[] = wp_unslash( $_REQUEST['plugin'] );
105
-				break;
106
-
107
-			case 'activate-selected':
108
-			case 'deactivate-selected':
109
-				if ( empty( $_REQUEST['checked'] ) ) {
110
-					break;
111
-				}
112
-
113
-				$plugin_slugs = wp_unslash( $_REQUEST['checked'] );
114
-				break;
115
-		}
116
-
117
-		// phpcs:enable WordPress.Security.NonceVerification.Recommended
118
-		return $this->convert_plugins_to_paths( $plugin_slugs );
119
-	}
120
-
121
-	/**
122
-	 * Given an array of plugin slugs or paths, this will convert them to absolute paths and filter
123
-	 * out the plugins that are not directory plugins. Note that array keys will also be included
124
-	 * if they are plugin paths!
125
-	 *
126
-	 * @param string[] $plugins Plugin paths or slugs to filter.
127
-	 *
128
-	 * @return string[]
129
-	 */
130
-	private function convert_plugins_to_paths( $plugins ) {
131
-		if ( ! is_array( $plugins ) || empty( $plugins ) ) {
132
-			return array();
133
-		}
134
-
135
-		// We're going to look for plugins in the standard directories.
136
-		$path_constants = array( WP_PLUGIN_DIR, WPMU_PLUGIN_DIR );
137
-
138
-		$plugin_paths = array();
139
-		foreach ( $plugins as $key => $value ) {
140
-			$path = $this->path_processor->find_directory_with_autoloader( $key, $path_constants );
141
-			if ( $path ) {
142
-				$plugin_paths[] = $path;
143
-			}
144
-
145
-			$path = $this->path_processor->find_directory_with_autoloader( $value, $path_constants );
146
-			if ( $path ) {
147
-				$plugin_paths[] = $path;
148
-			}
149
-		}
150
-
151
-		return $plugin_paths;
152
-	}
17
+    /**
18
+     * The path processor for finding plugin paths.
19
+     *
20
+     * @var Path_Processor
21
+     */
22
+    private $path_processor;
23
+
24
+    /**
25
+     * The constructor.
26
+     *
27
+     * @param Path_Processor $path_processor The Path_Processor instance.
28
+     */
29
+    public function __construct( $path_processor ) {
30
+        $this->path_processor = $path_processor;
31
+    }
32
+
33
+    /**
34
+     * Finds the path to the current plugin.
35
+     *
36
+     * @return string $path The path to the current plugin.
37
+     *
38
+     * @throws \RuntimeException If the current plugin does not have an autoloader.
39
+     */
40
+    public function find_current_plugin() {
41
+        // Escape from `vendor/__DIR__` to root plugin directory.
42
+        $plugin_directory = dirname( dirname( __DIR__ ) );
43
+
44
+        // Use the path processor to ensure that this is an autoloader we're referencing.
45
+        $path = $this->path_processor->find_directory_with_autoloader( $plugin_directory, array() );
46
+        if ( false === $path ) {
47
+            throw new \RuntimeException( 'Failed to locate plugin ' . $plugin_directory );
48
+        }
49
+
50
+        return $path;
51
+    }
52
+
53
+    /**
54
+     * Checks a given option for plugin paths.
55
+     *
56
+     * @param string $option_name  The option that we want to check for plugin information.
57
+     * @param bool   $site_option  Indicates whether or not we want to check the site option.
58
+     *
59
+     * @return array $plugin_paths The list of absolute paths we've found.
60
+     */
61
+    public function find_using_option( $option_name, $site_option = false ) {
62
+        $raw = $site_option ? get_site_option( $option_name ) : get_option( $option_name );
63
+        if ( false === $raw ) {
64
+            return array();
65
+        }
66
+
67
+        return $this->convert_plugins_to_paths( $raw );
68
+    }
69
+
70
+    /**
71
+     * Checks for plugins in the `action` request parameter.
72
+     *
73
+     * @param string[] $allowed_actions The actions that we're allowed to return plugins for.
74
+     *
75
+     * @return array $plugin_paths The list of absolute paths we've found.
76
+     */
77
+    public function find_using_request_action( $allowed_actions ) {
78
+        // phpcs:disable WordPress.Security.NonceVerification.Recommended
79
+
80
+        /**
81
+         * Note: we're not actually checking the nonce here because it's too early
82
+         * in the execution. The pluggable functions are not yet loaded to give
83
+         * plugins a chance to plug their versions. Therefore we're doing the bare
84
+         * minimum: checking whether the nonce exists and it's in the right place.
85
+         * The request will fail later if the nonce doesn't pass the check.
86
+         */
87
+        if ( empty( $_REQUEST['_wpnonce'] ) ) {
88
+            return array();
89
+        }
90
+
91
+        $action = isset( $_REQUEST['action'] ) ? wp_unslash( $_REQUEST['action'] ) : false;
92
+        if ( ! in_array( $action, $allowed_actions, true ) ) {
93
+            return array();
94
+        }
95
+
96
+        $plugin_slugs = array();
97
+        switch ( $action ) {
98
+            case 'activate':
99
+            case 'deactivate':
100
+                if ( empty( $_REQUEST['plugin'] ) ) {
101
+                    break;
102
+                }
103
+
104
+                $plugin_slugs[] = wp_unslash( $_REQUEST['plugin'] );
105
+                break;
106
+
107
+            case 'activate-selected':
108
+            case 'deactivate-selected':
109
+                if ( empty( $_REQUEST['checked'] ) ) {
110
+                    break;
111
+                }
112
+
113
+                $plugin_slugs = wp_unslash( $_REQUEST['checked'] );
114
+                break;
115
+        }
116
+
117
+        // phpcs:enable WordPress.Security.NonceVerification.Recommended
118
+        return $this->convert_plugins_to_paths( $plugin_slugs );
119
+    }
120
+
121
+    /**
122
+     * Given an array of plugin slugs or paths, this will convert them to absolute paths and filter
123
+     * out the plugins that are not directory plugins. Note that array keys will also be included
124
+     * if they are plugin paths!
125
+     *
126
+     * @param string[] $plugins Plugin paths or slugs to filter.
127
+     *
128
+     * @return string[]
129
+     */
130
+    private function convert_plugins_to_paths( $plugins ) {
131
+        if ( ! is_array( $plugins ) || empty( $plugins ) ) {
132
+            return array();
133
+        }
134
+
135
+        // We're going to look for plugins in the standard directories.
136
+        $path_constants = array( WP_PLUGIN_DIR, WPMU_PLUGIN_DIR );
137
+
138
+        $plugin_paths = array();
139
+        foreach ( $plugins as $key => $value ) {
140
+            $path = $this->path_processor->find_directory_with_autoloader( $key, $path_constants );
141
+            if ( $path ) {
142
+                $plugin_paths[] = $path;
143
+            }
144
+
145
+            $path = $this->path_processor->find_directory_with_autoloader( $value, $path_constants );
146
+            if ( $path ) {
147
+                $plugin_paths[] = $path;
148
+            }
149
+        }
150
+
151
+        return $plugin_paths;
152
+    }
153 153
 }
Please login to merge, or discard this patch.
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 	 *
19 19
 	 * @param Path_Processor $path_processor The Path_Processor instance.
20 20
 	 */
21
-	public function __construct( $path_processor ) {
21
+	public function __construct($path_processor) {
22 22
 		$this->path_processor = $path_processor;
23 23
 	}
24 24
 
@@ -31,12 +31,12 @@  discard block
 block discarded – undo
31 31
 	 */
32 32
 	public function find_current_plugin() {
33 33
 		// Escape from `vendor/__DIR__` to root plugin directory.
34
-		$plugin_directory = dirname( dirname( __DIR__ ) );
34
+		$plugin_directory = dirname(dirname(__DIR__));
35 35
 
36 36
 		// Use the path processor to ensure that this is an autoloader we're referencing.
37
-		$path = $this->path_processor->find_directory_with_autoloader( $plugin_directory, array() );
38
-		if ( false === $path ) {
39
-			throw new \RuntimeException( 'Failed to locate plugin ' . $plugin_directory );
37
+		$path = $this->path_processor->find_directory_with_autoloader($plugin_directory, array());
38
+		if (false === $path) {
39
+			throw new \RuntimeException('Failed to locate plugin ' . $plugin_directory);
40 40
 		}
41 41
 
42 42
 		return $path;
@@ -50,13 +50,13 @@  discard block
 block discarded – undo
50 50
 	 *
51 51
 	 * @return array $plugin_paths The list of absolute paths we've found.
52 52
 	 */
53
-	public function find_using_option( $option_name, $site_option = false ) {
54
-		$raw = $site_option ? get_site_option( $option_name ) : get_option( $option_name );
55
-		if ( false === $raw ) {
53
+	public function find_using_option($option_name, $site_option = false) {
54
+		$raw = $site_option ? get_site_option($option_name) : get_option($option_name);
55
+		if (false === $raw) {
56 56
 			return array();
57 57
 		}
58 58
 
59
-		return $this->convert_plugins_to_paths( $raw );
59
+		return $this->convert_plugins_to_paths($raw);
60 60
 	}
61 61
 
62 62
 	/**
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 	 *
67 67
 	 * @return array $plugin_paths The list of absolute paths we've found.
68 68
 	 */
69
-	public function find_using_request_action( $allowed_actions ) {
69
+	public function find_using_request_action($allowed_actions) {
70 70
 		// phpcs:disable WordPress.Security.NonceVerification.Recommended
71 71
 
72 72
 		/**
@@ -76,38 +76,38 @@  discard block
 block discarded – undo
76 76
 		 * minimum: checking whether the nonce exists and it's in the right place.
77 77
 		 * The request will fail later if the nonce doesn't pass the check.
78 78
 		 */
79
-		if ( empty( $_REQUEST['_wpnonce'] ) ) {
79
+		if (empty($_REQUEST['_wpnonce'])) {
80 80
 			return array();
81 81
 		}
82 82
 
83
-		$action = isset( $_REQUEST['action'] ) ? wp_unslash( $_REQUEST['action'] ) : false;
84
-		if ( ! in_array( $action, $allowed_actions, true ) ) {
83
+		$action = isset($_REQUEST['action']) ? wp_unslash($_REQUEST['action']) : false;
84
+		if (!in_array($action, $allowed_actions, true)) {
85 85
 			return array();
86 86
 		}
87 87
 
88 88
 		$plugin_slugs = array();
89
-		switch ( $action ) {
89
+		switch ($action) {
90 90
 			case 'activate':
91 91
 			case 'deactivate':
92
-				if ( empty( $_REQUEST['plugin'] ) ) {
92
+				if (empty($_REQUEST['plugin'])) {
93 93
 					break;
94 94
 				}
95 95
 
96
-				$plugin_slugs[] = wp_unslash( $_REQUEST['plugin'] );
96
+				$plugin_slugs[] = wp_unslash($_REQUEST['plugin']);
97 97
 				break;
98 98
 
99 99
 			case 'activate-selected':
100 100
 			case 'deactivate-selected':
101
-				if ( empty( $_REQUEST['checked'] ) ) {
101
+				if (empty($_REQUEST['checked'])) {
102 102
 					break;
103 103
 				}
104 104
 
105
-				$plugin_slugs = wp_unslash( $_REQUEST['checked'] );
105
+				$plugin_slugs = wp_unslash($_REQUEST['checked']);
106 106
 				break;
107 107
 		}
108 108
 
109 109
 		// phpcs:enable WordPress.Security.NonceVerification.Recommended
110
-		return $this->convert_plugins_to_paths( $plugin_slugs );
110
+		return $this->convert_plugins_to_paths($plugin_slugs);
111 111
 	}
112 112
 
113 113
 	/**
@@ -119,23 +119,23 @@  discard block
 block discarded – undo
119 119
 	 *
120 120
 	 * @return string[]
121 121
 	 */
122
-	private function convert_plugins_to_paths( $plugins ) {
123
-		if ( ! is_array( $plugins ) || empty( $plugins ) ) {
122
+	private function convert_plugins_to_paths($plugins) {
123
+		if (!is_array($plugins) || empty($plugins)) {
124 124
 			return array();
125 125
 		}
126 126
 
127 127
 		// We're going to look for plugins in the standard directories.
128
-		$path_constants = array( WP_PLUGIN_DIR, WPMU_PLUGIN_DIR );
128
+		$path_constants = array(WP_PLUGIN_DIR, WPMU_PLUGIN_DIR);
129 129
 
130 130
 		$plugin_paths = array();
131
-		foreach ( $plugins as $key => $value ) {
132
-			$path = $this->path_processor->find_directory_with_autoloader( $key, $path_constants );
133
-			if ( $path ) {
131
+		foreach ($plugins as $key => $value) {
132
+			$path = $this->path_processor->find_directory_with_autoloader($key, $path_constants);
133
+			if ($path) {
134 134
 				$plugin_paths[] = $path;
135 135
 			}
136 136
 
137
-			$path = $this->path_processor->find_directory_with_autoloader( $value, $path_constants );
138
-			if ( $path ) {
137
+			$path = $this->path_processor->find_directory_with_autoloader($value, $path_constants);
138
+			if ($path) {
139 139
 				$plugin_paths[] = $path;
140 140
 			}
141 141
 		}
Please login to merge, or discard this patch.
woocommerce-blocks/vendor/jetpack-autoloader/class-version-loader.php 2 patches
Indentation   +148 added lines, -148 removed lines patch added patch discarded remove patch
@@ -7,158 +7,158 @@
 block discarded – undo
7 7
 
8 8
 namespace Automattic\Jetpack\Autoloader\jp526c9128fcc85a1cd942451999a66eb0;
9 9
 
10
- // phpcs:ignore
10
+    // phpcs:ignore
11 11
 
12 12
 /**
13 13
  * This class loads other classes based on given parameters.
14 14
  */
15 15
 class Version_Loader {
16 16
 
17
-	/**
18
-	 * The Version_Selector object.
19
-	 *
20
-	 * @var Version_Selector
21
-	 */
22
-	private $version_selector;
23
-
24
-	/**
25
-	 * A map of available classes and their version and file path.
26
-	 *
27
-	 * @var array
28
-	 */
29
-	private $classmap;
30
-
31
-	/**
32
-	 * A map of PSR-4 namespaces and their version and directory path.
33
-	 *
34
-	 * @var array
35
-	 */
36
-	private $psr4_map;
37
-
38
-	/**
39
-	 * A map of all the files that we should load.
40
-	 *
41
-	 * @var array
42
-	 */
43
-	private $filemap;
44
-
45
-	/**
46
-	 * The constructor.
47
-	 *
48
-	 * @param Version_Selector $version_selector The Version_Selector object.
49
-	 * @param array            $classmap The verioned classmap to load using.
50
-	 * @param array            $psr4_map The versioned PSR-4 map to load using.
51
-	 * @param array            $filemap The versioned filemap to load.
52
-	 */
53
-	public function __construct( $version_selector, $classmap, $psr4_map, $filemap ) {
54
-		$this->version_selector = $version_selector;
55
-		$this->classmap         = $classmap;
56
-		$this->psr4_map         = $psr4_map;
57
-		$this->filemap          = $filemap;
58
-	}
59
-
60
-	/**
61
-	 * Finds the file path for the given class.
62
-	 *
63
-	 * @param string $class_name The class to find.
64
-	 *
65
-	 * @return string|null $file_path The path to the file if found, null if no class was found.
66
-	 */
67
-	public function find_class_file( $class_name ) {
68
-		$data = $this->select_newest_file(
69
-			isset( $this->classmap[ $class_name ] ) ? $this->classmap[ $class_name ] : null,
70
-			$this->find_psr4_file( $class_name )
71
-		);
72
-		if ( ! isset( $data ) ) {
73
-			return null;
74
-		}
75
-
76
-		return $data['path'];
77
-	}
78
-
79
-	/**
80
-	 * Load all of the files in the filemap.
81
-	 */
82
-	public function load_filemap() {
83
-		if ( empty( $this->filemap ) ) {
84
-			return;
85
-		}
86
-
87
-		foreach ( $this->filemap as $file_identifier => $file_data ) {
88
-			if ( empty( $GLOBALS['__composer_autoload_files'][ $file_identifier ] ) ) {
89
-				require_once $file_data['path'];
90
-
91
-				$GLOBALS['__composer_autoload_files'][ $file_identifier ] = true;
92
-			}
93
-		}
94
-	}
95
-
96
-	/**
97
-	 * Compares different class sources and returns the newest.
98
-	 *
99
-	 * @param array|null $classmap_data The classmap class data.
100
-	 * @param array|null $psr4_data The PSR-4 class data.
101
-	 *
102
-	 * @return array|null $data
103
-	 */
104
-	private function select_newest_file( $classmap_data, $psr4_data ) {
105
-		if ( ! isset( $classmap_data ) ) {
106
-			return $psr4_data;
107
-		} elseif ( ! isset( $psr4_data ) ) {
108
-			return $classmap_data;
109
-		}
110
-
111
-		if ( $this->version_selector->is_version_update_required( $classmap_data['version'], $psr4_data['version'] ) ) {
112
-			return $psr4_data;
113
-		}
114
-
115
-		return $classmap_data;
116
-	}
117
-
118
-	/**
119
-	 * Finds the file for a given class in a PSR-4 namespace.
120
-	 *
121
-	 * @param string $class_name The class to find.
122
-	 *
123
-	 * @return array|null $data The version and path path to the file if found, null otherwise.
124
-	 */
125
-	private function find_psr4_file( $class_name ) {
126
-		if ( ! isset( $this->psr4_map ) ) {
127
-			return null;
128
-		}
129
-
130
-		// Don't bother with classes that have no namespace.
131
-		$class_index = strrpos( $class_name, '\\' );
132
-		if ( ! $class_index ) {
133
-			return null;
134
-		}
135
-		$class_for_path = str_replace( '\\', '/', $class_name );
136
-
137
-		// Search for the namespace by iteratively cutting off the last segment until
138
-		// we find a match. This allows us to check the most-specific namespaces
139
-		// first as well as minimize the amount of time spent looking.
140
-		for (
141
-			$class_namespace = substr( $class_name, 0, $class_index );
142
-			! empty( $class_namespace );
143
-			$class_namespace = substr( $class_namespace, 0, strrpos( $class_namespace, '\\' ) )
144
-		) {
145
-			$namespace = $class_namespace . '\\';
146
-			if ( ! isset( $this->psr4_map[ $namespace ] ) ) {
147
-				continue;
148
-			}
149
-			$data = $this->psr4_map[ $namespace ];
150
-
151
-			foreach ( $data['path'] as $path ) {
152
-				$path .= '/' . substr( $class_for_path, strlen( $namespace ) ) . '.php';
153
-				if ( file_exists( $path ) ) {
154
-					return array(
155
-						'version' => $data['version'],
156
-						'path'    => $path,
157
-					);
158
-				}
159
-			}
160
-		}
161
-
162
-		return null;
163
-	}
17
+    /**
18
+     * The Version_Selector object.
19
+     *
20
+     * @var Version_Selector
21
+     */
22
+    private $version_selector;
23
+
24
+    /**
25
+     * A map of available classes and their version and file path.
26
+     *
27
+     * @var array
28
+     */
29
+    private $classmap;
30
+
31
+    /**
32
+     * A map of PSR-4 namespaces and their version and directory path.
33
+     *
34
+     * @var array
35
+     */
36
+    private $psr4_map;
37
+
38
+    /**
39
+     * A map of all the files that we should load.
40
+     *
41
+     * @var array
42
+     */
43
+    private $filemap;
44
+
45
+    /**
46
+     * The constructor.
47
+     *
48
+     * @param Version_Selector $version_selector The Version_Selector object.
49
+     * @param array            $classmap The verioned classmap to load using.
50
+     * @param array            $psr4_map The versioned PSR-4 map to load using.
51
+     * @param array            $filemap The versioned filemap to load.
52
+     */
53
+    public function __construct( $version_selector, $classmap, $psr4_map, $filemap ) {
54
+        $this->version_selector = $version_selector;
55
+        $this->classmap         = $classmap;
56
+        $this->psr4_map         = $psr4_map;
57
+        $this->filemap          = $filemap;
58
+    }
59
+
60
+    /**
61
+     * Finds the file path for the given class.
62
+     *
63
+     * @param string $class_name The class to find.
64
+     *
65
+     * @return string|null $file_path The path to the file if found, null if no class was found.
66
+     */
67
+    public function find_class_file( $class_name ) {
68
+        $data = $this->select_newest_file(
69
+            isset( $this->classmap[ $class_name ] ) ? $this->classmap[ $class_name ] : null,
70
+            $this->find_psr4_file( $class_name )
71
+        );
72
+        if ( ! isset( $data ) ) {
73
+            return null;
74
+        }
75
+
76
+        return $data['path'];
77
+    }
78
+
79
+    /**
80
+     * Load all of the files in the filemap.
81
+     */
82
+    public function load_filemap() {
83
+        if ( empty( $this->filemap ) ) {
84
+            return;
85
+        }
86
+
87
+        foreach ( $this->filemap as $file_identifier => $file_data ) {
88
+            if ( empty( $GLOBALS['__composer_autoload_files'][ $file_identifier ] ) ) {
89
+                require_once $file_data['path'];
90
+
91
+                $GLOBALS['__composer_autoload_files'][ $file_identifier ] = true;
92
+            }
93
+        }
94
+    }
95
+
96
+    /**
97
+     * Compares different class sources and returns the newest.
98
+     *
99
+     * @param array|null $classmap_data The classmap class data.
100
+     * @param array|null $psr4_data The PSR-4 class data.
101
+     *
102
+     * @return array|null $data
103
+     */
104
+    private function select_newest_file( $classmap_data, $psr4_data ) {
105
+        if ( ! isset( $classmap_data ) ) {
106
+            return $psr4_data;
107
+        } elseif ( ! isset( $psr4_data ) ) {
108
+            return $classmap_data;
109
+        }
110
+
111
+        if ( $this->version_selector->is_version_update_required( $classmap_data['version'], $psr4_data['version'] ) ) {
112
+            return $psr4_data;
113
+        }
114
+
115
+        return $classmap_data;
116
+    }
117
+
118
+    /**
119
+     * Finds the file for a given class in a PSR-4 namespace.
120
+     *
121
+     * @param string $class_name The class to find.
122
+     *
123
+     * @return array|null $data The version and path path to the file if found, null otherwise.
124
+     */
125
+    private function find_psr4_file( $class_name ) {
126
+        if ( ! isset( $this->psr4_map ) ) {
127
+            return null;
128
+        }
129
+
130
+        // Don't bother with classes that have no namespace.
131
+        $class_index = strrpos( $class_name, '\\' );
132
+        if ( ! $class_index ) {
133
+            return null;
134
+        }
135
+        $class_for_path = str_replace( '\\', '/', $class_name );
136
+
137
+        // Search for the namespace by iteratively cutting off the last segment until
138
+        // we find a match. This allows us to check the most-specific namespaces
139
+        // first as well as minimize the amount of time spent looking.
140
+        for (
141
+            $class_namespace = substr( $class_name, 0, $class_index );
142
+            ! empty( $class_namespace );
143
+            $class_namespace = substr( $class_namespace, 0, strrpos( $class_namespace, '\\' ) )
144
+        ) {
145
+            $namespace = $class_namespace . '\\';
146
+            if ( ! isset( $this->psr4_map[ $namespace ] ) ) {
147
+                continue;
148
+            }
149
+            $data = $this->psr4_map[ $namespace ];
150
+
151
+            foreach ( $data['path'] as $path ) {
152
+                $path .= '/' . substr( $class_for_path, strlen( $namespace ) ) . '.php';
153
+                if ( file_exists( $path ) ) {
154
+                    return array(
155
+                        'version' => $data['version'],
156
+                        'path'    => $path,
157
+                    );
158
+                }
159
+            }
160
+        }
161
+
162
+        return null;
163
+    }
164 164
 }
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 	 * @param array            $psr4_map The versioned PSR-4 map to load using.
43 43
 	 * @param array            $filemap The versioned filemap to load.
44 44
 	 */
45
-	public function __construct( $version_selector, $classmap, $psr4_map, $filemap ) {
45
+	public function __construct($version_selector, $classmap, $psr4_map, $filemap) {
46 46
 		$this->version_selector = $version_selector;
47 47
 		$this->classmap         = $classmap;
48 48
 		$this->psr4_map         = $psr4_map;
@@ -56,12 +56,12 @@  discard block
 block discarded – undo
56 56
 	 *
57 57
 	 * @return string|null $file_path The path to the file if found, null if no class was found.
58 58
 	 */
59
-	public function find_class_file( $class_name ) {
59
+	public function find_class_file($class_name) {
60 60
 		$data = $this->select_newest_file(
61
-			isset( $this->classmap[ $class_name ] ) ? $this->classmap[ $class_name ] : null,
62
-			$this->find_psr4_file( $class_name )
61
+			isset($this->classmap[$class_name]) ? $this->classmap[$class_name] : null,
62
+			$this->find_psr4_file($class_name)
63 63
 		);
64
-		if ( ! isset( $data ) ) {
64
+		if (!isset($data)) {
65 65
 			return null;
66 66
 		}
67 67
 
@@ -72,15 +72,15 @@  discard block
 block discarded – undo
72 72
 	 * Load all of the files in the filemap.
73 73
 	 */
74 74
 	public function load_filemap() {
75
-		if ( empty( $this->filemap ) ) {
75
+		if (empty($this->filemap)) {
76 76
 			return;
77 77
 		}
78 78
 
79
-		foreach ( $this->filemap as $file_identifier => $file_data ) {
80
-			if ( empty( $GLOBALS['__composer_autoload_files'][ $file_identifier ] ) ) {
79
+		foreach ($this->filemap as $file_identifier => $file_data) {
80
+			if (empty($GLOBALS['__composer_autoload_files'][$file_identifier])) {
81 81
 				require_once $file_data['path'];
82 82
 
83
-				$GLOBALS['__composer_autoload_files'][ $file_identifier ] = true;
83
+				$GLOBALS['__composer_autoload_files'][$file_identifier] = true;
84 84
 			}
85 85
 		}
86 86
 	}
@@ -93,14 +93,14 @@  discard block
 block discarded – undo
93 93
 	 *
94 94
 	 * @return array|null $data
95 95
 	 */
96
-	private function select_newest_file( $classmap_data, $psr4_data ) {
97
-		if ( ! isset( $classmap_data ) ) {
96
+	private function select_newest_file($classmap_data, $psr4_data) {
97
+		if (!isset($classmap_data)) {
98 98
 			return $psr4_data;
99
-		} elseif ( ! isset( $psr4_data ) ) {
99
+		} elseif (!isset($psr4_data)) {
100 100
 			return $classmap_data;
101 101
 		}
102 102
 
103
-		if ( $this->version_selector->is_version_update_required( $classmap_data['version'], $psr4_data['version'] ) ) {
103
+		if ($this->version_selector->is_version_update_required($classmap_data['version'], $psr4_data['version'])) {
104 104
 			return $psr4_data;
105 105
 		}
106 106
 
@@ -114,35 +114,35 @@  discard block
 block discarded – undo
114 114
 	 *
115 115
 	 * @return array|null $data The version and path path to the file if found, null otherwise.
116 116
 	 */
117
-	private function find_psr4_file( $class_name ) {
118
-		if ( ! isset( $this->psr4_map ) ) {
117
+	private function find_psr4_file($class_name) {
118
+		if (!isset($this->psr4_map)) {
119 119
 			return null;
120 120
 		}
121 121
 
122 122
 		// Don't bother with classes that have no namespace.
123
-		$class_index = strrpos( $class_name, '\\' );
124
-		if ( ! $class_index ) {
123
+		$class_index = strrpos($class_name, '\\');
124
+		if (!$class_index) {
125 125
 			return null;
126 126
 		}
127
-		$class_for_path = str_replace( '\\', '/', $class_name );
127
+		$class_for_path = str_replace('\\', '/', $class_name);
128 128
 
129 129
 		// Search for the namespace by iteratively cutting off the last segment until
130 130
 		// we find a match. This allows us to check the most-specific namespaces
131 131
 		// first as well as minimize the amount of time spent looking.
132 132
 		for (
133
-			$class_namespace = substr( $class_name, 0, $class_index );
134
-			! empty( $class_namespace );
135
-			$class_namespace = substr( $class_namespace, 0, strrpos( $class_namespace, '\\' ) )
133
+			$class_namespace = substr($class_name, 0, $class_index);
134
+			!empty($class_namespace);
135
+			$class_namespace = substr($class_namespace, 0, strrpos($class_namespace, '\\'))
136 136
 		) {
137 137
 			$namespace = $class_namespace . '\\';
138
-			if ( ! isset( $this->psr4_map[ $namespace ] ) ) {
138
+			if (!isset($this->psr4_map[$namespace])) {
139 139
 				continue;
140 140
 			}
141
-			$data = $this->psr4_map[ $namespace ];
141
+			$data = $this->psr4_map[$namespace];
142 142
 
143
-			foreach ( $data['path'] as $path ) {
144
-				$path .= '/' . substr( $class_for_path, strlen( $namespace ) ) . '.php';
145
-				if ( file_exists( $path ) ) {
143
+			foreach ($data['path'] as $path) {
144
+				$path .= '/' . substr($class_for_path, strlen($namespace)) . '.php';
145
+				if (file_exists($path)) {
146 146
 					return array(
147 147
 						'version' => $data['version'],
148 148
 						'path'    => $path,
Please login to merge, or discard this patch.
vendor/jetpack-autoloader/class-latest-autoloader-guard.php 2 patches
Indentation   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -7,80 +7,80 @@
 block discarded – undo
7 7
 
8 8
 namespace Automattic\Jetpack\Autoloader\jp526c9128fcc85a1cd942451999a66eb0;
9 9
 
10
- // phpcs:ignore
10
+    // phpcs:ignore
11 11
 
12 12
 /**
13 13
  * This class ensures that we're only executing the latest autoloader.
14 14
  */
15 15
 class Latest_Autoloader_Guard {
16 16
 
17
-	/**
18
-	 * The Plugins_Handler instance.
19
-	 *
20
-	 * @var Plugins_Handler
21
-	 */
22
-	private $plugins_handler;
17
+    /**
18
+     * The Plugins_Handler instance.
19
+     *
20
+     * @var Plugins_Handler
21
+     */
22
+    private $plugins_handler;
23 23
 
24
-	/**
25
-	 * The Autoloader_Handler instance.
26
-	 *
27
-	 * @var Autoloader_Handler
28
-	 */
29
-	private $autoloader_handler;
24
+    /**
25
+     * The Autoloader_Handler instance.
26
+     *
27
+     * @var Autoloader_Handler
28
+     */
29
+    private $autoloader_handler;
30 30
 
31
-	/**
32
-	 * The Autoloader_locator instance.
33
-	 *
34
-	 * @var Autoloader_Locator
35
-	 */
36
-	private $autoloader_locator;
31
+    /**
32
+     * The Autoloader_locator instance.
33
+     *
34
+     * @var Autoloader_Locator
35
+     */
36
+    private $autoloader_locator;
37 37
 
38
-	/**
39
-	 * The constructor.
40
-	 *
41
-	 * @param Plugins_Handler    $plugins_handler    The Plugins_Handler instance.
42
-	 * @param Autoloader_Handler $autoloader_handler The Autoloader_Handler instance.
43
-	 * @param Autoloader_Locator $autoloader_locator The Autoloader_Locator instance.
44
-	 */
45
-	public function __construct( $plugins_handler, $autoloader_handler, $autoloader_locator ) {
46
-		$this->plugins_handler    = $plugins_handler;
47
-		$this->autoloader_handler = $autoloader_handler;
48
-		$this->autoloader_locator = $autoloader_locator;
49
-	}
38
+    /**
39
+     * The constructor.
40
+     *
41
+     * @param Plugins_Handler    $plugins_handler    The Plugins_Handler instance.
42
+     * @param Autoloader_Handler $autoloader_handler The Autoloader_Handler instance.
43
+     * @param Autoloader_Locator $autoloader_locator The Autoloader_Locator instance.
44
+     */
45
+    public function __construct( $plugins_handler, $autoloader_handler, $autoloader_locator ) {
46
+        $this->plugins_handler    = $plugins_handler;
47
+        $this->autoloader_handler = $autoloader_handler;
48
+        $this->autoloader_locator = $autoloader_locator;
49
+    }
50 50
 
51
-	/**
52
-	 * Indicates whether or not the autoloader should be initialized. Note that this function
53
-	 * has the side-effect of actually loading the latest autoloader in the event that this
54
-	 * is not it.
55
-	 *
56
-	 * @param string   $current_plugin             The current plugin we're checking.
57
-	 * @param string[] $plugins                    The active plugins to check for autoloaders in.
58
-	 * @param bool     $was_included_by_autoloader Indicates whether or not this autoloader was included by another.
59
-	 *
60
-	 * @return bool True if we should stop initialization, otherwise false.
61
-	 */
62
-	public function should_stop_init( $current_plugin, $plugins, $was_included_by_autoloader ) {
63
-		global $jetpack_autoloader_latest_version;
51
+    /**
52
+     * Indicates whether or not the autoloader should be initialized. Note that this function
53
+     * has the side-effect of actually loading the latest autoloader in the event that this
54
+     * is not it.
55
+     *
56
+     * @param string   $current_plugin             The current plugin we're checking.
57
+     * @param string[] $plugins                    The active plugins to check for autoloaders in.
58
+     * @param bool     $was_included_by_autoloader Indicates whether or not this autoloader was included by another.
59
+     *
60
+     * @return bool True if we should stop initialization, otherwise false.
61
+     */
62
+    public function should_stop_init( $current_plugin, $plugins, $was_included_by_autoloader ) {
63
+        global $jetpack_autoloader_latest_version;
64 64
 
65
-		// We need to reset the autoloader when the plugins change because
66
-		// that means the autoloader was generated with a different list.
67
-		if ( $this->plugins_handler->have_plugins_changed( $plugins ) ) {
68
-			$this->autoloader_handler->reset_autoloader();
69
-		}
65
+        // We need to reset the autoloader when the plugins change because
66
+        // that means the autoloader was generated with a different list.
67
+        if ( $this->plugins_handler->have_plugins_changed( $plugins ) ) {
68
+            $this->autoloader_handler->reset_autoloader();
69
+        }
70 70
 
71
-		// When the latest autoloader has already been found we don't need to search for it again.
72
-		// We should take care however because this will also trigger if the autoloader has been
73
-		// included by an older one.
74
-		if ( isset( $jetpack_autoloader_latest_version ) && ! $was_included_by_autoloader ) {
75
-			return true;
76
-		}
71
+        // When the latest autoloader has already been found we don't need to search for it again.
72
+        // We should take care however because this will also trigger if the autoloader has been
73
+        // included by an older one.
74
+        if ( isset( $jetpack_autoloader_latest_version ) && ! $was_included_by_autoloader ) {
75
+            return true;
76
+        }
77 77
 
78
-		$latest_plugin = $this->autoloader_locator->find_latest_autoloader( $plugins, $jetpack_autoloader_latest_version );
79
-		if ( isset( $latest_plugin ) && $latest_plugin !== $current_plugin ) {
80
-			require $this->autoloader_locator->get_autoloader_path( $latest_plugin );
81
-			return true;
82
-		}
78
+        $latest_plugin = $this->autoloader_locator->find_latest_autoloader( $plugins, $jetpack_autoloader_latest_version );
79
+        if ( isset( $latest_plugin ) && $latest_plugin !== $current_plugin ) {
80
+            require $this->autoloader_locator->get_autoloader_path( $latest_plugin );
81
+            return true;
82
+        }
83 83
 
84
-		return false;
85
-	}
84
+        return false;
85
+    }
86 86
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	 * @param Autoloader_Handler $autoloader_handler The Autoloader_Handler instance.
35 35
 	 * @param Autoloader_Locator $autoloader_locator The Autoloader_Locator instance.
36 36
 	 */
37
-	public function __construct( $plugins_handler, $autoloader_handler, $autoloader_locator ) {
37
+	public function __construct($plugins_handler, $autoloader_handler, $autoloader_locator) {
38 38
 		$this->plugins_handler    = $plugins_handler;
39 39
 		$this->autoloader_handler = $autoloader_handler;
40 40
 		$this->autoloader_locator = $autoloader_locator;
@@ -51,25 +51,25 @@  discard block
 block discarded – undo
51 51
 	 *
52 52
 	 * @return bool True if we should stop initialization, otherwise false.
53 53
 	 */
54
-	public function should_stop_init( $current_plugin, $plugins, $was_included_by_autoloader ) {
54
+	public function should_stop_init($current_plugin, $plugins, $was_included_by_autoloader) {
55 55
 		global $jetpack_autoloader_latest_version;
56 56
 
57 57
 		// We need to reset the autoloader when the plugins change because
58 58
 		// that means the autoloader was generated with a different list.
59
-		if ( $this->plugins_handler->have_plugins_changed( $plugins ) ) {
59
+		if ($this->plugins_handler->have_plugins_changed($plugins)) {
60 60
 			$this->autoloader_handler->reset_autoloader();
61 61
 		}
62 62
 
63 63
 		// When the latest autoloader has already been found we don't need to search for it again.
64 64
 		// We should take care however because this will also trigger if the autoloader has been
65 65
 		// included by an older one.
66
-		if ( isset( $jetpack_autoloader_latest_version ) && ! $was_included_by_autoloader ) {
66
+		if (isset($jetpack_autoloader_latest_version) && !$was_included_by_autoloader) {
67 67
 			return true;
68 68
 		}
69 69
 
70
-		$latest_plugin = $this->autoloader_locator->find_latest_autoloader( $plugins, $jetpack_autoloader_latest_version );
71
-		if ( isset( $latest_plugin ) && $latest_plugin !== $current_plugin ) {
72
-			require $this->autoloader_locator->get_autoloader_path( $latest_plugin );
70
+		$latest_plugin = $this->autoloader_locator->find_latest_autoloader($plugins, $jetpack_autoloader_latest_version);
71
+		if (isset($latest_plugin) && $latest_plugin !== $current_plugin) {
72
+			require $this->autoloader_locator->get_autoloader_path($latest_plugin);
73 73
 			return true;
74 74
 		}
75 75
 
Please login to merge, or discard this patch.
woocommerce-blocks/vendor/jetpack-autoloader/class-php-autoloader.php 2 patches
Indentation   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -7,84 +7,84 @@
 block discarded – undo
7 7
 
8 8
 namespace Automattic\Jetpack\Autoloader\jp526c9128fcc85a1cd942451999a66eb0;
9 9
 
10
- // phpcs:ignore
10
+    // phpcs:ignore
11 11
 
12 12
 /**
13 13
  * This class handles management of the actual PHP autoloader.
14 14
  */
15 15
 class PHP_Autoloader {
16 16
 
17
-	/**
18
-	 * Registers the autoloader with PHP so that it can begin autoloading classes.
19
-	 *
20
-	 * @param Version_Loader $version_loader The class loader to use in the autoloader.
21
-	 */
22
-	public function register_autoloader( $version_loader ) {
23
-		// Make sure no other autoloaders are registered.
24
-		$this->unregister_autoloader();
17
+    /**
18
+     * Registers the autoloader with PHP so that it can begin autoloading classes.
19
+     *
20
+     * @param Version_Loader $version_loader The class loader to use in the autoloader.
21
+     */
22
+    public function register_autoloader( $version_loader ) {
23
+        // Make sure no other autoloaders are registered.
24
+        $this->unregister_autoloader();
25 25
 
26
-		// Set the global so that it can be used to load classes.
27
-		global $jetpack_autoloader_loader;
28
-		$jetpack_autoloader_loader = $version_loader;
26
+        // Set the global so that it can be used to load classes.
27
+        global $jetpack_autoloader_loader;
28
+        $jetpack_autoloader_loader = $version_loader;
29 29
 
30
-		// Ensure that the autoloader is first to avoid contention with others.
31
-		spl_autoload_register( array( self::class, 'load_class' ), true, true );
32
-	}
30
+        // Ensure that the autoloader is first to avoid contention with others.
31
+        spl_autoload_register( array( self::class, 'load_class' ), true, true );
32
+    }
33 33
 
34
-	/**
35
-	 * Unregisters the active autoloader so that it will no longer autoload classes.
36
-	 */
37
-	public function unregister_autoloader() {
38
-		// Remove any v2 autoloader that we've already registered.
39
-		$autoload_chain = spl_autoload_functions();
40
-		foreach ( $autoload_chain as $autoloader ) {
41
-			// We can identify a v2 autoloader using the namespace.
42
-			$namespace_check = null;
34
+    /**
35
+     * Unregisters the active autoloader so that it will no longer autoload classes.
36
+     */
37
+    public function unregister_autoloader() {
38
+        // Remove any v2 autoloader that we've already registered.
39
+        $autoload_chain = spl_autoload_functions();
40
+        foreach ( $autoload_chain as $autoloader ) {
41
+            // We can identify a v2 autoloader using the namespace.
42
+            $namespace_check = null;
43 43
 
44
-			// Functions are recorded as strings.
45
-			if ( is_string( $autoloader ) ) {
46
-				$namespace_check = $autoloader;
47
-			} elseif ( is_array( $autoloader ) && is_string( $autoloader[0] ) ) {
48
-				// Static method calls have the class as the first array element.
49
-				$namespace_check = $autoloader[0];
50
-			} else {
51
-				// Since the autoloader has only ever been a function or a static method we don't currently need to check anything else.
52
-				continue;
53
-			}
44
+            // Functions are recorded as strings.
45
+            if ( is_string( $autoloader ) ) {
46
+                $namespace_check = $autoloader;
47
+            } elseif ( is_array( $autoloader ) && is_string( $autoloader[0] ) ) {
48
+                // Static method calls have the class as the first array element.
49
+                $namespace_check = $autoloader[0];
50
+            } else {
51
+                // Since the autoloader has only ever been a function or a static method we don't currently need to check anything else.
52
+                continue;
53
+            }
54 54
 
55
-			// Check for the namespace without the generated suffix.
56
-			if ( 'Automattic\\Jetpack\\Autoloader\\jp' === substr( $namespace_check, 0, 32 ) ) {
57
-				spl_autoload_unregister( $autoloader );
58
-			}
59
-		}
55
+            // Check for the namespace without the generated suffix.
56
+            if ( 'Automattic\\Jetpack\\Autoloader\\jp' === substr( $namespace_check, 0, 32 ) ) {
57
+                spl_autoload_unregister( $autoloader );
58
+            }
59
+        }
60 60
 
61
-		// Clear the global now that the autoloader has been unregistered.
62
-		global $jetpack_autoloader_loader;
63
-		$jetpack_autoloader_loader = null;
64
-	}
61
+        // Clear the global now that the autoloader has been unregistered.
62
+        global $jetpack_autoloader_loader;
63
+        $jetpack_autoloader_loader = null;
64
+    }
65 65
 
66
-	/**
67
-	 * Loads a class file if one could be found.
68
-	 *
69
-	 * Note: This function is static so that the autoloader can be easily unregistered. If
70
-	 * it was a class method we would have to unwrap the object to check the namespace.
71
-	 *
72
-	 * @param string $class_name The name of the class to autoload.
73
-	 *
74
-	 * @return bool Indicates whether or not a class file was loaded.
75
-	 */
76
-	public static function load_class( $class_name ) {
77
-		global $jetpack_autoloader_loader;
78
-		if ( ! isset( $jetpack_autoloader_loader ) ) {
79
-			return;
80
-		}
66
+    /**
67
+     * Loads a class file if one could be found.
68
+     *
69
+     * Note: This function is static so that the autoloader can be easily unregistered. If
70
+     * it was a class method we would have to unwrap the object to check the namespace.
71
+     *
72
+     * @param string $class_name The name of the class to autoload.
73
+     *
74
+     * @return bool Indicates whether or not a class file was loaded.
75
+     */
76
+    public static function load_class( $class_name ) {
77
+        global $jetpack_autoloader_loader;
78
+        if ( ! isset( $jetpack_autoloader_loader ) ) {
79
+            return;
80
+        }
81 81
 
82
-		$file = $jetpack_autoloader_loader->find_class_file( $class_name );
83
-		if ( ! isset( $file ) ) {
84
-			return false;
85
-		}
82
+        $file = $jetpack_autoloader_loader->find_class_file( $class_name );
83
+        if ( ! isset( $file ) ) {
84
+            return false;
85
+        }
86 86
 
87
-		require $file;
88
-		return true;
89
-	}
87
+        require $file;
88
+        return true;
89
+    }
90 90
 }
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 	 *
12 12
 	 * @param Version_Loader $version_loader The class loader to use in the autoloader.
13 13
 	 */
14
-	public function register_autoloader( $version_loader ) {
14
+	public function register_autoloader($version_loader) {
15 15
 		// Make sure no other autoloaders are registered.
16 16
 		$this->unregister_autoloader();
17 17
 
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 		$jetpack_autoloader_loader = $version_loader;
21 21
 
22 22
 		// Ensure that the autoloader is first to avoid contention with others.
23
-		spl_autoload_register( array( self::class, 'load_class' ), true, true );
23
+		spl_autoload_register(array(self::class, 'load_class'), true, true);
24 24
 	}
25 25
 
26 26
 	/**
@@ -29,14 +29,14 @@  discard block
 block discarded – undo
29 29
 	public function unregister_autoloader() {
30 30
 		// Remove any v2 autoloader that we've already registered.
31 31
 		$autoload_chain = spl_autoload_functions();
32
-		foreach ( $autoload_chain as $autoloader ) {
32
+		foreach ($autoload_chain as $autoloader) {
33 33
 			// We can identify a v2 autoloader using the namespace.
34 34
 			$namespace_check = null;
35 35
 
36 36
 			// Functions are recorded as strings.
37
-			if ( is_string( $autoloader ) ) {
37
+			if (is_string($autoloader)) {
38 38
 				$namespace_check = $autoloader;
39
-			} elseif ( is_array( $autoloader ) && is_string( $autoloader[0] ) ) {
39
+			} elseif (is_array($autoloader) && is_string($autoloader[0])) {
40 40
 				// Static method calls have the class as the first array element.
41 41
 				$namespace_check = $autoloader[0];
42 42
 			} else {
@@ -45,8 +45,8 @@  discard block
 block discarded – undo
45 45
 			}
46 46
 
47 47
 			// Check for the namespace without the generated suffix.
48
-			if ( 'Automattic\\Jetpack\\Autoloader\\jp' === substr( $namespace_check, 0, 32 ) ) {
49
-				spl_autoload_unregister( $autoloader );
48
+			if ('Automattic\\Jetpack\\Autoloader\\jp' === substr($namespace_check, 0, 32)) {
49
+				spl_autoload_unregister($autoloader);
50 50
 			}
51 51
 		}
52 52
 
@@ -65,14 +65,14 @@  discard block
 block discarded – undo
65 65
 	 *
66 66
 	 * @return bool Indicates whether or not a class file was loaded.
67 67
 	 */
68
-	public static function load_class( $class_name ) {
68
+	public static function load_class($class_name) {
69 69
 		global $jetpack_autoloader_loader;
70
-		if ( ! isset( $jetpack_autoloader_loader ) ) {
70
+		if (!isset($jetpack_autoloader_loader)) {
71 71
 			return;
72 72
 		}
73 73
 
74
-		$file = $jetpack_autoloader_loader->find_class_file( $class_name );
75
-		if ( ! isset( $file ) ) {
74
+		$file = $jetpack_autoloader_loader->find_class_file($class_name);
75
+		if (!isset($file)) {
76 76
 			return false;
77 77
 		}
78 78
 
Please login to merge, or discard this patch.
woocommerce-blocks/vendor/jetpack-autoloader/class-shutdown-handler.php 2 patches
Indentation   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -7,86 +7,86 @@
 block discarded – undo
7 7
 
8 8
 namespace Automattic\Jetpack\Autoloader\jp526c9128fcc85a1cd942451999a66eb0;
9 9
 
10
- // phpcs:ignore
10
+    // phpcs:ignore
11 11
 
12 12
 /**
13 13
  * This class handles the shutdown of the autoloader.
14 14
  */
15 15
 class Shutdown_Handler {
16 16
 
17
-	/**
18
-	 * The Plugins_Handler instance.
19
-	 *
20
-	 * @var Plugins_Handler
21
-	 */
22
-	private $plugins_handler;
17
+    /**
18
+     * The Plugins_Handler instance.
19
+     *
20
+     * @var Plugins_Handler
21
+     */
22
+    private $plugins_handler;
23 23
 
24
-	/**
25
-	 * The plugins cached by this autoloader.
26
-	 *
27
-	 * @var string[]
28
-	 */
29
-	private $cached_plugins;
24
+    /**
25
+     * The plugins cached by this autoloader.
26
+     *
27
+     * @var string[]
28
+     */
29
+    private $cached_plugins;
30 30
 
31
-	/**
32
-	 * Indicates whether or not this autoloader was included by another.
33
-	 *
34
-	 * @var bool
35
-	 */
36
-	private $was_included_by_autoloader;
31
+    /**
32
+     * Indicates whether or not this autoloader was included by another.
33
+     *
34
+     * @var bool
35
+     */
36
+    private $was_included_by_autoloader;
37 37
 
38
-	/**
39
-	 * Constructor.
40
-	 *
41
-	 * @param Plugins_Handler $plugins_handler The Plugins_Handler instance to use.
42
-	 * @param string[]        $cached_plugins The plugins cached by the autoloaer.
43
-	 * @param bool            $was_included_by_autoloader Indicates whether or not the autoloader was included by another.
44
-	 */
45
-	public function __construct( $plugins_handler, $cached_plugins, $was_included_by_autoloader ) {
46
-		$this->plugins_handler            = $plugins_handler;
47
-		$this->cached_plugins             = $cached_plugins;
48
-		$this->was_included_by_autoloader = $was_included_by_autoloader;
49
-	}
38
+    /**
39
+     * Constructor.
40
+     *
41
+     * @param Plugins_Handler $plugins_handler The Plugins_Handler instance to use.
42
+     * @param string[]        $cached_plugins The plugins cached by the autoloaer.
43
+     * @param bool            $was_included_by_autoloader Indicates whether or not the autoloader was included by another.
44
+     */
45
+    public function __construct( $plugins_handler, $cached_plugins, $was_included_by_autoloader ) {
46
+        $this->plugins_handler            = $plugins_handler;
47
+        $this->cached_plugins             = $cached_plugins;
48
+        $this->was_included_by_autoloader = $was_included_by_autoloader;
49
+    }
50 50
 
51
-	/**
52
-	 * Handles the shutdown of the autoloader.
53
-	 */
54
-	public function __invoke() {
55
-		// Don't save a broken cache if an error happens during some plugin's initialization.
56
-		if ( ! did_action( 'plugins_loaded' ) ) {
57
-			// Ensure that the cache is emptied to prevent consecutive failures if the cache is to blame.
58
-			if ( ! empty( $this->cached_plugins ) ) {
59
-				$this->plugins_handler->cache_plugins( array() );
60
-			}
51
+    /**
52
+     * Handles the shutdown of the autoloader.
53
+     */
54
+    public function __invoke() {
55
+        // Don't save a broken cache if an error happens during some plugin's initialization.
56
+        if ( ! did_action( 'plugins_loaded' ) ) {
57
+            // Ensure that the cache is emptied to prevent consecutive failures if the cache is to blame.
58
+            if ( ! empty( $this->cached_plugins ) ) {
59
+                $this->plugins_handler->cache_plugins( array() );
60
+            }
61 61
 
62
-			return;
63
-		}
62
+            return;
63
+        }
64 64
 
65
-		// Load the active plugins fresh since the list we pulled earlier might not contain
66
-		// plugins that were activated but did not reset the autoloader. This happens
67
-		// when a plugin is in the cache but not "active" when the autoloader loads.
68
-		// We also want to make sure that plugins which are deactivating are not
69
-		// considered "active" so that they will be removed from the cache now.
70
-		try {
71
-			$active_plugins = $this->plugins_handler->get_active_plugins( false, ! $this->was_included_by_autoloader );
72
-		} catch ( \Exception $ex ) {
73
-			// When the package is deleted before shutdown it will throw an exception.
74
-			// In the event this happens we should erase the cache.
75
-			if ( ! empty( $this->cached_plugins ) ) {
76
-				$this->plugins_handler->cache_plugins( array() );
77
-			}
78
-			return;
79
-		}
65
+        // Load the active plugins fresh since the list we pulled earlier might not contain
66
+        // plugins that were activated but did not reset the autoloader. This happens
67
+        // when a plugin is in the cache but not "active" when the autoloader loads.
68
+        // We also want to make sure that plugins which are deactivating are not
69
+        // considered "active" so that they will be removed from the cache now.
70
+        try {
71
+            $active_plugins = $this->plugins_handler->get_active_plugins( false, ! $this->was_included_by_autoloader );
72
+        } catch ( \Exception $ex ) {
73
+            // When the package is deleted before shutdown it will throw an exception.
74
+            // In the event this happens we should erase the cache.
75
+            if ( ! empty( $this->cached_plugins ) ) {
76
+                $this->plugins_handler->cache_plugins( array() );
77
+            }
78
+            return;
79
+        }
80 80
 
81
-		// The paths should be sorted for easy comparisons with those loaded from the cache.
82
-		// Note we don't need to sort the cached entries because they're already sorted.
83
-		sort( $active_plugins );
81
+        // The paths should be sorted for easy comparisons with those loaded from the cache.
82
+        // Note we don't need to sort the cached entries because they're already sorted.
83
+        sort( $active_plugins );
84 84
 
85
-		// We don't want to waste time saving a cache that hasn't changed.
86
-		if ( $this->cached_plugins === $active_plugins ) {
87
-			return;
88
-		}
85
+        // We don't want to waste time saving a cache that hasn't changed.
86
+        if ( $this->cached_plugins === $active_plugins ) {
87
+            return;
88
+        }
89 89
 
90
-		$this->plugins_handler->cache_plugins( $active_plugins );
91
-	}
90
+        $this->plugins_handler->cache_plugins( $active_plugins );
91
+    }
92 92
 }
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	 * @param string[]        $cached_plugins The plugins cached by the autoloaer.
35 35
 	 * @param bool            $was_included_by_autoloader Indicates whether or not the autoloader was included by another.
36 36
 	 */
37
-	public function __construct( $plugins_handler, $cached_plugins, $was_included_by_autoloader ) {
37
+	public function __construct($plugins_handler, $cached_plugins, $was_included_by_autoloader) {
38 38
 		$this->plugins_handler            = $plugins_handler;
39 39
 		$this->cached_plugins             = $cached_plugins;
40 40
 		$this->was_included_by_autoloader = $was_included_by_autoloader;
@@ -45,10 +45,10 @@  discard block
 block discarded – undo
45 45
 	 */
46 46
 	public function __invoke() {
47 47
 		// Don't save a broken cache if an error happens during some plugin's initialization.
48
-		if ( ! did_action( 'plugins_loaded' ) ) {
48
+		if (!did_action('plugins_loaded')) {
49 49
 			// Ensure that the cache is emptied to prevent consecutive failures if the cache is to blame.
50
-			if ( ! empty( $this->cached_plugins ) ) {
51
-				$this->plugins_handler->cache_plugins( array() );
50
+			if (!empty($this->cached_plugins)) {
51
+				$this->plugins_handler->cache_plugins(array());
52 52
 			}
53 53
 
54 54
 			return;
@@ -60,25 +60,25 @@  discard block
 block discarded – undo
60 60
 		// We also want to make sure that plugins which are deactivating are not
61 61
 		// considered "active" so that they will be removed from the cache now.
62 62
 		try {
63
-			$active_plugins = $this->plugins_handler->get_active_plugins( false, ! $this->was_included_by_autoloader );
64
-		} catch ( \Exception $ex ) {
63
+			$active_plugins = $this->plugins_handler->get_active_plugins(false, !$this->was_included_by_autoloader);
64
+		} catch (\Exception $ex) {
65 65
 			// When the package is deleted before shutdown it will throw an exception.
66 66
 			// In the event this happens we should erase the cache.
67
-			if ( ! empty( $this->cached_plugins ) ) {
68
-				$this->plugins_handler->cache_plugins( array() );
67
+			if (!empty($this->cached_plugins)) {
68
+				$this->plugins_handler->cache_plugins(array());
69 69
 			}
70 70
 			return;
71 71
 		}
72 72
 
73 73
 		// The paths should be sorted for easy comparisons with those loaded from the cache.
74 74
 		// Note we don't need to sort the cached entries because they're already sorted.
75
-		sort( $active_plugins );
75
+		sort($active_plugins);
76 76
 
77 77
 		// We don't want to waste time saving a cache that hasn't changed.
78
-		if ( $this->cached_plugins === $active_plugins ) {
78
+		if ($this->cached_plugins === $active_plugins) {
79 79
 			return;
80 80
 		}
81 81
 
82
-		$this->plugins_handler->cache_plugins( $active_plugins );
82
+		$this->plugins_handler->cache_plugins($active_plugins);
83 83
 	}
84 84
 }
Please login to merge, or discard this patch.
woocommerce-blocks/vendor/jetpack-autoloader/class-autoloader-handler.php 2 patches
Indentation   +129 added lines, -129 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 
8 8
 namespace Automattic\Jetpack\Autoloader\jp526c9128fcc85a1cd942451999a66eb0;
9 9
 
10
- // phpcs:ignore
10
+    // phpcs:ignore
11 11
 
12 12
 use Automattic\Jetpack\Autoloader\AutoloadGenerator;
13 13
 
@@ -16,132 +16,132 @@  discard block
 block discarded – undo
16 16
  */
17 17
 class Autoloader_Handler {
18 18
 
19
-	/**
20
-	 * The PHP_Autoloader instance.
21
-	 *
22
-	 * @var PHP_Autoloader
23
-	 */
24
-	private $php_autoloader;
25
-
26
-	/**
27
-	 * The Hook_Manager instance.
28
-	 *
29
-	 * @var Hook_Manager
30
-	 */
31
-	private $hook_manager;
32
-
33
-	/**
34
-	 * The Manifest_Reader instance.
35
-	 *
36
-	 * @var Manifest_Reader
37
-	 */
38
-	private $manifest_reader;
39
-
40
-	/**
41
-	 * The Version_Selector instance.
42
-	 *
43
-	 * @var Version_Selector
44
-	 */
45
-	private $version_selector;
46
-
47
-	/**
48
-	 * The constructor.
49
-	 *
50
-	 * @param PHP_Autoloader   $php_autoloader The PHP_Autoloader instance.
51
-	 * @param Hook_Manager     $hook_manager The Hook_Manager instance.
52
-	 * @param Manifest_Reader  $manifest_reader The Manifest_Reader instance.
53
-	 * @param Version_Selector $version_selector The Version_Selector instance.
54
-	 */
55
-	public function __construct( $php_autoloader, $hook_manager, $manifest_reader, $version_selector ) {
56
-		$this->php_autoloader   = $php_autoloader;
57
-		$this->hook_manager     = $hook_manager;
58
-		$this->manifest_reader  = $manifest_reader;
59
-		$this->version_selector = $version_selector;
60
-	}
61
-
62
-	/**
63
-	 * Checks to see whether or not an autoloader is currently in the process of initializing.
64
-	 *
65
-	 * @return bool
66
-	 */
67
-	public function is_initializing() {
68
-		// If no version has been set it means that no autoloader has started initializing yet.
69
-		global $jetpack_autoloader_latest_version;
70
-		if ( ! isset( $jetpack_autoloader_latest_version ) ) {
71
-			return false;
72
-		}
73
-
74
-		// When the version is set but the classmap is not it ALWAYS means that this is the
75
-		// latest autoloader and is being included by an older one.
76
-		global $jetpack_packages_classmap;
77
-		if ( empty( $jetpack_packages_classmap ) ) {
78
-			return true;
79
-		}
80
-
81
-		// Version 2.4.0 added a new global and altered the reset semantics. We need to check
82
-		// the other global as well since it may also point at initialization.
83
-		// Note: We don't need to check for the class first because every autoloader that
84
-		// will set the latest version global requires this class in the classmap.
85
-		$replacing_version = $jetpack_packages_classmap[ AutoloadGenerator::class ]['version'];
86
-		if ( $this->version_selector->is_dev_version( $replacing_version ) || version_compare( $replacing_version, '2.4.0.0', '>=' ) ) {
87
-			global $jetpack_autoloader_loader;
88
-			if ( ! isset( $jetpack_autoloader_loader ) ) {
89
-				return true;
90
-			}
91
-		}
92
-
93
-		return false;
94
-	}
95
-
96
-	/**
97
-	 * Activates an autoloader using the given plugins and activates it.
98
-	 *
99
-	 * @param string[] $plugins The plugins to initialize the autoloader for.
100
-	 */
101
-	public function activate_autoloader( $plugins ) {
102
-		global $jetpack_packages_psr4;
103
-		$jetpack_packages_psr4 = array();
104
-		$this->manifest_reader->read_manifests( $plugins, 'vendor/composer/jetpack_autoload_psr4.php', $jetpack_packages_psr4 );
105
-
106
-		global $jetpack_packages_classmap;
107
-		$jetpack_packages_classmap = array();
108
-		$this->manifest_reader->read_manifests( $plugins, 'vendor/composer/jetpack_autoload_classmap.php', $jetpack_packages_classmap );
109
-
110
-		global $jetpack_packages_filemap;
111
-		$jetpack_packages_filemap = array();
112
-		$this->manifest_reader->read_manifests( $plugins, 'vendor/composer/jetpack_autoload_filemap.php', $jetpack_packages_filemap );
113
-
114
-		$loader = new Version_Loader(
115
-			$this->version_selector,
116
-			$jetpack_packages_classmap,
117
-			$jetpack_packages_psr4,
118
-			$jetpack_packages_filemap
119
-		);
120
-
121
-		$this->php_autoloader->register_autoloader( $loader );
122
-
123
-		// Now that the autoloader is active we can load the filemap.
124
-		$loader->load_filemap();
125
-	}
126
-
127
-	/**
128
-	 * Resets the active autoloader and all related global state.
129
-	 */
130
-	public function reset_autoloader() {
131
-		$this->php_autoloader->unregister_autoloader();
132
-		$this->hook_manager->reset();
133
-
134
-		// Clear all of the autoloader globals so that older autoloaders don't do anything strange.
135
-		global $jetpack_autoloader_latest_version;
136
-		$jetpack_autoloader_latest_version = null;
137
-
138
-		global $jetpack_packages_classmap;
139
-		$jetpack_packages_classmap = array(); // Must be array to avoid exceptions in old autoloaders!
140
-
141
-		global $jetpack_packages_psr4;
142
-		$jetpack_packages_psr4 = array(); // Must be array to avoid exceptions in old autoloaders!
143
-
144
-		global $jetpack_packages_filemap;
145
-		$jetpack_packages_filemap = array(); // Must be array to avoid exceptions in old autoloaders!
146
-	}
19
+    /**
20
+     * The PHP_Autoloader instance.
21
+     *
22
+     * @var PHP_Autoloader
23
+     */
24
+    private $php_autoloader;
25
+
26
+    /**
27
+     * The Hook_Manager instance.
28
+     *
29
+     * @var Hook_Manager
30
+     */
31
+    private $hook_manager;
32
+
33
+    /**
34
+     * The Manifest_Reader instance.
35
+     *
36
+     * @var Manifest_Reader
37
+     */
38
+    private $manifest_reader;
39
+
40
+    /**
41
+     * The Version_Selector instance.
42
+     *
43
+     * @var Version_Selector
44
+     */
45
+    private $version_selector;
46
+
47
+    /**
48
+     * The constructor.
49
+     *
50
+     * @param PHP_Autoloader   $php_autoloader The PHP_Autoloader instance.
51
+     * @param Hook_Manager     $hook_manager The Hook_Manager instance.
52
+     * @param Manifest_Reader  $manifest_reader The Manifest_Reader instance.
53
+     * @param Version_Selector $version_selector The Version_Selector instance.
54
+     */
55
+    public function __construct( $php_autoloader, $hook_manager, $manifest_reader, $version_selector ) {
56
+        $this->php_autoloader   = $php_autoloader;
57
+        $this->hook_manager     = $hook_manager;
58
+        $this->manifest_reader  = $manifest_reader;
59
+        $this->version_selector = $version_selector;
60
+    }
61
+
62
+    /**
63
+     * Checks to see whether or not an autoloader is currently in the process of initializing.
64
+     *
65
+     * @return bool
66
+     */
67
+    public function is_initializing() {
68
+        // If no version has been set it means that no autoloader has started initializing yet.
69
+        global $jetpack_autoloader_latest_version;
70
+        if ( ! isset( $jetpack_autoloader_latest_version ) ) {
71
+            return false;
72
+        }
73
+
74
+        // When the version is set but the classmap is not it ALWAYS means that this is the
75
+        // latest autoloader and is being included by an older one.
76
+        global $jetpack_packages_classmap;
77
+        if ( empty( $jetpack_packages_classmap ) ) {
78
+            return true;
79
+        }
80
+
81
+        // Version 2.4.0 added a new global and altered the reset semantics. We need to check
82
+        // the other global as well since it may also point at initialization.
83
+        // Note: We don't need to check for the class first because every autoloader that
84
+        // will set the latest version global requires this class in the classmap.
85
+        $replacing_version = $jetpack_packages_classmap[ AutoloadGenerator::class ]['version'];
86
+        if ( $this->version_selector->is_dev_version( $replacing_version ) || version_compare( $replacing_version, '2.4.0.0', '>=' ) ) {
87
+            global $jetpack_autoloader_loader;
88
+            if ( ! isset( $jetpack_autoloader_loader ) ) {
89
+                return true;
90
+            }
91
+        }
92
+
93
+        return false;
94
+    }
95
+
96
+    /**
97
+     * Activates an autoloader using the given plugins and activates it.
98
+     *
99
+     * @param string[] $plugins The plugins to initialize the autoloader for.
100
+     */
101
+    public function activate_autoloader( $plugins ) {
102
+        global $jetpack_packages_psr4;
103
+        $jetpack_packages_psr4 = array();
104
+        $this->manifest_reader->read_manifests( $plugins, 'vendor/composer/jetpack_autoload_psr4.php', $jetpack_packages_psr4 );
105
+
106
+        global $jetpack_packages_classmap;
107
+        $jetpack_packages_classmap = array();
108
+        $this->manifest_reader->read_manifests( $plugins, 'vendor/composer/jetpack_autoload_classmap.php', $jetpack_packages_classmap );
109
+
110
+        global $jetpack_packages_filemap;
111
+        $jetpack_packages_filemap = array();
112
+        $this->manifest_reader->read_manifests( $plugins, 'vendor/composer/jetpack_autoload_filemap.php', $jetpack_packages_filemap );
113
+
114
+        $loader = new Version_Loader(
115
+            $this->version_selector,
116
+            $jetpack_packages_classmap,
117
+            $jetpack_packages_psr4,
118
+            $jetpack_packages_filemap
119
+        );
120
+
121
+        $this->php_autoloader->register_autoloader( $loader );
122
+
123
+        // Now that the autoloader is active we can load the filemap.
124
+        $loader->load_filemap();
125
+    }
126
+
127
+    /**
128
+     * Resets the active autoloader and all related global state.
129
+     */
130
+    public function reset_autoloader() {
131
+        $this->php_autoloader->unregister_autoloader();
132
+        $this->hook_manager->reset();
133
+
134
+        // Clear all of the autoloader globals so that older autoloaders don't do anything strange.
135
+        global $jetpack_autoloader_latest_version;
136
+        $jetpack_autoloader_latest_version = null;
137
+
138
+        global $jetpack_packages_classmap;
139
+        $jetpack_packages_classmap = array(); // Must be array to avoid exceptions in old autoloaders!
140
+
141
+        global $jetpack_packages_psr4;
142
+        $jetpack_packages_psr4 = array(); // Must be array to avoid exceptions in old autoloaders!
143
+
144
+        global $jetpack_packages_filemap;
145
+        $jetpack_packages_filemap = array(); // Must be array to avoid exceptions in old autoloaders!
146
+    }
147 147
 }
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	 * @param Manifest_Reader  $manifest_reader The Manifest_Reader instance.
45 45
 	 * @param Version_Selector $version_selector The Version_Selector instance.
46 46
 	 */
47
-	public function __construct( $php_autoloader, $hook_manager, $manifest_reader, $version_selector ) {
47
+	public function __construct($php_autoloader, $hook_manager, $manifest_reader, $version_selector) {
48 48
 		$this->php_autoloader   = $php_autoloader;
49 49
 		$this->hook_manager     = $hook_manager;
50 50
 		$this->manifest_reader  = $manifest_reader;
@@ -59,14 +59,14 @@  discard block
 block discarded – undo
59 59
 	public function is_initializing() {
60 60
 		// If no version has been set it means that no autoloader has started initializing yet.
61 61
 		global $jetpack_autoloader_latest_version;
62
-		if ( ! isset( $jetpack_autoloader_latest_version ) ) {
62
+		if (!isset($jetpack_autoloader_latest_version)) {
63 63
 			return false;
64 64
 		}
65 65
 
66 66
 		// When the version is set but the classmap is not it ALWAYS means that this is the
67 67
 		// latest autoloader and is being included by an older one.
68 68
 		global $jetpack_packages_classmap;
69
-		if ( empty( $jetpack_packages_classmap ) ) {
69
+		if (empty($jetpack_packages_classmap)) {
70 70
 			return true;
71 71
 		}
72 72
 
@@ -74,10 +74,10 @@  discard block
 block discarded – undo
74 74
 		// the other global as well since it may also point at initialization.
75 75
 		// Note: We don't need to check for the class first because every autoloader that
76 76
 		// will set the latest version global requires this class in the classmap.
77
-		$replacing_version = $jetpack_packages_classmap[ AutoloadGenerator::class ]['version'];
78
-		if ( $this->version_selector->is_dev_version( $replacing_version ) || version_compare( $replacing_version, '2.4.0.0', '>=' ) ) {
77
+		$replacing_version = $jetpack_packages_classmap[AutoloadGenerator::class]['version'];
78
+		if ($this->version_selector->is_dev_version($replacing_version) || version_compare($replacing_version, '2.4.0.0', '>=')) {
79 79
 			global $jetpack_autoloader_loader;
80
-			if ( ! isset( $jetpack_autoloader_loader ) ) {
80
+			if (!isset($jetpack_autoloader_loader)) {
81 81
 				return true;
82 82
 			}
83 83
 		}
@@ -90,18 +90,18 @@  discard block
 block discarded – undo
90 90
 	 *
91 91
 	 * @param string[] $plugins The plugins to initialize the autoloader for.
92 92
 	 */
93
-	public function activate_autoloader( $plugins ) {
93
+	public function activate_autoloader($plugins) {
94 94
 		global $jetpack_packages_psr4;
95 95
 		$jetpack_packages_psr4 = array();
96
-		$this->manifest_reader->read_manifests( $plugins, 'vendor/composer/jetpack_autoload_psr4.php', $jetpack_packages_psr4 );
96
+		$this->manifest_reader->read_manifests($plugins, 'vendor/composer/jetpack_autoload_psr4.php', $jetpack_packages_psr4);
97 97
 
98 98
 		global $jetpack_packages_classmap;
99 99
 		$jetpack_packages_classmap = array();
100
-		$this->manifest_reader->read_manifests( $plugins, 'vendor/composer/jetpack_autoload_classmap.php', $jetpack_packages_classmap );
100
+		$this->manifest_reader->read_manifests($plugins, 'vendor/composer/jetpack_autoload_classmap.php', $jetpack_packages_classmap);
101 101
 
102 102
 		global $jetpack_packages_filemap;
103 103
 		$jetpack_packages_filemap = array();
104
-		$this->manifest_reader->read_manifests( $plugins, 'vendor/composer/jetpack_autoload_filemap.php', $jetpack_packages_filemap );
104
+		$this->manifest_reader->read_manifests($plugins, 'vendor/composer/jetpack_autoload_filemap.php', $jetpack_packages_filemap);
105 105
 
106 106
 		$loader = new Version_Loader(
107 107
 			$this->version_selector,
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 			$jetpack_packages_filemap
111 111
 		);
112 112
 
113
-		$this->php_autoloader->register_autoloader( $loader );
113
+		$this->php_autoloader->register_autoloader($loader);
114 114
 
115 115
 		// Now that the autoloader is active we can load the filemap.
116 116
 		$loader->load_filemap();
Please login to merge, or discard this patch.
woocommerce-blocks/vendor/jetpack-autoloader/class-manifest-reader.php 2 patches
Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -7,93 +7,93 @@
 block discarded – undo
7 7
 
8 8
 namespace Automattic\Jetpack\Autoloader\jp526c9128fcc85a1cd942451999a66eb0;
9 9
 
10
- // phpcs:ignore
10
+    // phpcs:ignore
11 11
 
12 12
 /**
13 13
  * This class reads autoloader manifest files.
14 14
  */
15 15
 class Manifest_Reader {
16 16
 
17
-	/**
18
-	 * The Version_Selector object.
19
-	 *
20
-	 * @var Version_Selector
21
-	 */
22
-	private $version_selector;
17
+    /**
18
+     * The Version_Selector object.
19
+     *
20
+     * @var Version_Selector
21
+     */
22
+    private $version_selector;
23 23
 
24
-	/**
25
-	 * The constructor.
26
-	 *
27
-	 * @param Version_Selector $version_selector The Version_Selector object.
28
-	 */
29
-	public function __construct( $version_selector ) {
30
-		$this->version_selector = $version_selector;
31
-	}
24
+    /**
25
+     * The constructor.
26
+     *
27
+     * @param Version_Selector $version_selector The Version_Selector object.
28
+     */
29
+    public function __construct( $version_selector ) {
30
+        $this->version_selector = $version_selector;
31
+    }
32 32
 
33
-	/**
34
-	 * Reads all of the manifests in the given plugin paths.
35
-	 *
36
-	 * @param array  $plugin_paths  The paths to the plugins we're loading the manifest in.
37
-	 * @param string $manifest_path The path that we're loading the manifest from in each plugin.
38
-	 * @param array  $path_map The path map to add the contents of the manifests to.
39
-	 *
40
-	 * @return array $path_map The path map we've built using the manifests in each plugin.
41
-	 */
42
-	public function read_manifests( $plugin_paths, $manifest_path, &$path_map ) {
43
-		$file_paths = array_map(
44
-			function ( $path ) use ( $manifest_path ) {
45
-				return trailingslashit( $path ) . $manifest_path;
46
-			},
47
-			$plugin_paths
48
-		);
33
+    /**
34
+     * Reads all of the manifests in the given plugin paths.
35
+     *
36
+     * @param array  $plugin_paths  The paths to the plugins we're loading the manifest in.
37
+     * @param string $manifest_path The path that we're loading the manifest from in each plugin.
38
+     * @param array  $path_map The path map to add the contents of the manifests to.
39
+     *
40
+     * @return array $path_map The path map we've built using the manifests in each plugin.
41
+     */
42
+    public function read_manifests( $plugin_paths, $manifest_path, &$path_map ) {
43
+        $file_paths = array_map(
44
+            function ( $path ) use ( $manifest_path ) {
45
+                return trailingslashit( $path ) . $manifest_path;
46
+            },
47
+            $plugin_paths
48
+        );
49 49
 
50
-		foreach ( $file_paths as $path ) {
51
-			$this->register_manifest( $path, $path_map );
52
-		}
50
+        foreach ( $file_paths as $path ) {
51
+            $this->register_manifest( $path, $path_map );
52
+        }
53 53
 
54
-		return $path_map;
55
-	}
54
+        return $path_map;
55
+    }
56 56
 
57
-	/**
58
-	 * Registers a plugin's manifest file with the path map.
59
-	 *
60
-	 * @param string $manifest_path The absolute path to the manifest that we're loading.
61
-	 * @param array  $path_map The path map to add the contents of the manifest to.
62
-	 */
63
-	protected function register_manifest( $manifest_path, &$path_map ) {
64
-		if ( ! is_readable( $manifest_path ) ) {
65
-			return;
66
-		}
57
+    /**
58
+     * Registers a plugin's manifest file with the path map.
59
+     *
60
+     * @param string $manifest_path The absolute path to the manifest that we're loading.
61
+     * @param array  $path_map The path map to add the contents of the manifest to.
62
+     */
63
+    protected function register_manifest( $manifest_path, &$path_map ) {
64
+        if ( ! is_readable( $manifest_path ) ) {
65
+            return;
66
+        }
67 67
 
68
-		$manifest = require $manifest_path;
69
-		if ( ! is_array( $manifest ) ) {
70
-			return;
71
-		}
68
+        $manifest = require $manifest_path;
69
+        if ( ! is_array( $manifest ) ) {
70
+            return;
71
+        }
72 72
 
73
-		foreach ( $manifest as $key => $data ) {
74
-			$this->register_record( $key, $data, $path_map );
75
-		}
76
-	}
73
+        foreach ( $manifest as $key => $data ) {
74
+            $this->register_record( $key, $data, $path_map );
75
+        }
76
+    }
77 77
 
78
-	/**
79
-	 * Registers an entry from the manifest in the path map.
80
-	 *
81
-	 * @param string $key The identifier for the entry we're registering.
82
-	 * @param array  $data The data for the entry we're registering.
83
-	 * @param array  $path_map The path map to add the contents of the manifest to.
84
-	 */
85
-	protected function register_record( $key, $data, &$path_map ) {
86
-		if ( isset( $path_map[ $key ]['version'] ) ) {
87
-			$selected_version = $path_map[ $key ]['version'];
88
-		} else {
89
-			$selected_version = null;
90
-		}
78
+    /**
79
+     * Registers an entry from the manifest in the path map.
80
+     *
81
+     * @param string $key The identifier for the entry we're registering.
82
+     * @param array  $data The data for the entry we're registering.
83
+     * @param array  $path_map The path map to add the contents of the manifest to.
84
+     */
85
+    protected function register_record( $key, $data, &$path_map ) {
86
+        if ( isset( $path_map[ $key ]['version'] ) ) {
87
+            $selected_version = $path_map[ $key ]['version'];
88
+        } else {
89
+            $selected_version = null;
90
+        }
91 91
 
92
-		if ( $this->version_selector->is_version_update_required( $selected_version, $data['version'] ) ) {
93
-			$path_map[ $key ] = array(
94
-				'version' => $data['version'],
95
-				'path'    => $data['path'],
96
-			);
97
-		}
98
-	}
92
+        if ( $this->version_selector->is_version_update_required( $selected_version, $data['version'] ) ) {
93
+            $path_map[ $key ] = array(
94
+                'version' => $data['version'],
95
+                'path'    => $data['path'],
96
+            );
97
+        }
98
+    }
99 99
 }
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 	 *
19 19
 	 * @param Version_Selector $version_selector The Version_Selector object.
20 20
 	 */
21
-	public function __construct( $version_selector ) {
21
+	public function __construct($version_selector) {
22 22
 		$this->version_selector = $version_selector;
23 23
 	}
24 24
 
@@ -31,16 +31,16 @@  discard block
 block discarded – undo
31 31
 	 *
32 32
 	 * @return array $path_map The path map we've built using the manifests in each plugin.
33 33
 	 */
34
-	public function read_manifests( $plugin_paths, $manifest_path, &$path_map ) {
34
+	public function read_manifests($plugin_paths, $manifest_path, &$path_map) {
35 35
 		$file_paths = array_map(
36
-			function ( $path ) use ( $manifest_path ) {
37
-				return trailingslashit( $path ) . $manifest_path;
36
+			function($path) use ($manifest_path) {
37
+				return trailingslashit($path) . $manifest_path;
38 38
 			},
39 39
 			$plugin_paths
40 40
 		);
41 41
 
42
-		foreach ( $file_paths as $path ) {
43
-			$this->register_manifest( $path, $path_map );
42
+		foreach ($file_paths as $path) {
43
+			$this->register_manifest($path, $path_map);
44 44
 		}
45 45
 
46 46
 		return $path_map;
@@ -52,18 +52,18 @@  discard block
 block discarded – undo
52 52
 	 * @param string $manifest_path The absolute path to the manifest that we're loading.
53 53
 	 * @param array  $path_map The path map to add the contents of the manifest to.
54 54
 	 */
55
-	protected function register_manifest( $manifest_path, &$path_map ) {
56
-		if ( ! is_readable( $manifest_path ) ) {
55
+	protected function register_manifest($manifest_path, &$path_map) {
56
+		if (!is_readable($manifest_path)) {
57 57
 			return;
58 58
 		}
59 59
 
60 60
 		$manifest = require $manifest_path;
61
-		if ( ! is_array( $manifest ) ) {
61
+		if (!is_array($manifest)) {
62 62
 			return;
63 63
 		}
64 64
 
65
-		foreach ( $manifest as $key => $data ) {
66
-			$this->register_record( $key, $data, $path_map );
65
+		foreach ($manifest as $key => $data) {
66
+			$this->register_record($key, $data, $path_map);
67 67
 		}
68 68
 	}
69 69
 
@@ -74,15 +74,15 @@  discard block
 block discarded – undo
74 74
 	 * @param array  $data The data for the entry we're registering.
75 75
 	 * @param array  $path_map The path map to add the contents of the manifest to.
76 76
 	 */
77
-	protected function register_record( $key, $data, &$path_map ) {
78
-		if ( isset( $path_map[ $key ]['version'] ) ) {
79
-			$selected_version = $path_map[ $key ]['version'];
77
+	protected function register_record($key, $data, &$path_map) {
78
+		if (isset($path_map[$key]['version'])) {
79
+			$selected_version = $path_map[$key]['version'];
80 80
 		} else {
81 81
 			$selected_version = null;
82 82
 		}
83 83
 
84
-		if ( $this->version_selector->is_version_update_required( $selected_version, $data['version'] ) ) {
85
-			$path_map[ $key ] = array(
84
+		if ($this->version_selector->is_version_update_required($selected_version, $data['version'])) {
85
+			$path_map[$key] = array(
86 86
 				'version' => $data['version'],
87 87
 				'path'    => $data['path'],
88 88
 			);
Please login to merge, or discard this patch.