| @@ -1,6 +1,6 @@ discard block | ||
| 1 | 1 | <?php | 
| 2 | 2 | |
| 3 | -declare( strict_types=1 ); | |
| 3 | +declare(strict_types=1); | |
| 4 | 4 | |
| 5 | 5 | /** | 
| 6 | 6 | * Implementation of BladeOne for the PinkCrab Perique frameworks Renderable interface | 
| @@ -56,7 +56,7 @@ discard block | ||
| 56 | 56 | * | 
| 57 | 57 | * @param PinkCrab_BladeOne $blade | 
| 58 | 58 | */ | 
| 59 | -	final public function __construct( PinkCrab_BladeOne $blade ) { | |
| 59 | +	final public function __construct(PinkCrab_BladeOne $blade) { | |
| 60 | 60 | static::$blade = $blade; | 
| 61 | 61 | } | 
| 62 | 62 | |
| @@ -73,7 +73,7 @@ discard block | ||
| 73 | 73 | ?string $compiled_path = null, | 
| 74 | 74 | int $mode = 0 | 
| 75 | 75 |  	): self { | 
| 76 | - return new static( new PinkCrab_BladeOne( $template_path, $compiled_path, $mode ) ); | |
| 76 | + return new static(new PinkCrab_BladeOne($template_path, $compiled_path, $mode)); | |
| 77 | 77 | } | 
| 78 | 78 | |
| 79 | 79 | /** | 
| @@ -93,7 +93,7 @@ discard block | ||
| 93 | 93 | */ | 
| 94 | 94 |  	public function base_view_path(): string { | 
| 95 | 95 | $paths = static::$blade->get_template_paths(); | 
| 96 | - return ! empty( $paths ) ? reset( $paths ) : ''; | |
| 96 | + return ! empty($paths) ? reset($paths) : ''; | |
| 97 | 97 | } | 
| 98 | 98 | |
| 99 | 99 | /** | 
| @@ -102,8 +102,8 @@ discard block | ||
| 102 | 102 | * @param string $esc | 
| 103 | 103 | * @return self | 
| 104 | 104 | */ | 
| 105 | -	public function set_esc_function( string $esc ): self { | |
| 106 | - static::$blade->set_esc_function( $esc ); | |
| 105 | +	public function set_esc_function(string $esc): self { | |
| 106 | + static::$blade->set_esc_function($esc); | |
| 107 | 107 | return $this; | 
| 108 | 108 | } | 
| 109 | 109 | |
| @@ -113,7 +113,7 @@ discard block | ||
| 113 | 113 | * @param Component_Compiler $compiler | 
| 114 | 114 | * @return void | 
| 115 | 115 | */ | 
| 116 | -	public function set_component_compiler( Component_Compiler $compiler ): void { | |
| 116 | +	public function set_component_compiler(Component_Compiler $compiler): void { | |
| 117 | 117 | $this->component_compiler = $compiler; | 
| 118 | 118 | } | 
| 119 | 119 | |
| @@ -125,11 +125,11 @@ discard block | ||
| 125 | 125 | * @param bool $print | 
| 126 | 126 | * @return void|string | 
| 127 | 127 | */ | 
| 128 | -	public function render( string $view, iterable $data, bool $print = true ) { | |
| 129 | -		if ( $print ) { | |
| 130 | - print static::$blade->run( $view, (array) $data ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 128 | +	public function render(string $view, iterable $data, bool $print = true) { | |
| 129 | +		if ($print) { | |
| 130 | + print static::$blade->run($view, (array) $data); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 131 | 131 |  		} else { | 
| 132 | - return static::$blade->run( $view, (array) $data ); | |
| 132 | + return static::$blade->run($view, (array) $data); | |
| 133 | 133 | } | 
| 134 | 134 | } | 
| 135 | 135 | |
| @@ -139,8 +139,8 @@ discard block | ||
| 139 | 139 | * @param View_Model $view_model | 
| 140 | 140 | * @return string|void | 
| 141 | 141 | */ | 
| 142 | -	public function view_model( View_Model $view_model, bool $print = true ) { | |
| 143 | - return $this->render( str_replace( array( '/', '\\' ), '.', $view_model->template() ), $view_model->data(), $print ); | |
| 142 | +	public function view_model(View_Model $view_model, bool $print = true) { | |
| 143 | +		return $this->render(str_replace(array('/', '\\'), '.', $view_model->template()), $view_model->data(), $print); | |
| 144 | 144 | } | 
| 145 | 145 | |
| 146 | 146 | /** | 
| @@ -149,16 +149,16 @@ discard block | ||
| 149 | 149 | * @param Component $component | 
| 150 | 150 | * @return string|void | 
| 151 | 151 | */ | 
| 152 | -	public function component( Component $component, bool $print = true ) { | |
| 152 | +	public function component(Component $component, bool $print = true) { | |
| 153 | 153 | |
| 154 | 154 | // Throw exception of no compiler passed. | 
| 155 | -		if ( null === $this->component_compiler ) { | |
| 156 | - throw new Exception( 'No component compiler passed to BladeOne' ); | |
| 155 | +		if (null === $this->component_compiler) { | |
| 156 | +			throw new Exception('No component compiler passed to BladeOne'); | |
| 157 | 157 | } | 
| 158 | 158 | |
| 159 | 159 | // Compile the component. | 
| 160 | - $compiled = $this->component_compiler->compile( $component ); | |
| 161 | - return $this->render( str_replace( array( '/', '\\' ), '.', $compiled->template() ), $compiled->data(), $print ); | |
| 160 | + $compiled = $this->component_compiler->compile($component); | |
| 161 | +		return $this->render(str_replace(array('/', '\\'), '.', $compiled->template()), $compiled->data(), $print); | |
| 162 | 162 | } | 
| 163 | 163 | |
| 164 | 164 | /** | 
| @@ -169,12 +169,12 @@ discard block | ||
| 169 | 169 | * @return mixed | 
| 170 | 170 | * @throws BadMethodCallException | 
| 171 | 171 | */ | 
| 172 | -	public function __call( string $method, array $args = array() ) { | |
| 173 | -		if ( ! $this->is_method( $method ) ) { | |
| 174 | -			throw new BadMethodCallException( "{$method} is not a valid method on the BladeOne instance." ); | |
| 172 | +	public function __call(string $method, array $args = array()) { | |
| 173 | +		if ( ! $this->is_method($method)) { | |
| 174 | +			throw new BadMethodCallException("{$method} is not a valid method on the BladeOne instance."); | |
| 175 | 175 | } | 
| 176 | 176 | |
| 177 | -		return static::$blade->{$method}( ...$args ); | |
| 177 | +		return static::$blade->{$method}(...$args); | |
| 178 | 178 | } | 
| 179 | 179 | |
| 180 | 180 | /** | 
| @@ -185,12 +185,12 @@ discard block | ||
| 185 | 185 | * @return mixed | 
| 186 | 186 | * @throws BadMethodCallException | 
| 187 | 187 | */ | 
| 188 | -	public static function __callStatic( string $method, array $args = array() ) { | |
| 189 | -		if ( ! static::is_static_method( $method ) ) { | |
| 190 | -			throw new BadMethodCallException( "{$method} is not a valid method on the BladeOne instance." ); | |
| 188 | +	public static function __callStatic(string $method, array $args = array()) { | |
| 189 | +		if ( ! static::is_static_method($method)) { | |
| 190 | +			throw new BadMethodCallException("{$method} is not a valid method on the BladeOne instance."); | |
| 191 | 191 | } | 
| 192 | 192 | |
| 193 | -		return static::$blade::{$method}( ...$args ); | |
| 193 | +		return static::$blade::{$method}(...$args); | |
| 194 | 194 | } | 
| 195 | 195 | |
| 196 | 196 | /** | 
| @@ -199,15 +199,15 @@ discard block | ||
| 199 | 199 | * @param string $method | 
| 200 | 200 | * @return bool | 
| 201 | 201 | */ | 
| 202 | -	protected function is_method( string $method ): bool { | |
| 203 | - $class_reflection = new ReflectionClass( static::$blade ); | |
| 202 | +	protected function is_method(string $method): bool { | |
| 203 | + $class_reflection = new ReflectionClass(static::$blade); | |
| 204 | 204 | |
| 205 | 205 | // Check method exists. | 
| 206 | -		if ( ! $class_reflection->hasMethod( $method ) ) { | |
| 206 | +		if ( ! $class_reflection->hasMethod($method)) { | |
| 207 | 207 | return false; | 
| 208 | 208 | } | 
| 209 | 209 | |
| 210 | - $method_reflection = $class_reflection->getMethod( $method ); | |
| 210 | + $method_reflection = $class_reflection->getMethod($method); | |
| 211 | 211 | |
| 212 | 212 | return $method_reflection->isPublic() && ! $method_reflection->isStatic(); | 
| 213 | 213 | } | 
| @@ -218,15 +218,15 @@ discard block | ||
| 218 | 218 | * @param string $method | 
| 219 | 219 | * @return bool | 
| 220 | 220 | */ | 
| 221 | -	protected static function is_static_method( string $method ): bool { | |
| 222 | - $class_reflection = new ReflectionClass( static::$blade ); | |
| 221 | +	protected static function is_static_method(string $method): bool { | |
| 222 | + $class_reflection = new ReflectionClass(static::$blade); | |
| 223 | 223 | |
| 224 | 224 | // Check method exists. | 
| 225 | -		if ( ! $class_reflection->hasMethod( $method ) ) { | |
| 225 | +		if ( ! $class_reflection->hasMethod($method)) { | |
| 226 | 226 | return false; | 
| 227 | 227 | } | 
| 228 | 228 | |
| 229 | - $method_reflection = $class_reflection->getMethod( $method ); | |
| 229 | + $method_reflection = $class_reflection->getMethod($method); | |
| 230 | 230 | return $method_reflection->isPublic() && $method_reflection->isStatic(); | 
| 231 | 231 | } | 
| 232 | 232 | |
| @@ -236,7 +236,7 @@ discard block | ||
| 236 | 236 | * @param bool $bool | 
| 237 | 237 | * @return self | 
| 238 | 238 | */ | 
| 239 | -	public function allow_pipe( bool $bool = true ): self { | |
| 239 | +	public function allow_pipe(bool $bool = true): self { | |
| 240 | 240 | static::$blade->pipeEnable = $bool; //phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase | 
| 241 | 241 | return $this; | 
| 242 | 242 | } | 
| @@ -248,8 +248,8 @@ discard block | ||
| 248 | 248 | * @param callable $handler | 
| 249 | 249 | * @return self | 
| 250 | 250 | */ | 
| 251 | -	public function directive( string $name, callable $handler ): self { | |
| 252 | - static::$blade->directive( $name, $handler ); | |
| 251 | +	public function directive(string $name, callable $handler): self { | |
| 252 | + static::$blade->directive($name, $handler); | |
| 253 | 253 | return $this; | 
| 254 | 254 | } | 
| 255 | 255 | |
| @@ -260,8 +260,8 @@ discard block | ||
| 260 | 260 | * @param callable $handler | 
| 261 | 261 | * @return self | 
| 262 | 262 | */ | 
| 263 | -	public function directive_rt( $name, callable $handler ): self { | |
| 264 | - static::$blade->directiveRT( $name, $handler ); | |
| 263 | +	public function directive_rt($name, callable $handler): self { | |
| 264 | + static::$blade->directiveRT($name, $handler); | |
| 265 | 265 | return $this; | 
| 266 | 266 | } | 
| 267 | 267 | |
| @@ -272,8 +272,8 @@ discard block | ||
| 272 | 272 | * @param string|null $alias example "mynewop". If null then it uses the name of the template. | 
| 273 | 273 | * @return self | 
| 274 | 274 | */ | 
| 275 | -	public function add_include( $view, $alias = null ): self { | |
| 276 | - static::$blade->addInclude( $view, $alias ); | |
| 275 | +	public function add_include($view, $alias = null): self { | |
| 276 | + static::$blade->addInclude($view, $alias); | |
| 277 | 277 | return $this; | 
| 278 | 278 | } | 
| 279 | 279 | |
| @@ -284,8 +284,8 @@ discard block | ||
| 284 | 284 | * @param string $class_with_namespace | 
| 285 | 285 | * @return self | 
| 286 | 286 | */ | 
| 287 | -	public function add_alias_classes( $alias_name, $class_with_namespace ): self { | |
| 288 | - static::$blade->addAliasClasses( $alias_name, $class_with_namespace ); | |
| 287 | +	public function add_alias_classes($alias_name, $class_with_namespace): self { | |
| 288 | + static::$blade->addAliasClasses($alias_name, $class_with_namespace); | |
| 289 | 289 | return $this; | 
| 290 | 290 | } | 
| 291 | 291 | |
| @@ -295,8 +295,8 @@ discard block | ||
| 295 | 295 | * @param int $mode BladeOne::MODE_AUTO, BladeOne::MODE_DEBUG, BladeOne::MODE_FAST, BladeOne::MODE_SLOW | 
| 296 | 296 | * @return self | 
| 297 | 297 | */ | 
| 298 | -	public function set_mode( int $mode ): self { | |
| 299 | - static::$blade->setMode( $mode ); | |
| 298 | +	public function set_mode(int $mode): self { | |
| 299 | + static::$blade->setMode($mode); | |
| 300 | 300 | return $this; | 
| 301 | 301 | } | 
| 302 | 302 | |
| @@ -314,8 +314,8 @@ discard block | ||
| 314 | 314 | * @param mixed $value | 
| 315 | 315 | * @return $this | 
| 316 | 316 | */ | 
| 317 | -	public function share( $var_name, $value = null ): self { | |
| 318 | - static::$blade->share( $var_name, $value ); | |
| 317 | +	public function share($var_name, $value = null): self { | |
| 318 | + static::$blade->share($var_name, $value); | |
| 319 | 319 | return $this; | 
| 320 | 320 | } | 
| 321 | 321 | |
| @@ -325,8 +325,8 @@ discard block | ||
| 325 | 325 | * @param callable $function | 
| 326 | 326 | * @return $this | 
| 327 | 327 | */ | 
| 328 | -	public function set_inject_resolver( callable $function ): self { | |
| 329 | - static::$blade->setInjectResolver( $function ); | |
| 328 | +	public function set_inject_resolver(callable $function): self { | |
| 329 | + static::$blade->setInjectResolver($function); | |
| 330 | 330 | return $this; | 
| 331 | 331 | } | 
| 332 | 332 | |
| @@ -337,8 +337,8 @@ discard block | ||
| 337 | 337 | * @param string $file_extension Example: .prefix.ext | 
| 338 | 338 | * @return $this | 
| 339 | 339 | */ | 
| 340 | -	public function set_file_extension( string $file_extension ): self { | |
| 341 | - static::$blade->setFileExtension( $file_extension ); | |
| 340 | +	public function set_file_extension(string $file_extension): self { | |
| 341 | + static::$blade->setFileExtension($file_extension); | |
| 342 | 342 | return $this; | 
| 343 | 343 | } | 
| 344 | 344 | |
| @@ -349,8 +349,8 @@ discard block | ||
| 349 | 349 | * @param string $file_extension | 
| 350 | 350 | * @return $this | 
| 351 | 351 | */ | 
| 352 | -	public function set_compiled_extension( string $file_extension ): self { | |
| 353 | - static::$blade->setCompiledExtension( $file_extension ); | |
| 352 | +	public function set_compiled_extension(string $file_extension): self { | |
| 353 | + static::$blade->setCompiledExtension($file_extension); | |
| 354 | 354 | return $this; | 
| 355 | 355 | } | 
| 356 | 356 | } | 
| @@ -1,6 +1,6 @@ discard block | ||
| 1 | 1 | <?php | 
| 2 | 2 | |
| 3 | -declare( strict_types=1 ); | |
| 3 | +declare(strict_types=1); | |
| 4 | 4 | |
| 5 | 5 | /** | 
| 6 | 6 | * Wrapper for BladeOne with HTML enabled | 
| @@ -44,14 +44,14 @@ discard block | ||
| 44 | 44 | * @param string $compiled_path If null then it uses (caller_folder)/compiles | 
| 45 | 45 | * @param int $mode =[BladeOne::MODE_AUTO,BladeOne::MODE_DEBUG,BladeOne::MODE_FAST,BladeOne::MODE_SLOW][$i] | 
| 46 | 46 | */ | 
| 47 | -	public function __construct( $template_path = null, $compiled_path = null, $mode = 0 ) { | |
| 48 | - parent::__construct( $template_path, $compiled_path, $mode ); | |
| 47 | +	public function __construct($template_path = null, $compiled_path = null, $mode = 0) { | |
| 48 | + parent::__construct($template_path, $compiled_path, $mode); | |
| 49 | 49 | |
| 50 | 50 | // Add the viewModel directive. | 
| 51 | - $this->directiveRT( 'viewModel', fn( $expression ) => $this->view_model( $expression, true ) ); | |
| 51 | +		$this->directiveRT('viewModel', fn($expression) => $this->view_model($expression, true)); | |
| 52 | 52 | |
| 53 | 53 | // Add the component directive. | 
| 54 | - $this->directiveRT( 'viewComponent', fn( $expression ) => $this->component( $expression, true ) ); | |
| 54 | +		$this->directiveRT('viewComponent', fn($expression) => $this->component($expression, true)); | |
| 55 | 55 | } | 
| 56 | 56 | |
| 57 | 57 | /** | 
| @@ -75,14 +75,14 @@ discard block | ||
| 75 | 75 | * @param string $esc_function | 
| 76 | 76 | * @return void | 
| 77 | 77 | */ | 
| 78 | -	public function set_esc_function( string $esc_function ): void { | |
| 78 | +	public function set_esc_function(string $esc_function): void { | |
| 79 | 79 | // Throw exception if not a valid callable. | 
| 80 | -		if ( ! \is_callable( $esc_function ) ) { | |
| 81 | - throw new \InvalidArgumentException( 'Invalid esc function provided.' ); | |
| 80 | +		if ( ! \is_callable($esc_function)) { | |
| 81 | +			throw new \InvalidArgumentException('Invalid esc function provided.'); | |
| 82 | 82 | } | 
| 83 | 83 | |
| 84 | 84 | static::$esc_function = $esc_function; | 
| 85 | - $this->echoFormat = sprintf( '\\%s(%%s)', $esc_function ); //phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase | |
| 85 | +		$this->echoFormat     = sprintf('\\%s(%%s)', $esc_function); //phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase | |
| 86 | 86 | } | 
| 87 | 87 | |
| 88 | 88 | /** | 
| @@ -100,17 +100,17 @@ discard block | ||
| 100 | 100 | * @param int|float|string|null|mixed[]|object $value | 
| 101 | 101 | * @return string | 
| 102 | 102 | */ | 
| 103 | -	public static function e( $value ): string { | |
| 104 | -		if ( \is_null( $value ) ) { | |
| 103 | +	public static function e($value): string { | |
| 104 | +		if (\is_null($value)) { | |
| 105 | 105 | return ''; | 
| 106 | 106 | } | 
| 107 | -		if ( \is_array( $value ) || \is_object( $value ) ) { | |
| 108 | - return \call_user_func( static::$esc_function, \print_r( $value, true ) );//phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_print_r | |
| 107 | +		if (\is_array($value) || \is_object($value)) { | |
| 108 | + return \call_user_func(static::$esc_function, \print_r($value, true)); //phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_print_r | |
| 109 | 109 | } | 
| 110 | -		if ( \is_numeric( $value ) ) { | |
| 110 | +		if (\is_numeric($value)) { | |
| 111 | 111 | $value = (string) $value; | 
| 112 | 112 | } | 
| 113 | - return \call_user_func( static::$esc_function, $value ); | |
| 113 | + return \call_user_func(static::$esc_function, $value); | |
| 114 | 114 | } | 
| 115 | 115 | |
| 116 | 116 | /** | 
| @@ -120,11 +120,11 @@ discard block | ||
| 120 | 120 | * @param bool $print | 
| 121 | 121 | * @return string|void | 
| 122 | 122 | */ | 
| 123 | -	public function component( Component $component, bool $print = true ) { | |
| 123 | +	public function component(Component $component, bool $print = true) { | |
| 124 | 124 | /** @var View */ | 
| 125 | 125 | $view = App::view(); | 
| 126 | 126 | |
| 127 | - return $view->component( $component, $print ); | |
| 127 | + return $view->component($component, $print); | |
| 128 | 128 | } | 
| 129 | 129 | |
| 130 | 130 | /** | 
| @@ -134,11 +134,11 @@ discard block | ||
| 134 | 134 | * @param bool $print Print or Return the HTML | 
| 135 | 135 | * @return string|void | 
| 136 | 136 | */ | 
| 137 | -	public function view_model( View_Model $view_model, bool $print = true ) { | |
| 137 | +	public function view_model(View_Model $view_model, bool $print = true) { | |
| 138 | 138 | /** @var View */ | 
| 139 | 139 | $view = App::view(); | 
| 140 | 140 | |
| 141 | - return $view->view_model( $view_model, $print ); | |
| 141 | + return $view->view_model($view_model, $print); | |
| 142 | 142 | } | 
| 143 | 143 | |
| 144 | 144 | /** | 
| @@ -147,13 +147,13 @@ discard block | ||
| 147 | 147 | * @param string $expression | 
| 148 | 148 | * @return string | 
| 149 | 149 | */ | 
| 150 | -	protected function compileAuth( $expression = '' ): string { | |
| 151 | - $role = $this->stripParentheses( $expression ); | |
| 152 | -		if ( $role === '' ) { | |
| 153 | - return $this->phpTag . 'if(!PinkCrab\FunctionConstructors\Strings\isBlank($this->currentUser)): ?>'; | |
| 150 | +	protected function compileAuth($expression = ''): string { | |
| 151 | + $role = $this->stripParentheses($expression); | |
| 152 | +		if ($role === '') { | |
| 153 | + return $this->phpTag.'if(!PinkCrab\FunctionConstructors\Strings\isBlank($this->currentUser)): ?>'; | |
| 154 | 154 | } | 
| 155 | 155 | |
| 156 | - return $this->phpTag . "if(!PinkCrab\FunctionConstructors\Strings\isBlank(\$this->currentUser) && \$this->currentRole==$role): ?>"; | |
| 156 | + return $this->phpTag."if(!PinkCrab\FunctionConstructors\Strings\isBlank(\$this->currentUser) && \$this->currentRole==$role): ?>"; | |
| 157 | 157 | } | 
| 158 | 158 | |
| 159 | 159 | /** | 
| @@ -162,13 +162,13 @@ discard block | ||
| 162 | 162 | * @param string $expression | 
| 163 | 163 | * @return string | 
| 164 | 164 | */ | 
| 165 | -	protected function compileElseAuth( $expression = '' ): string { | |
| 166 | - $role = $this->stripParentheses( $expression ); | |
| 167 | -		if ( $role === '' ) { | |
| 168 | - return $this->phpTag . 'else: ?>'; | |
| 165 | +	protected function compileElseAuth($expression = ''): string { | |
| 166 | + $role = $this->stripParentheses($expression); | |
| 167 | +		if ($role === '') { | |
| 168 | + return $this->phpTag.'else: ?>'; | |
| 169 | 169 | } | 
| 170 | 170 | |
| 171 | - return $this->phpTag . "elseif(!PinkCrab\FunctionConstructors\Strings\isBlank(\$this->currentUser) && \$this->currentRole==$role): ?>"; | |
| 171 | + return $this->phpTag."elseif(!PinkCrab\FunctionConstructors\Strings\isBlank(\$this->currentUser) && \$this->currentRole==$role): ?>"; | |
| 172 | 172 | } | 
| 173 | 173 | |
| 174 | 174 | /** | 
| @@ -177,18 +177,18 @@ discard block | ||
| 177 | 177 | * @param string|null $expression | 
| 178 | 178 | * @return string | 
| 179 | 179 | */ | 
| 180 | -	protected function compileGuest( $expression = null ): string { | |
| 180 | +	protected function compileGuest($expression = null): string { | |
| 181 | 181 | |
| 182 | -		if ( $expression === null ) { | |
| 183 | - return $this->phpTag . 'if(PinkCrab\FunctionConstructors\Strings\isBlank($this->currentUser)): ?>'; | |
| 182 | +		if ($expression === null) { | |
| 183 | + return $this->phpTag.'if(PinkCrab\FunctionConstructors\Strings\isBlank($this->currentUser)): ?>'; | |
| 184 | 184 | } | 
| 185 | 185 | |
| 186 | - $role = $this->stripParentheses( $expression ); | |
| 187 | -		if ( $role === '' ) { | |
| 188 | - return $this->phpTag . 'if(PinkCrab\FunctionConstructors\Strings\isBlank($this->currentUser)): ?>'; | |
| 186 | + $role = $this->stripParentheses($expression); | |
| 187 | +		if ($role === '') { | |
| 188 | + return $this->phpTag.'if(PinkCrab\FunctionConstructors\Strings\isBlank($this->currentUser)): ?>'; | |
| 189 | 189 | } | 
| 190 | 190 | |
| 191 | - return $this->phpTag . "if(PinkCrab\FunctionConstructors\Strings\isBlank(\$this->currentUser) || \$this->currentRole!=$role): ?>"; | |
| 191 | + return $this->phpTag."if(PinkCrab\FunctionConstructors\Strings\isBlank(\$this->currentUser) || \$this->currentRole!=$role): ?>"; | |
| 192 | 192 | } | 
| 193 | 193 | |
| 194 | 194 | /** | 
| @@ -197,13 +197,13 @@ discard block | ||
| 197 | 197 | * @param string|null $expression | 
| 198 | 198 | * @return string | 
| 199 | 199 | */ | 
| 200 | -	protected function compileElseGuest( $expression ): string { | |
| 201 | - $role = $this->stripParentheses( $expression ); | |
| 202 | -		if ( $role === '' ) { | |
| 203 | - return $this->phpTag . 'else: ?>'; | |
| 200 | +	protected function compileElseGuest($expression): string { | |
| 201 | + $role = $this->stripParentheses($expression); | |
| 202 | +		if ($role === '') { | |
| 203 | + return $this->phpTag.'else: ?>'; | |
| 204 | 204 | } | 
| 205 | 205 | |
| 206 | - return $this->phpTag . "elseif(PinkCrab\FunctionConstructors\Strings\isBlank(\$this->currentUser) || \$this->currentRole!=$role): ?>"; | |
| 206 | + return $this->phpTag."elseif(PinkCrab\FunctionConstructors\Strings\isBlank(\$this->currentUser) || \$this->currentRole!=$role): ?>"; | |
| 207 | 207 | } | 
| 208 | 208 | |
| 209 | 209 | } | 
| @@ -1,6 +1,6 @@ discard block | ||
| 1 | 1 | <?php | 
| 2 | 2 | |
| 3 | -declare( strict_types=1 ); | |
| 3 | +declare(strict_types=1); | |
| 4 | 4 | |
| 5 | 5 | /** | 
| 6 | 6 | * The BladeOne Module for Perique. | 
| @@ -47,7 +47,7 @@ discard block | ||
| 47 | 47 | * @param string $template_path | 
| 48 | 48 | * @return self | 
| 49 | 49 | */ | 
| 50 | -	public function template_path( string $template_path ): self { | |
| 50 | +	public function template_path(string $template_path): self { | |
| 51 | 51 | $this->template_path = $template_path; | 
| 52 | 52 | return $this; | 
| 53 | 53 | } | 
| @@ -58,7 +58,7 @@ discard block | ||
| 58 | 58 | * @param string $compiled_path | 
| 59 | 59 | * @return self | 
| 60 | 60 | */ | 
| 61 | -	public function compiled_path( string $compiled_path ): self { | |
| 61 | +	public function compiled_path(string $compiled_path): self { | |
| 62 | 62 | $this->compiled_path = $compiled_path; | 
| 63 | 63 | return $this; | 
| 64 | 64 | } | 
| @@ -69,7 +69,7 @@ discard block | ||
| 69 | 69 | * @param int $mode | 
| 70 | 70 | * @return self | 
| 71 | 71 | */ | 
| 72 | -	public function mode( int $mode ): self { | |
| 72 | +	public function mode(int $mode): self { | |
| 73 | 73 | $this->mode = $mode; | 
| 74 | 74 | return $this; | 
| 75 | 75 | } | 
| @@ -80,7 +80,7 @@ discard block | ||
| 80 | 80 | * @param \Closure(BladeOne_Engine):BladeOne_Engine $config | 
| 81 | 81 | * @return self | 
| 82 | 82 | */ | 
| 83 | -	public function config( \Closure $config ): self { | |
| 83 | +	public function config(\Closure $config): self { | |
| 84 | 84 | $this->config = $config; | 
| 85 | 85 | return $this; | 
| 86 | 86 | } | 
| @@ -94,21 +94,21 @@ discard block | ||
| 94 | 94 | * @pram DI_Container $di_container | 
| 95 | 95 | * @return void | 
| 96 | 96 | */ | 
| 97 | -	public function pre_boot( App_Config $config, Hook_Loader $loader, DI_Container $di_container ): void { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInImplementedInterfaceBeforeLastUsed | |
| 97 | +	public function pre_boot(App_Config $config, Hook_Loader $loader, DI_Container $di_container): void { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInImplementedInterfaceBeforeLastUsed | |
| 98 | 98 | |
| 99 | 99 | $wp_upload_dir = wp_upload_dir(); | 
| 100 | - $compiled_path = $this->compiled_path ?? sprintf( '%1$s%2$sblade-cache', $wp_upload_dir['basedir'], \DIRECTORY_SEPARATOR ); // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInImplementedInterfaceBeforeLastUsed | |
| 100 | +		$compiled_path = $this->compiled_path ?? sprintf('%1$s%2$sblade-cache', $wp_upload_dir['basedir'], \DIRECTORY_SEPARATOR); // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInImplementedInterfaceBeforeLastUsed | |
| 101 | 101 | $instance = new PinkCrab_BladeOne( | 
| 102 | - $this->template_path ?? $config->path( 'view' ), | |
| 102 | +			$this->template_path ?? $config->path('view'), | |
| 103 | 103 | $compiled_path, | 
| 104 | 104 | $this->mode | 
| 105 | 105 | ); | 
| 106 | 106 | |
| 107 | - $instance->setAuth( ...$this->get_auth_data() ); | |
| 107 | + $instance->setAuth(...$this->get_auth_data()); | |
| 108 | 108 | |
| 109 | 109 | // Create the compiled path if it does not exist. | 
| 110 | -		if ( ! \file_exists( $compiled_path ) ) { | |
| 111 | - mkdir( $compiled_path ); | |
| 110 | +		if ( ! \file_exists($compiled_path)) { | |
| 111 | + mkdir($compiled_path); | |
| 112 | 112 | } | 
| 113 | 113 | |
| 114 | 114 | $di_container->addRule( | 
| @@ -118,7 +118,7 @@ discard block | ||
| 118 | 118 | $instance, | 
| 119 | 119 | ), | 
| 120 | 120 | 'call' => array( | 
| 121 | - array( 'allow_pipe', array() ), | |
| 121 | +					array('allow_pipe', array()), | |
| 122 | 122 | ), | 
| 123 | 123 | 'shared' => true, | 
| 124 | 124 | ) | 
| @@ -152,8 +152,8 @@ discard block | ||
| 152 | 152 |  	private function get_auth_data(): array { | 
| 153 | 153 | |
| 154 | 154 | // @codeCoverageIgnoreStart | 
| 155 | -		if ( ! function_exists( 'wp_get_current_user' ) ) { | |
| 156 | - require_once ABSPATH . 'wp-includes/pluggable.php'; | |
| 155 | +		if ( ! function_exists('wp_get_current_user')) { | |
| 156 | + require_once ABSPATH.'wp-includes/pluggable.php'; | |
| 157 | 157 | } | 
| 158 | 158 | // @codeCoverageIgnoreEnd | 
| 159 | 159 | |
| @@ -161,7 +161,7 @@ discard block | ||
| 161 | 161 | return array( | 
| 162 | 162 | 0 !== $user->ID ? $user->user_login : '', | 
| 163 | 163 | 0 !== $user->ID ? $user->roles[0] : '', | 
| 164 | - 0 !== $user->ID ? array_keys( array_filter( $user->allcaps ) ) : array(), | |
| 164 | + 0 !== $user->ID ? array_keys(array_filter($user->allcaps)) : array(), | |
| 165 | 165 | ); | 
| 166 | 166 | } | 
| 167 | 167 | |
| @@ -173,18 +173,18 @@ discard block | ||
| 173 | 173 | * @pram DI_Container $di_container | 
| 174 | 174 | * @return void | 
| 175 | 175 | */ | 
| 176 | -	public function pre_register( App_Config $config, Hook_Loader $loader, DI_Container $di_container ): void { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInImplementedInterfaceBeforeLastUsed | |
| 176 | +	public function pre_register(App_Config $config, Hook_Loader $loader, DI_Container $di_container): void { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInImplementedInterfaceBeforeLastUsed | |
| 177 | 177 | |
| 178 | - $provider = $di_container->create( BladeOne_Engine::class ); | |
| 178 | + $provider = $di_container->create(BladeOne_Engine::class); | |
| 179 | 179 | |
| 180 | 180 | // If dont have an instance of BladeOne_Engine, return. | 
| 181 | -		if ( ! $provider instanceof BladeOne_Engine ) { | |
| 182 | - throw new \RuntimeException( 'Unable to create BladeOne_Engine instance to configure instance' ); | |
| 181 | +		if ( ! $provider instanceof BladeOne_Engine) { | |
| 182 | +			throw new \RuntimeException('Unable to create BladeOne_Engine instance to configure instance'); | |
| 183 | 183 | } | 
| 184 | 184 | |
| 185 | 185 | // Pass the config to the provider, if set. | 
| 186 | -		if ( ! is_null( $this->config ) ) { | |
| 187 | - \call_user_func( $this->config, $provider ); | |
| 186 | +		if ( ! is_null($this->config)) { | |
| 187 | + \call_user_func($this->config, $provider); | |
| 188 | 188 | } | 
| 189 | 189 | |
| 190 | 190 | } | 
| @@ -193,7 +193,7 @@ discard block | ||
| 193 | 193 | |
| 194 | 194 | |
| 195 | 195 | /** @inheritDoc */ | 
| 196 | -	public function post_register( App_Config $config, Hook_Loader $loader, DI_Container $di_container ): void {} // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInImplementedInterfaceBeforeLastUsed | |
| 196 | +	public function post_register(App_Config $config, Hook_Loader $loader, DI_Container $di_container): void {} // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInImplementedInterfaceBeforeLastUsed | |
| 197 | 197 | |
| 198 | 198 | /** @inheritDoc */ | 
| 199 | 199 |  	public function get_middleware(): ?string { |