@@ -66,21 +66,21 @@ discard block |
||
| 66 | 66 | * @param string $type |
| 67 | 67 | * @param string $file |
| 68 | 68 | */ |
| 69 | - public function __construct( $type, $file ) { |
|
| 70 | - $this->type = new ConfigType( $type ); |
|
| 69 | + public function __construct($type, $file) { |
|
| 70 | + $this->type = new ConfigType($type); |
|
| 71 | 71 | $this->file = $file; |
| 72 | 72 | |
| 73 | - switch ( $this->type->getValue() ) { |
|
| 73 | + switch ($this->type->getValue()) { |
|
| 74 | 74 | case ConfigType::PLUGIN: |
| 75 | 75 | case ConfigType::MU_PLUGIN: |
| 76 | - $this->url = plugin_dir_url( $file ); |
|
| 77 | - $this->path = plugin_dir_path( $file ); |
|
| 78 | - $this->slug = dirname( $this->basename = plugin_basename( $file ) ); |
|
| 76 | + $this->url = plugin_dir_url($file); |
|
| 77 | + $this->path = plugin_dir_path($file); |
|
| 78 | + $this->slug = dirname($this->basename = plugin_basename($file)); |
|
| 79 | 79 | break; |
| 80 | 80 | case ConfigType::THEME: |
| 81 | - $this->url = get_stylesheet_directory_uri() . '/'; |
|
| 82 | - $this->path = get_stylesheet_directory() . '/'; |
|
| 83 | - $this->slug = dirname( $this->basename = plugin_basename( $file ) ); |
|
| 81 | + $this->url = get_stylesheet_directory_uri().'/'; |
|
| 82 | + $this->path = get_stylesheet_directory().'/'; |
|
| 83 | + $this->slug = dirname($this->basename = plugin_basename($file)); |
|
| 84 | 84 | break; |
| 85 | 85 | } |
| 86 | 86 | } |
@@ -92,23 +92,23 @@ discard block |
||
| 92 | 92 | * |
| 93 | 93 | * @return array|null |
| 94 | 94 | */ |
| 95 | - public function get_config_json( $filename ) { |
|
| 96 | - if ( isset( $this->loaded[ $filename ] ) ) { |
|
| 97 | - return $this->loaded[ $filename ]; |
|
| 95 | + public function get_config_json($filename) { |
|
| 96 | + if (isset($this->loaded[$filename])) { |
|
| 97 | + return $this->loaded[$filename]; |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - $config = $this->path . 'config/' . $filename . '.json'; |
|
| 100 | + $config = $this->path.'config/'.$filename.'.json'; |
|
| 101 | 101 | |
| 102 | - if ( ! file_exists( $config ) ) { |
|
| 102 | + if (!file_exists($config)) { |
|
| 103 | 103 | return null; |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - $contents = file_get_contents( $config ); |
|
| 106 | + $contents = file_get_contents($config); |
|
| 107 | 107 | |
| 108 | - if ( false === $contents ) { |
|
| 108 | + if (false === $contents) { |
|
| 109 | 109 | return null; |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | - return $this->loaded[ $filename ] = json_decode( $contents, true ); |
|
| 112 | + return $this->loaded[$filename] = json_decode($contents, true); |
|
| 113 | 113 | } |
| 114 | 114 | } |