@@ -40,14 +40,14 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | protected $base_path; |
| 42 | 42 | |
| 43 | - public function __construct( ?string $base_path = null ) { |
|
| 43 | + public function __construct(?string $base_path = null) { |
|
| 44 | 44 | $this->app = new App(); |
| 45 | 45 | |
| 46 | - if ( null === $base_path ) { |
|
| 46 | + if (null === $base_path) { |
|
| 47 | 47 | $trace = debug_backtrace(); //phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_debug_backtrace |
| 48 | - $this->base_path = isset( $trace[0]['file'] ) ? \trailingslashit( dirname( $trace[0]['file'] ) ) : __DIR__; |
|
| 48 | + $this->base_path = isset($trace[0]['file']) ? \trailingslashit(dirname($trace[0]['file'])) : __DIR__; |
|
| 49 | 49 | } else { |
| 50 | - $this->base_path = \trailingslashit( $base_path ); |
|
| 50 | + $this->base_path = \trailingslashit($base_path); |
|
| 51 | 51 | } |
| 52 | 52 | } |
| 53 | 53 | |
@@ -61,25 +61,25 @@ discard block |
||
| 61 | 61 | * |
| 62 | 62 | * @return self |
| 63 | 63 | */ |
| 64 | - public function with_wp_dice( bool $include_default_rules = false ): self { |
|
| 64 | + public function with_wp_dice(bool $include_default_rules = false): self { |
|
| 65 | 65 | $loader = new Hook_Loader(); |
| 66 | 66 | |
| 67 | 67 | // Setup DI Container |
| 68 | - $container = PinkCrab_Dice::withDice( new Dice() ); |
|
| 68 | + $container = PinkCrab_Dice::withDice(new Dice()); |
|
| 69 | 69 | |
| 70 | - if ( $include_default_rules === true ) { |
|
| 71 | - $container->addRules( $this->default_di_rules() ); |
|
| 70 | + if ($include_default_rules === true) { |
|
| 71 | + $container->addRules($this->default_di_rules()); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - $this->app->set_container( $container ); |
|
| 74 | + $this->app->set_container($container); |
|
| 75 | 75 | |
| 76 | 76 | // Set registration middleware |
| 77 | - $this->app->set_registration_services( new Registration_Service() ); |
|
| 77 | + $this->app->set_registration_services(new Registration_Service()); |
|
| 78 | 78 | |
| 79 | - $this->app->set_loader( $loader ); |
|
| 79 | + $this->app->set_loader($loader); |
|
| 80 | 80 | |
| 81 | 81 | // Include Hookable. |
| 82 | - $this->app->registration_middleware( new Hookable_Middleware() ); |
|
| 82 | + $this->app->registration_middleware(new Hookable_Middleware()); |
|
| 83 | 83 | |
| 84 | 84 | return $this; |
| 85 | 85 | } |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | return array( |
| 95 | 95 | '*' => array( |
| 96 | 96 | 'substitutions' => array( |
| 97 | - Renderable::class => new PHP_Engine( $this->base_path ), |
|
| 97 | + Renderable::class => new PHP_Engine($this->base_path), |
|
| 98 | 98 | ), |
| 99 | 99 | ), |
| 100 | 100 | ); |
@@ -106,10 +106,10 @@ discard block |
||
| 106 | 106 | * @param array<string,array<string,string|object|callable|null|false|\Closure>> $rules |
| 107 | 107 | * @return self |
| 108 | 108 | */ |
| 109 | - public function di_rules( array $rules ): self { |
|
| 109 | + public function di_rules(array $rules): self { |
|
| 110 | 110 | $this->app->container_config( |
| 111 | - function( DI_Container $container ) use ( $rules ): void { |
|
| 112 | - $container->addRules( $rules ); |
|
| 111 | + function(DI_Container $container) use ($rules): void { |
|
| 112 | + $container->addRules($rules); |
|
| 113 | 113 | } |
| 114 | 114 | ); |
| 115 | 115 | return $this; |
@@ -121,8 +121,8 @@ discard block |
||
| 121 | 121 | * @param array<int, string> $class_list Array of fully namespaced class names. |
| 122 | 122 | * @return self |
| 123 | 123 | */ |
| 124 | - public function registration_classes( array $class_list ): self { |
|
| 125 | - $this->app->registration_classes( $class_list ); |
|
| 124 | + public function registration_classes(array $class_list): self { |
|
| 125 | + $this->app->registration_classes($class_list); |
|
| 126 | 126 | return $this; |
| 127 | 127 | } |
| 128 | 128 | |
@@ -132,8 +132,8 @@ discard block |
||
| 132 | 132 | * @param array<string, mixed> $app_config |
| 133 | 133 | * @return self |
| 134 | 134 | */ |
| 135 | - public function app_config( array $app_config ): self { |
|
| 136 | - $this->app->set_app_config( array_merge( $this->default_config_paths(), $app_config ) ); |
|
| 135 | + public function app_config(array $app_config): self { |
|
| 136 | + $this->app->set_app_config(array_merge($this->default_config_paths(), $app_config)); |
|
| 137 | 137 | return $this; |
| 138 | 138 | } |
| 139 | 139 | |
@@ -153,8 +153,8 @@ discard block |
||
| 153 | 153 | */ |
| 154 | 154 | public function boot(): App { |
| 155 | 155 | // Sets default settings if not already set. |
| 156 | - if ( ! $this->app->has_app_config() ) { |
|
| 157 | - $this->app_config( $this->default_config_paths() ); |
|
| 156 | + if ( ! $this->app->has_app_config()) { |
|
| 157 | + $this->app_config($this->default_config_paths()); |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | return $this->app->boot(); |
@@ -185,16 +185,16 @@ discard block |
||
| 185 | 185 | |
| 186 | 186 | return array( |
| 187 | 187 | 'path' => array( |
| 188 | - 'plugin' => rtrim( $this->base_path, \DIRECTORY_SEPARATOR ), |
|
| 189 | - 'view' => rtrim( $this->base_path, \DIRECTORY_SEPARATOR ) . '/views', |
|
| 190 | - 'assets' => rtrim( $this->base_path, \DIRECTORY_SEPARATOR ) . '/assets', |
|
| 188 | + 'plugin' => rtrim($this->base_path, \DIRECTORY_SEPARATOR), |
|
| 189 | + 'view' => rtrim($this->base_path, \DIRECTORY_SEPARATOR) . '/views', |
|
| 190 | + 'assets' => rtrim($this->base_path, \DIRECTORY_SEPARATOR) . '/assets', |
|
| 191 | 191 | 'upload_root' => $wp_uploads['basedir'], |
| 192 | 192 | 'upload_current' => $wp_uploads['path'], |
| 193 | 193 | ), |
| 194 | 194 | 'url' => array( |
| 195 | - 'plugin' => rtrim( plugins_url( basename( $this->base_path ) ), \DIRECTORY_SEPARATOR ), |
|
| 196 | - 'view' => rtrim( plugins_url( basename( $this->base_path ) ), \DIRECTORY_SEPARATOR ) . '/views', |
|
| 197 | - 'assets' => rtrim( plugins_url( basename( $this->base_path ) ), \DIRECTORY_SEPARATOR ) . '/assets', |
|
| 195 | + 'plugin' => rtrim(plugins_url(basename($this->base_path)), \DIRECTORY_SEPARATOR), |
|
| 196 | + 'view' => rtrim(plugins_url(basename($this->base_path)), \DIRECTORY_SEPARATOR) . '/views', |
|
| 197 | + 'assets' => rtrim(plugins_url(basename($this->base_path)), \DIRECTORY_SEPARATOR) . '/assets', |
|
| 198 | 198 | 'upload_root' => $wp_uploads['baseurl'], |
| 199 | 199 | 'upload_current' => $wp_uploads['url'], |
| 200 | 200 | ), |
@@ -208,8 +208,8 @@ discard block |
||
| 208 | 208 | * @return self |
| 209 | 209 | * @throws App_Initialization_Exception Code 3 |
| 210 | 210 | */ |
| 211 | - public function registration_middleware( Registration_Middleware $middleware ): self { |
|
| 212 | - $this->app->registration_middleware( $middleware ); |
|
| 211 | + public function registration_middleware(Registration_Middleware $middleware): self { |
|
| 212 | + $this->app->registration_middleware($middleware); |
|
| 213 | 213 | return $this; |
| 214 | 214 | } |
| 215 | 215 | |
@@ -222,8 +222,8 @@ discard block |
||
| 222 | 222 | * @throws App_Initialization_Exception Code 1 If DI container not registered |
| 223 | 223 | * @throws App_Initialization_Exception Code 9 If class doesn't create as middleware. |
| 224 | 224 | */ |
| 225 | - public function construct_registration_middleware( string $class_name ): self { |
|
| 226 | - $this->app->construct_registration_middleware( $class_name ); |
|
| 225 | + public function construct_registration_middleware(string $class_name): self { |
|
| 226 | + $this->app->construct_registration_middleware($class_name); |
|
| 227 | 227 | return $this; |
| 228 | 228 | } |
| 229 | 229 | } |