← All changes
|
vendor/jetpack-autoloader/class-version-loader.php
+23
-3
13.2.4
→
16.3-a.1
View file →
| @@ -4,9 +4,9 @@ | ||
| 4 | 4 | * |
| 5 | 5 | * @package automattic/jetpack-autoloader |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | -namespace Automattic\Jetpack\Autoloader\jpf11009ded9fc4592b6a05b61ce272b3c_jetpackⓥ13_2_2\al3_0_2; | |
| 8 | +namespace Automattic\Jetpack\Autoloader\jpf11009ded9fc4592b6a05b61ce272b3c_jetpackⓥ16_3_a_1\al6_0_0; | |
| 9 | 9 | |
| 10 | 10 | // phpcs:ignore |
| 11 | 11 | |
| 12 | 12 | /** |
| @@ -57,8 +57,28 @@ | ||
| 57 | 57 | $this->filemap = $filemap; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | /** |
| 61 | + * Fetch the classmap. | |
| 62 | + * | |
| 63 | + * @since 3.1.0 | |
| 64 | + * @return array<string, array> | |
| 65 | + */ | |
| 66 | + public function get_class_map() { | |
| 67 | + return $this->classmap; | |
| 68 | + } | |
| 69 | + | |
| 70 | + /** | |
| 71 | + * Fetch the psr-4 mappings. | |
| 72 | + * | |
| 73 | + * @since 3.1.0 | |
| 74 | + * @return array<string, array> | |
| 75 | + */ | |
| 76 | + public function get_psr4_map() { | |
| 77 | + return $this->psr4_map; | |
| 78 | + } | |
| 79 | + | |
| 80 | + /** | |
| 61 | 81 | * Finds the file path for the given class. |
| 62 | 82 | * |
| 63 | 83 | * @param string $class_name The class to find. |
| 64 | 84 | * |
| @@ -65,9 +85,9 @@ | ||
| 65 | 85 | * @return string|null $file_path The path to the file if found, null if no class was found. |
| 66 | 86 | */ |
| 67 | 87 | public function find_class_file( $class_name ) { |
| 68 | 88 | $data = $this->select_newest_file( |
| 69 | - isset( $this->classmap[ $class_name ] ) ? $this->classmap[ $class_name ] : null, | |
| 89 | + $this->classmap[ $class_name ] ?? null, | |
| 70 | 90 | $this->find_psr4_file( $class_name ) |
| 71 | 91 | ); |
| 72 | 92 | if ( ! isset( $data ) ) { |
| 73 | 93 | return null; |
| @@ -122,9 +142,9 @@ | ||
| 122 | 142 | * |
| 123 | 143 | * @return array|null $data The version and path path to the file if found, null otherwise. |
| 124 | 144 | */ |
| 125 | 145 | private function find_psr4_file( $class_name ) { |
| 126 | - if ( ! isset( $this->psr4_map ) ) { | |
| 146 | + if ( empty( $this->psr4_map ) ) { | |
| 127 | 147 | return null; |
| 128 | 148 | } |
| 129 | 149 | |
| 130 | 150 | // Don't bother with classes that have no namespace. |