@@ -39,7 +39,7 @@ |
||
39 | 39 | * @param \WP_Post $value Post. |
40 | 40 | * @return self |
41 | 41 | */ |
42 | - public function set_post( \WP_Post $value ) : PostInterface { |
|
42 | + public function set_post(\WP_Post $value) : PostInterface { |
|
43 | 43 | $this->post = $value; |
44 | 44 | return $this; |
45 | 45 | } |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | * @param array $properties Properties. |
19 | 19 | * @return EntityInterface |
20 | 20 | */ |
21 | - public function add_blueprint( array $properties ) : EntityInterface; |
|
21 | + public function add_blueprint(array $properties) : EntityInterface; |
|
22 | 22 | |
23 | 23 | /** |
24 | 24 | * Add entity. |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @param mixed $key Key. |
28 | 28 | * @return void |
29 | 29 | */ |
30 | - public function add_entity( EntityInterface $entity, $key = null ); |
|
30 | + public function add_entity(EntityInterface $entity, $key = null); |
|
31 | 31 | |
32 | 32 | /** |
33 | 33 | * Build entity. |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | * |
20 | 20 | * @var array |
21 | 21 | */ |
22 | - private $pool = []; |
|
22 | + private $pool = [ ]; |
|
23 | 23 | |
24 | 24 | /** |
25 | 25 | * Position. |
@@ -34,11 +34,11 @@ discard block |
||
34 | 34 | * @param array $properties Properties. |
35 | 35 | * @return EntityInterface |
36 | 36 | */ |
37 | - public function add_blueprint( array $properties ) : EntityInterface { |
|
37 | + public function add_blueprint(array $properties) : EntityInterface { |
|
38 | 38 | $instance = $this->build_entity(); |
39 | - $this->populate_entity( $instance, $properties ); |
|
39 | + $this->populate_entity($instance, $properties); |
|
40 | 40 | |
41 | - $this->add_entity( $instance ); |
|
41 | + $this->add_entity($instance); |
|
42 | 42 | |
43 | 43 | return $instance; |
44 | 44 | } |
@@ -50,12 +50,12 @@ discard block |
||
50 | 50 | * @param array $properties Properties. |
51 | 51 | * @return void |
52 | 52 | */ |
53 | - private function populate_entity( $instance, array $properties ) { |
|
54 | - foreach ( $properties as $key => $value ) { |
|
53 | + private function populate_entity($instance, array $properties) { |
|
54 | + foreach ($properties as $key => $value) { |
|
55 | 55 | $method = "set_{$key}"; |
56 | 56 | |
57 | - if ( method_exists( $instance, $method ) ) { |
|
58 | - $instance->{$method}( $value ); |
|
57 | + if (method_exists($instance, $method)) { |
|
58 | + $instance->{$method}($value); |
|
59 | 59 | } |
60 | 60 | } |
61 | 61 | } |
@@ -67,9 +67,9 @@ discard block |
||
67 | 67 | * @param mixed $key Key. |
68 | 68 | * @return void |
69 | 69 | */ |
70 | - public function add_entity( EntityInterface $entity, $key = null ) { |
|
71 | - if ( is_null( $key ) ) { |
|
72 | - $this->pool[] = $entity; |
|
70 | + public function add_entity(EntityInterface $entity, $key = null) { |
|
71 | + if (is_null($key)) { |
|
72 | + $this->pool[ ] = $entity; |
|
73 | 73 | return; |
74 | 74 | } |
75 | 75 | |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | * @return boolean |
119 | 119 | */ |
120 | 120 | public function valid() { |
121 | - return isset( $this->pool[ $this->position ] ); |
|
121 | + return isset($this->pool[ $this->position ]); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | /** |
@@ -127,8 +127,8 @@ discard block |
||
127 | 127 | * @param mixed $offset Offset. |
128 | 128 | * @return boolean |
129 | 129 | */ |
130 | - public function offsetExists( $offset ) { |
|
131 | - return isset( $this->pool[ $offset ] ); |
|
130 | + public function offsetExists($offset) { |
|
131 | + return isset($this->pool[ $offset ]); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | /** |
@@ -137,8 +137,8 @@ discard block |
||
137 | 137 | * @param mixed $offset Offset. |
138 | 138 | * @return mixed|null |
139 | 139 | */ |
140 | - public function offsetGet( $offset ) { |
|
141 | - if ( isset( $this->pool[ $offset ] ) ) { |
|
140 | + public function offsetGet($offset) { |
|
141 | + if (isset($this->pool[ $offset ])) { |
|
142 | 142 | return $this->pool[ $offset ]; |
143 | 143 | } |
144 | 144 | |
@@ -152,8 +152,8 @@ discard block |
||
152 | 152 | * @param mixed $value Value. |
153 | 153 | * @return void |
154 | 154 | */ |
155 | - public function offsetSet( $offset, $value ) { |
|
156 | - $this->add_entity( $value, $offset ); |
|
155 | + public function offsetSet($offset, $value) { |
|
156 | + $this->add_entity($value, $offset); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | /** |
@@ -162,8 +162,8 @@ discard block |
||
162 | 162 | * @param mixed $offset Offset. |
163 | 163 | * @return void |
164 | 164 | */ |
165 | - public function offsetUnset( $offset ) { |
|
166 | - unset( $this->pool[ $offset ] ); |
|
165 | + public function offsetUnset($offset) { |
|
166 | + unset($this->pool[ $offset ]); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | /** |
@@ -172,6 +172,6 @@ discard block |
||
172 | 172 | * @return integer |
173 | 173 | */ |
174 | 174 | public function count() : int { |
175 | - return count( $this->pool ); |
|
175 | + return count($this->pool); |
|
176 | 176 | } |
177 | 177 | } |
@@ -25,5 +25,5 @@ |
||
25 | 25 | * @param \WP_Term $value Term. |
26 | 26 | * @return self |
27 | 27 | */ |
28 | - public function set_term( \WP_Term $value ) : self; |
|
28 | + public function set_term(\WP_Term $value) : self; |
|
29 | 29 | } |
@@ -39,7 +39,7 @@ |
||
39 | 39 | * @param \WP_Term $value Term. |
40 | 40 | * @return self |
41 | 41 | */ |
42 | - public function set_term( \WP_Term $value ) : TermInterface { |
|
42 | + public function set_term(\WP_Term $value) : TermInterface { |
|
43 | 43 | $this->term = $value; |
44 | 44 | return $this; |
45 | 45 | } |
@@ -25,5 +25,5 @@ |
||
25 | 25 | * @param \WP_Post $value Post. |
26 | 26 | * @return self |
27 | 27 | */ |
28 | - public function set_post( \WP_Post $value ) : self; |
|
28 | + public function set_post(\WP_Post $value) : self; |
|
29 | 29 | } |
@@ -22,10 +22,10 @@ discard block |
||
22 | 22 | * @return void |
23 | 23 | */ |
24 | 24 | public function register_hooks() { |
25 | - $this->add_action( 'wp_enqueue_scripts', 'register_theme_assets' ); |
|
26 | - $this->add_action( 'admin_enqueue_scripts', 'register_admin_assets' ); |
|
27 | - $this->add_action( 'login_enqueue_scripts', 'register_login_assets' ); |
|
28 | - $this->add_action( 'enqueue_block_editor_assets', 'register_editor_assets' ); |
|
25 | + $this->add_action('wp_enqueue_scripts', 'register_theme_assets'); |
|
26 | + $this->add_action('admin_enqueue_scripts', 'register_admin_assets'); |
|
27 | + $this->add_action('login_enqueue_scripts', 'register_login_assets'); |
|
28 | + $this->add_action('enqueue_block_editor_assets', 'register_editor_assets'); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
@@ -36,16 +36,16 @@ discard block |
||
36 | 36 | protected function register_theme_assets() { |
37 | 37 | $this->enqueue_script( |
38 | 38 | 'wpsteak-theme-js', |
39 | - $this->plugin->get_url( 'dist/theme.js' ), |
|
40 | - $this->plugin->get_path( 'dist/theme.js' ), |
|
39 | + $this->plugin->get_url('dist/theme.js'), |
|
40 | + $this->plugin->get_path('dist/theme.js'), |
|
41 | 41 | [ 'jquery', 'wp-i18n' ], |
42 | 42 | true |
43 | 43 | ); |
44 | 44 | |
45 | 45 | $this->enqueue_style( |
46 | 46 | 'wpsteak-theme-css', |
47 | - $this->plugin->get_url( 'dist/styles/theme.css' ), |
|
48 | - $this->plugin->get_path( 'dist/styles/theme.css' ) |
|
47 | + $this->plugin->get_url('dist/styles/theme.css'), |
|
48 | + $this->plugin->get_path('dist/styles/theme.css') |
|
49 | 49 | ); |
50 | 50 | } |
51 | 51 | |
@@ -57,16 +57,16 @@ discard block |
||
57 | 57 | protected function register_admin_assets() { |
58 | 58 | $this->enqueue_script( |
59 | 59 | 'wpsteak-admin-js', |
60 | - $this->plugin->get_url( 'dist/admin.js' ), |
|
61 | - $this->plugin->get_path( 'dist/admin.js' ), |
|
60 | + $this->plugin->get_url('dist/admin.js'), |
|
61 | + $this->plugin->get_path('dist/admin.js'), |
|
62 | 62 | [ 'jquery', 'wp-i18n' ], |
63 | 63 | true |
64 | 64 | ); |
65 | 65 | |
66 | 66 | $this->enqueue_style( |
67 | 67 | 'wpsteak-admin-css', |
68 | - $this->plugin->get_url( 'dist/styles/admin.css' ), |
|
69 | - $this->plugin->get_path( 'dist/styles/admin.css' ) |
|
68 | + $this->plugin->get_url('dist/styles/admin.css'), |
|
69 | + $this->plugin->get_path('dist/styles/admin.css') |
|
70 | 70 | ); |
71 | 71 | |
72 | 72 | $this->script_translation(); |
@@ -80,16 +80,16 @@ discard block |
||
80 | 80 | protected function register_login_assets() { |
81 | 81 | $this->enqueue_script( |
82 | 82 | 'wpsteak-login-js', |
83 | - $this->plugin->get_url( 'dist/login.js' ), |
|
84 | - $this->plugin->get_path( 'dist/login.js' ), |
|
83 | + $this->plugin->get_url('dist/login.js'), |
|
84 | + $this->plugin->get_path('dist/login.js'), |
|
85 | 85 | [ 'jquery' ], |
86 | 86 | true |
87 | 87 | ); |
88 | 88 | |
89 | 89 | $this->enqueue_style( |
90 | 90 | 'wpsteak-login-css', |
91 | - $this->plugin->get_url( 'dist/styles/login.css' ), |
|
92 | - $this->plugin->get_path( 'dist/styles/login.css' ) |
|
91 | + $this->plugin->get_url('dist/styles/login.css'), |
|
92 | + $this->plugin->get_path('dist/styles/login.css') |
|
93 | 93 | ); |
94 | 94 | } |
95 | 95 | |
@@ -101,16 +101,16 @@ discard block |
||
101 | 101 | protected function register_editor_assets() { |
102 | 102 | $this->enqueue_script( |
103 | 103 | 'wpsteak-editor-js', |
104 | - $this->plugin->get_url( 'dist/editor.js' ), |
|
105 | - $this->plugin->get_path( 'dist/editor.js' ), |
|
104 | + $this->plugin->get_url('dist/editor.js'), |
|
105 | + $this->plugin->get_path('dist/editor.js'), |
|
106 | 106 | [ 'wp-blocks', 'wp-element', 'wp-i18n' ], |
107 | 107 | true |
108 | 108 | ); |
109 | 109 | |
110 | 110 | $this->enqueue_style( |
111 | 111 | 'wpsteak-editor-css', |
112 | - $this->plugin->get_url( 'dist/styles/editor.css' ), |
|
113 | - $this->plugin->get_path( 'dist/styles/editor.css' ) |
|
112 | + $this->plugin->get_url('dist/styles/editor.css'), |
|
113 | + $this->plugin->get_path('dist/styles/editor.css') |
|
114 | 114 | ); |
115 | 115 | } |
116 | 116 | |
@@ -120,10 +120,10 @@ discard block |
||
120 | 120 | * @return void |
121 | 121 | */ |
122 | 122 | protected function script_translation() { |
123 | - if ( ! function_exists( 'wp_set_script_translations' ) ) { |
|
123 | + if ( ! function_exists('wp_set_script_translations')) { |
|
124 | 124 | return; |
125 | 125 | } |
126 | 126 | |
127 | - wp_set_script_translations( 'wpsteak-admin-js-bundle', $this->plugin->get_slug(), $this->plugin->get_path( 'languages' ) ); |
|
127 | + wp_set_script_translations('wpsteak-admin-js-bundle', $this->plugin->get_slug(), $this->plugin->get_path('languages')); |
|
128 | 128 | } |
129 | 129 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * @return void |
23 | 23 | */ |
24 | 24 | public function register_hooks() { |
25 | - $this->add_action( 'init', 'register_taxonomy' ); |
|
25 | + $this->add_action('init', 'register_taxonomy'); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | /** |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * @return void |
32 | 32 | */ |
33 | 33 | protected function register_taxonomy() { |
34 | - register_taxonomy( $this->get_taxonomy(), $this->get_object_type(), $this->get_args() ); |
|
34 | + register_taxonomy($this->get_taxonomy(), $this->get_object_type(), $this->get_args()); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * @return void |
23 | 23 | */ |
24 | 24 | public function register_hooks() { |
25 | - $this->add_action( 'init', 'register_post_type' ); |
|
25 | + $this->add_action('init', 'register_post_type'); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | /** |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * @return void |
32 | 32 | */ |
33 | 33 | protected function register_post_type() { |
34 | - register_post_type( $this->get_post_type(), $this->get_args() ); |
|
34 | + register_post_type($this->get_post_type(), $this->get_args()); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |