@@ -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 |
@@ -45,51 +45,51 @@ discard block |
||
45 | 45 | * @param class-string|BladeOne $blade |
46 | 46 | * @return void |
47 | 47 | */ |
48 | - public static function use( $template_path = null, ?string $compiled_path = null, int $mode = 0, $blade = null ) { |
|
48 | + public static function use($template_path = null, ?string $compiled_path = null, int $mode = 0, $blade = null) { |
|
49 | 49 | |
50 | 50 | add_filter( |
51 | 51 | Hooks::APP_INIT_SET_DI_RULES, |
52 | - function( $rules ) use ( $template_path, $compiled_path, $mode, $blade ) { |
|
52 | + function($rules) use ($template_path, $compiled_path, $mode, $blade) { |
|
53 | 53 | |
54 | 54 | // Unset the global PHP_Engine useage. |
55 | - if ( array_key_exists( '*', $rules ) |
|
56 | - && array_key_exists( 'substitutions', $rules['*'] ) |
|
57 | - && array_key_exists( Renderable::class, $rules['*']['substitutions'] ) |
|
58 | - && is_a( $rules['*']['substitutions'][ Renderable::class ], PHP_Engine::class ) ) { |
|
55 | + if (array_key_exists('*', $rules) |
|
56 | + && array_key_exists('substitutions', $rules['*']) |
|
57 | + && array_key_exists(Renderable::class, $rules['*']['substitutions']) |
|
58 | + && is_a($rules['*']['substitutions'][Renderable::class], PHP_Engine::class)) { |
|
59 | 59 | |
60 | 60 | // If template path is not set, get from renderable. |
61 | - if ( is_null( $template_path ) ) { |
|
62 | - $template_path = $rules['*']['substitutions'][ Renderable::class ]->base_view_path(); |
|
61 | + if (is_null($template_path)) { |
|
62 | + $template_path = $rules['*']['substitutions'][Renderable::class]->base_view_path(); |
|
63 | 63 | } |
64 | - unset( $rules['*']['substitutions'][ Renderable::class ] ); |
|
64 | + unset($rules['*']['substitutions'][Renderable::class]); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | // If there is no compiled path, set to to uploads. |
68 | - if ( is_null( $compiled_path ) ) { |
|
68 | + if (is_null($compiled_path)) { |
|
69 | 69 | $wp_upload_dir = wp_upload_dir(); |
70 | - $compiled_path = sprintf( '%1$s%2$scompiled%2$sblade', $wp_upload_dir['basedir'], \DIRECTORY_SEPARATOR ); |
|
70 | + $compiled_path = sprintf('%1$s%2$scompiled%2$sblade', $wp_upload_dir['basedir'], \DIRECTORY_SEPARATOR); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | // Get the version of Blade to start. |
74 | - $blade = self::get_blade_instance( $blade ); |
|
74 | + $blade = self::get_blade_instance($blade); |
|
75 | 75 | |
76 | - $rules[ BladeOne_Provider::class ] = array( |
|
76 | + $rules[BladeOne_Provider::class] = array( |
|
77 | 77 | 'substitutions' => array( |
78 | - PinkCrab_BladeOne::class => new $blade( $template_path, $compiled_path, $mode ), |
|
78 | + PinkCrab_BladeOne::class => new $blade($template_path, $compiled_path, $mode), |
|
79 | 79 | ), |
80 | 80 | 'call' => array( |
81 | - array( 'allow_pipe', array() ), |
|
81 | + array('allow_pipe', array()), |
|
82 | 82 | ), |
83 | 83 | ); |
84 | 84 | |
85 | - $rules[ Renderable::class ] = array( |
|
85 | + $rules[Renderable::class] = array( |
|
86 | 86 | 'instanceOf' => BladeOne_Provider::class, |
87 | 87 | 'shared' => true, |
88 | 88 | ); |
89 | 89 | |
90 | - $rules[ Abstract_BladeOne_Config::class ] = array( |
|
90 | + $rules[Abstract_BladeOne_Config::class] = array( |
|
91 | 91 | 'call' => array( |
92 | - array( 'set_renderable', array( array( Dice::INSTANCE => Renderable::class ) ) ), |
|
92 | + array('set_renderable', array(array(Dice::INSTANCE => Renderable::class))), |
|
93 | 93 | ), |
94 | 94 | ); |
95 | 95 | |
@@ -104,13 +104,13 @@ discard block |
||
104 | 104 | * @param mixed $blade |
105 | 105 | * @return class-string |
106 | 106 | */ |
107 | - protected static function get_blade_instance( $blade ): string { |
|
107 | + protected static function get_blade_instance($blade): string { |
|
108 | 108 | // If we have a populated instance of BladeOne, get the full class name. |
109 | - if ( is_object( $blade ) && is_a( $blade, PinkCrab_BladeOne::class ) ) { |
|
110 | - $blade = get_class( $blade ); |
|
109 | + if (is_object($blade) && is_a($blade, PinkCrab_BladeOne::class)) { |
|
110 | + $blade = get_class($blade); |
|
111 | 111 | } |
112 | 112 | |
113 | - if ( is_string( $blade ) && is_a( $blade, PinkCrab_BladeOne::class, true ) ) { |
|
113 | + if (is_string($blade) && is_a($blade, PinkCrab_BladeOne::class, true)) { |
|
114 | 114 | return $blade; |
115 | 115 | } |
116 | 116 |