Conditions | 4 |
Paths | 4 |
Total Lines | 18 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
CRAP Score | 4.407 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
60 | 27 | public function __construct( $type, $file ) { |
|
61 | 27 | $this->type = new ConfigType( $type ); |
|
62 | 27 | $this->file = $file; |
|
63 | |||
64 | 27 | switch ( $this->type->getValue() ) { |
|
65 | 27 | case ConfigType::PLUGIN: |
|
66 | 27 | case ConfigType::MU_PLUGIN: |
|
67 | 27 | $this->url = plugin_dir_url( $file ); |
|
68 | 27 | $this->path = plugin_dir_path( $file ); |
|
69 | 27 | $this->slug = dirname( $this->basename = plugin_basename( $file ) ); |
|
70 | 27 | break; |
|
71 | case ConfigType::THEME: |
||
72 | $this->url = get_stylesheet_directory_uri() . '/'; |
||
73 | $this->path = get_stylesheet_directory() . '/'; |
||
74 | $this->slug = dirname( $this->basename = plugin_basename( $file ) ); |
||
75 | break; |
||
76 | 27 | } |
|
77 | 27 | } |
|
78 | |||
100 |