Passed
Pull Request — master (#117)
by Glynn
02:41
created
src/Services/Container_Aware_Traits/Inject_DI_Container_Aware.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
 	 * @param DI_Container $container
42 42
 	 * @return void
43 43
 	 */
44
-	public function set_di_container( DI_Container $container ): void {
44
+	public function set_di_container(DI_Container $container): void {
45 45
 		$this->di_container = $container;
46 46
 	}
47 47
 }
Please login to merge, or discard this patch.
src/Services/Container_Aware_Traits/Inject_App_Config_Aware.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
 	 * @param App_Config $app_config
42 42
 	 * @return void
43 43
 	 */
44
-	public function set_app_config( App_Config $app_config ): void {
44
+	public function set_app_config(App_Config $app_config): void {
45 45
 		$this->app_config = $app_config;
46 46
 	}
47 47
 }
Please login to merge, or discard this patch.
src/Services/Container_Aware_Traits/Inject_Hook_Loader_Aware.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
 	 * @param Hook_Loader $container
42 42
 	 * @return void
43 43
 	 */
44
-	public function set_hook_loader( Hook_Loader $hook_loader ): void {
44
+	public function set_hook_loader(Hook_Loader $hook_loader): void {
45 45
 		$this->loader = $hook_loader;
46 46
 	}
47 47
 }
Please login to merge, or discard this patch.
src/Services/Registration/Middleware/Hookable_Middleware.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	 * @param Hook_Loader $loader
42 42
 	 * @return void
43 43
 	 */
44
-	public function set_hook_loader( Hook_Loader $loader ):void {
44
+	public function set_hook_loader(Hook_Loader $loader):void {
45 45
 		$this->loader = $loader;
46 46
 	}
47 47
 
@@ -51,10 +51,10 @@  discard block
 block discarded – undo
51 51
 	 * @param object $class
52 52
 	 * @return object
53 53
 	 */
54
-	public function process( $class ) {
55
-		if ( in_array( Hookable::class, class_implements( $class ) ?: array(), true ) ) {
54
+	public function process($class) {
55
+		if (in_array(Hookable::class, class_implements($class) ?: array(), true)) {
56 56
 			/** @phpstan-ignore-next-line class must implement register for interface*/
57
-			$class->register( $this->loader );
57
+			$class->register($this->loader);
58 58
 		}
59 59
 		return $class;
60 60
 	}
Please login to merge, or discard this patch.
src/Services/View/Component/Component.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -34,14 +34,14 @@
 block discarded – undo
34 34
 	 */
35 35
 	public function get_variables(): array {
36 36
 		// Get all Private, public and protected properties.
37
-		$reflect = new \ReflectionClass( get_class( $this ) );
37
+		$reflect = new \ReflectionClass(get_class($this));
38 38
 		$vars    = array();
39 39
 
40
-		foreach ( $reflect->getProperties( \ReflectionProperty::IS_PUBLIC | \ReflectionProperty::IS_PRIVATE | \ReflectionProperty::IS_PROTECTED )
40
+		foreach ($reflect->getProperties(\ReflectionProperty::IS_PUBLIC | \ReflectionProperty::IS_PRIVATE | \ReflectionProperty::IS_PROTECTED)
41 41
 			as $var
42 42
 		) {
43
-			$var->setAccessible( true );
44
-			$vars[ $var->getName() ] = $var->getValue( $this );
43
+			$var->setAccessible(true);
44
+			$vars[$var->getName()] = $var->getValue($this);
45 45
 		}
46 46
 
47 47
 		return $vars;
Please login to merge, or discard this patch.
src/Services/View/View_Model.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@
 block discarded – undo
42 42
 	private $data = array();
43 43
 
44 44
 	/** @param array<string, mixed> $data */
45
-	public function __construct( string $template, array $data = array() ) {
45
+	public function __construct(string $template, array $data = array()) {
46 46
 		$this->template = $template;
47 47
 		$this->data     = $data;
48 48
 	}
Please login to merge, or discard this patch.
src/Services/View/View.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -61,12 +61,12 @@  discard block
 block discarded – undo
61 61
 	 *
62 62
 	 * @param Renderable $engine
63 63
 	 */
64
-	public function __construct( Renderable $engine, Component_Compiler $component_compiler ) {
64
+	public function __construct(Renderable $engine, Component_Compiler $component_compiler) {
65 65
 		$this->engine             = $engine;
66 66
 		$this->component_compiler = $component_compiler;
67 67
 
68 68
 		// Populate engine with compiler.
69
-		$this->engine->set_component_compiler( $component_compiler );
69
+		$this->engine->set_component_compiler($component_compiler);
70 70
 	}
71 71
 
72 72
 	/**
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
 	 * @param bool $print Print or Return the HTML
78 78
 	 * @return string|void
79 79
 	 */
80
-	public function render( string $view, iterable $view_data = array(), bool $print = self::PRINT_VIEW ) {
81
-		return $this->engine->render( $view, $view_data, $print );
80
+	public function render(string $view, iterable $view_data = array(), bool $print = self::PRINT_VIEW) {
81
+		return $this->engine->render($view, $view_data, $print);
82 82
 	}
83 83
 
84 84
 	/**
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
 	 * @param bool $print Print or Return the HTML
89 89
 	 * @return string|void
90 90
 	 */
91
-	public function component( Component $component, bool $print = self::PRINT_VIEW ) {
92
-		return $this->engine->component( $component, $print );
91
+	public function component(Component $component, bool $print = self::PRINT_VIEW) {
92
+		return $this->engine->component($component, $print);
93 93
 	}
94 94
 
95 95
 	/**
@@ -99,8 +99,8 @@  discard block
 block discarded – undo
99 99
 	 * @param bool $print Print or Return the HTML
100 100
 	 * @return string|void
101 101
 	 */
102
-	public function view_model( View_Model $view_model, bool $print = self::PRINT_VIEW ) {
103
-		return $this->engine->view_model( $view_model, $print );
102
+	public function view_model(View_Model $view_model, bool $print = self::PRINT_VIEW) {
103
+		return $this->engine->view_model($view_model, $print);
104 104
 	}
105 105
 
106 106
 	/**
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	 * @param callable $to_buffer
110 110
 	 * @return string
111 111
 	 */
112
-	public static function print_buffer( callable $to_buffer ): string {
112
+	public static function print_buffer(callable $to_buffer): string {
113 113
 		ob_start();
114 114
 		$to_buffer();
115 115
 		$output = ob_get_contents();
Please login to merge, or discard this patch.
src/Application/App_Validation.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	/** @var App */
44 44
 	private $app;
45 45
 
46
-	public function __construct( App $app ) {
46
+	public function __construct(App $app) {
47 47
 		$this->app = $app;
48 48
 	}
49 49
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	public function validate(): bool {
56 56
 		$this->already_booted();
57 57
 		$this->validate_properties_set();
58
-		return count( $this->errors ) === 0;
58
+		return count($this->errors) === 0;
59 59
 	}
60 60
 
61 61
 	/**
@@ -65,11 +65,11 @@  discard block
 block discarded – undo
65 65
 	 * @return void
66 66
 	 */
67 67
 	private function validate_properties_set(): void {
68
-		foreach ( $this->required_properties as $property => $is_static ) {
69
-			$property_reflection = new ReflectionProperty( $this->app, $property );
70
-			$property_reflection->setAccessible( true );
71
-			if ( empty( $property_reflection->getValue( $this->app ) ) ) {
72
-				$this->errors[] = \sprintf( self::ERROR_MESSAGE_TEMPLATE, $property );
68
+		foreach ($this->required_properties as $property => $is_static) {
69
+			$property_reflection = new ReflectionProperty($this->app, $property);
70
+			$property_reflection->setAccessible(true);
71
+			if (empty($property_reflection->getValue($this->app))) {
72
+				$this->errors[] = \sprintf(self::ERROR_MESSAGE_TEMPLATE, $property);
73 73
 			}
74 74
 		}
75 75
 	}
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	 * @return void
81 81
 	 */
82 82
 	private function already_booted(): void {
83
-		if ( $this->app->is_booted() === true ) {
83
+		if ($this->app->is_booted() === true) {
84 84
 			$this->errors[] = self::ERROR_MESSAGE_APP_BOOTED;
85 85
 		}
86 86
 	}
Please login to merge, or discard this patch.
src/Application/App_Factory.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -61,11 +61,11 @@
 block discarded – undo
61 61
 	}
62 62
 
63 63
 		/**
64
-	 * Gets the defined base path.
65
-	 *
66
-	 * @return string
67
-	 * @since 1.4.0
68
-	 */
64
+		 * Gets the defined base path.
65
+		 *
66
+		 * @return string
67
+		 * @since 1.4.0
68
+		 */
69 69
 	public function get_base_path(): string {
70 70
 		return $this->base_path;
71 71
 	}
Please login to merge, or discard this patch.
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -48,15 +48,15 @@  discard block
 block discarded – undo
48 48
 	 */
49 49
 	protected $base_view_path;
50 50
 
51
-	public function __construct( ?string $base_path = null ) {
51
+	public function __construct(?string $base_path = null) {
52 52
 		$this->app = new App();
53 53
 
54
-		if ( null === $base_path ) {
54
+		if (null === $base_path) {
55 55
 			$file_index      = 0;
56 56
 			$trace           = debug_backtrace(); //phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_debug_backtrace
57
-			$this->base_path = isset( $trace[ $file_index ]['file'] ) ? \trailingslashit( dirname( $trace[ $file_index ]['file'] ) ) : __DIR__;
57
+			$this->base_path = isset($trace[$file_index]['file']) ? \trailingslashit(dirname($trace[$file_index]['file'])) : __DIR__;
58 58
 		} else {
59
-			$this->base_path = \trailingslashit( $base_path );
59
+			$this->base_path = \trailingslashit($base_path);
60 60
 		}
61 61
 	}
62 62
 
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
 	 * @param string $base_view_path
78 78
 	 * @return self
79 79
 	 */
80
-	public function set_base_view_path( string $base_view_path ): self {
81
-		$this->base_view_path = \trailingslashit( $base_view_path );
80
+	public function set_base_view_path(string $base_view_path): self {
81
+		$this->base_view_path = \trailingslashit($base_view_path);
82 82
 		return $this;
83 83
 	}
84 84
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	public function get_base_view_path(): string {
92 92
 		return null !== $this->base_view_path
93 93
 			? $this->base_view_path
94
-			: \trailingslashit( $this->default_config_paths()['path']['view'] );
94
+			: \trailingslashit($this->default_config_paths()['path']['view']);
95 95
 	}
96 96
 
97 97
 	/**
@@ -103,12 +103,12 @@  discard block
 block discarded – undo
103 103
 	 *
104 104
 	 * @return self
105 105
 	 */
106
-	public function with_wp_dice( bool $include_default_rules = false ): self {
106
+	public function with_wp_dice(bool $include_default_rules = false): self {
107 107
 		// If the view path is not set, set it to the same as base path.
108
-		if ( null === $this->base_view_path ) {
108
+		if (null === $this->base_view_path) {
109 109
 			$this->base_view_path = $this->base_path;
110 110
 		}
111
-		return $this->default_setup( $include_default_rules );
111
+		return $this->default_setup($include_default_rules);
112 112
 	}
113 113
 
114 114
 	/**
@@ -123,25 +123,25 @@  discard block
 block discarded – undo
123 123
 	 * @param bool $include_default_rules
124 124
 	 * @return self
125 125
 	 */
126
-	public function default_setup( bool $include_default_rules = true ): self {
126
+	public function default_setup(bool $include_default_rules = true): self {
127 127
 		$loader = new Hook_Loader();
128 128
 
129 129
 		// Setup DI Container
130
-		$container = PinkCrab_Dice::withDice( new Dice() );
130
+		$container = PinkCrab_Dice::withDice(new Dice());
131 131
 
132
-		if ( $include_default_rules === true ) {
133
-			$container->addRules( $this->default_di_rules() );
132
+		if ($include_default_rules === true) {
133
+			$container->addRules($this->default_di_rules());
134 134
 		}
135 135
 
136
-		$this->app->set_container( $container );
136
+		$this->app->set_container($container);
137 137
 
138 138
 		// Set registration middleware
139
-		$this->app->set_registration_services( new Registration_Service() );
139
+		$this->app->set_registration_services(new Registration_Service());
140 140
 
141
-		$this->app->set_loader( $loader );
141
+		$this->app->set_loader($loader);
142 142
 
143 143
 		// Include Hookable.
144
-		$this->app->registration_middleware( new Hookable_Middleware() );
144
+		$this->app->registration_middleware(new Hookable_Middleware());
145 145
 
146 146
 		return $this;
147 147
 	}
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 		return array(
157 157
 			'*' => array(
158 158
 				'substitutions' => array(
159
-					Renderable::class => new PHP_Engine( $this->get_base_view_path() ),
159
+					Renderable::class => new PHP_Engine($this->get_base_view_path()),
160 160
 				),
161 161
 			),
162 162
 		);
@@ -168,10 +168,10 @@  discard block
 block discarded – undo
168 168
 	 * @param array<string,array<string,string|object|callable|null|false|\Closure>> $rules
169 169
 	 * @return self
170 170
 	 */
171
-	public function di_rules( array $rules ): self {
171
+	public function di_rules(array $rules): self {
172 172
 		$this->app->container_config(
173
-			function( DI_Container $container ) use ( $rules ): void {
174
-				$container->addRules( $rules );
173
+			function(DI_Container $container) use ($rules): void {
174
+				$container->addRules($rules);
175 175
 			}
176 176
 		);
177 177
 		return $this;
@@ -183,8 +183,8 @@  discard block
 block discarded – undo
183 183
 	 * @param array<int, string> $class_list Array of fully namespaced class names.
184 184
 	 * @return self
185 185
 	 */
186
-	public function registration_classes( array $class_list ): self {
187
-		$this->app->registration_classes( $class_list );
186
+	public function registration_classes(array $class_list): self {
187
+		$this->app->registration_classes($class_list);
188 188
 		return $this;
189 189
 	}
190 190
 
@@ -194,8 +194,8 @@  discard block
 block discarded – undo
194 194
 	 * @param array<string, mixed> $app_config
195 195
 	 * @return self
196 196
 	 */
197
-	public function app_config( array $app_config ): self {
198
-		$this->app->set_app_config( \array_replace_recursive( $this->default_config_paths(), $app_config ) );
197
+	public function app_config(array $app_config): self {
198
+		$this->app->set_app_config(\array_replace_recursive($this->default_config_paths(), $app_config));
199 199
 		return $this;
200 200
 	}
201 201
 
@@ -215,8 +215,8 @@  discard block
 block discarded – undo
215 215
 	 */
216 216
 	public function boot(): App {
217 217
 		// Sets default settings if not already set.
218
-		if ( ! $this->app->has_app_config() ) {
219
-			$this->app_config( $this->default_config_paths() );
218
+		if ( ! $this->app->has_app_config()) {
219
+			$this->app_config($this->default_config_paths());
220 220
 		}
221 221
 
222 222
 		return $this->app->boot();
@@ -246,16 +246,16 @@  discard block
 block discarded – undo
246 246
 		$wp_uploads = \wp_upload_dir();
247 247
 		return array(
248 248
 			'path' => array(
249
-				'plugin'         => rtrim( $this->base_path, \DIRECTORY_SEPARATOR ),
250
-				'view'           => rtrim( $this->base_path, \DIRECTORY_SEPARATOR ) . '/views',
251
-				'assets'         => rtrim( $this->base_path, \DIRECTORY_SEPARATOR ) . '/assets',
249
+				'plugin'         => rtrim($this->base_path, \DIRECTORY_SEPARATOR),
250
+				'view'           => rtrim($this->base_path, \DIRECTORY_SEPARATOR) . '/views',
251
+				'assets'         => rtrim($this->base_path, \DIRECTORY_SEPARATOR) . '/assets',
252 252
 				'upload_root'    => $wp_uploads['basedir'],
253 253
 				'upload_current' => $wp_uploads['path'],
254 254
 			),
255 255
 			'url'  => array(
256
-				'plugin'         => plugins_url( basename( $this->base_path ) ),
257
-				'view'           => plugins_url( basename( $this->base_path ) ) . '/views',
258
-				'assets'         => plugins_url( basename( $this->base_path ) ) . '/assets',
256
+				'plugin'         => plugins_url(basename($this->base_path)),
257
+				'view'           => plugins_url(basename($this->base_path)) . '/views',
258
+				'assets'         => plugins_url(basename($this->base_path)) . '/assets',
259 259
 				'upload_root'    => $wp_uploads['baseurl'],
260 260
 				'upload_current' => $wp_uploads['url'],
261 261
 			),
@@ -269,8 +269,8 @@  discard block
 block discarded – undo
269 269
 	 * @return self
270 270
 	 * @throws App_Initialization_Exception Code 3
271 271
 	 */
272
-	public function registration_middleware( Registration_Middleware $middleware ): self {
273
-		$this->app->registration_middleware( $middleware );
272
+	public function registration_middleware(Registration_Middleware $middleware): self {
273
+		$this->app->registration_middleware($middleware);
274 274
 		return $this;
275 275
 	}
276 276
 
@@ -283,8 +283,8 @@  discard block
 block discarded – undo
283 283
 	 * @throws App_Initialization_Exception Code 1 If DI container not registered
284 284
 	 * @throws App_Initialization_Exception Code 9 If class doesn't create as middleware.
285 285
 	 */
286
-	public function construct_registration_middleware( string $class_name ): self {
287
-		$this->app->construct_registration_middleware( $class_name );
286
+	public function construct_registration_middleware(string $class_name): self {
287
+		$this->app->construct_registration_middleware($class_name);
288 288
 		return $this;
289 289
 	}
290 290
 }
Please login to merge, or discard this patch.