Conditions | 4 |
Paths | 4 |
Total Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 20 |
Changes | 0 |
1 | <?php |
||
95 | public function get_config_json( $filename ) { |
||
96 | if ( isset( $this->loaded[ $filename ] ) ) { |
||
97 | return $this->loaded[ $filename ]; |
||
98 | } |
||
99 | |||
100 | $config = $this->path . 'config/' . $filename . '.json'; |
||
101 | |||
102 | if ( ! file_exists( $config ) ) { |
||
103 | return null; |
||
104 | } |
||
105 | |||
106 | $contents = file_get_contents( $config ); |
||
|
|||
107 | |||
108 | if ( false === $contents ) { |
||
109 | return null; |
||
110 | } |
||
111 | |||
112 | return $this->loaded[ $filename ] = json_decode( $contents, true ); |
||
113 | } |
||
114 | } |
||
115 |