@@ -63,14 +63,14 @@ discard block |
||
63 | 63 | array $args = array() |
64 | 64 | ) { |
65 | 65 | |
66 | - $classes = $this->get_deep( $this->classes, $parent_slugs ); |
|
66 | + $classes = $this->get_deep($this->classes, $parent_slugs); |
|
67 | 67 | |
68 | - if ( ! $classes || ! isset( $classes['_classes'] ) ) { |
|
68 | + if ( ! $classes || ! isset($classes['_classes'])) { |
|
69 | 69 | return array(); |
70 | 70 | } |
71 | 71 | |
72 | - if ( $this->settings['pass_slugs'] ) { |
|
73 | - array_unshift( $args, $parent_slugs ); |
|
72 | + if ($this->settings['pass_slugs']) { |
|
73 | + array_unshift($args, $parent_slugs); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | return WordPoints_Class_Registry::construct_with_args( |
@@ -83,14 +83,14 @@ discard block |
||
83 | 83 | /** |
84 | 84 | * @since 2.2.0 |
85 | 85 | */ |
86 | - public function get_children_slugs( array $parent_slugs = array() ) { |
|
86 | + public function get_children_slugs(array $parent_slugs = array()) { |
|
87 | 87 | |
88 | 88 | $slugs = array(); |
89 | 89 | |
90 | - $classes = $this->get_deep( $this->classes, $parent_slugs ); |
|
90 | + $classes = $this->get_deep($this->classes, $parent_slugs); |
|
91 | 91 | |
92 | - if ( $classes && isset( $classes['_classes'] ) ) { |
|
93 | - $slugs = array_keys( $classes['_classes'] ); |
|
92 | + if ($classes && isset($classes['_classes'])) { |
|
93 | + $slugs = array_keys($classes['_classes']); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | return $slugs; |
@@ -110,29 +110,29 @@ discard block |
||
110 | 110 | array $args = array() |
111 | 111 | ) { |
112 | 112 | |
113 | - $classes = $this->get_deep( $this->classes, $parent_slugs ); |
|
113 | + $classes = $this->get_deep($this->classes, $parent_slugs); |
|
114 | 114 | |
115 | - if ( ! $classes || ! isset( $classes['_classes'][ $slug ] ) ) { |
|
115 | + if ( ! $classes || ! isset($classes['_classes'][$slug])) { |
|
116 | 116 | return false; |
117 | 117 | } |
118 | 118 | |
119 | - $class = $classes['_classes'][ $slug ]; |
|
119 | + $class = $classes['_classes'][$slug]; |
|
120 | 120 | |
121 | - if ( empty( $args ) ) { |
|
121 | + if (empty($args)) { |
|
122 | 122 | |
123 | - if ( $this->settings['pass_slugs'] ) { |
|
124 | - return new $class( $slug, $parent_slugs ); |
|
123 | + if ($this->settings['pass_slugs']) { |
|
124 | + return new $class($slug, $parent_slugs); |
|
125 | 125 | } else { |
126 | 126 | return new $class(); |
127 | 127 | } |
128 | 128 | |
129 | 129 | } else { |
130 | 130 | |
131 | - if ( $this->settings['pass_slugs'] ) { |
|
132 | - array_unshift( $args, $slug, $parent_slugs ); |
|
131 | + if ($this->settings['pass_slugs']) { |
|
132 | + array_unshift($args, $slug, $parent_slugs); |
|
133 | 133 | } |
134 | 134 | |
135 | - return wordpoints_construct_class_with_args( $class, $args ); |
|
135 | + return wordpoints_construct_class_with_args($class, $args); |
|
136 | 136 | } |
137 | 137 | } |
138 | 138 | |
@@ -148,16 +148,16 @@ discard block |
||
148 | 148 | |
149 | 149 | $classes = &$this->classes; |
150 | 150 | |
151 | - foreach ( $parent_slugs as $parent_slug ) { |
|
151 | + foreach ($parent_slugs as $parent_slug) { |
|
152 | 152 | |
153 | - if ( ! isset( $classes[ $parent_slug ] ) ) { |
|
154 | - $classes[ $parent_slug ] = array(); |
|
153 | + if ( ! isset($classes[$parent_slug])) { |
|
154 | + $classes[$parent_slug] = array(); |
|
155 | 155 | } |
156 | 156 | |
157 | - $classes =& $classes[ $parent_slug ]; |
|
157 | + $classes = & $classes[$parent_slug]; |
|
158 | 158 | } |
159 | 159 | |
160 | - $classes['_classes'][ $slug ] = $class; |
|
160 | + $classes['_classes'][$slug] = $class; |
|
161 | 161 | |
162 | 162 | return true; |
163 | 163 | } |
@@ -165,43 +165,43 @@ discard block |
||
165 | 165 | /** |
166 | 166 | * @since 2.2.0 |
167 | 167 | */ |
168 | - public function deregister( $slug, array $parent_slugs = array() ) { |
|
168 | + public function deregister($slug, array $parent_slugs = array()) { |
|
169 | 169 | |
170 | - $classes = &$this->get_deep( $this->classes, $parent_slugs ); |
|
170 | + $classes = &$this->get_deep($this->classes, $parent_slugs); |
|
171 | 171 | |
172 | - if ( ! $classes ) { |
|
172 | + if ( ! $classes) { |
|
173 | 173 | return; |
174 | 174 | } |
175 | 175 | |
176 | - unset( $classes['_classes'][ $slug ] ); |
|
176 | + unset($classes['_classes'][$slug]); |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | /** |
180 | 180 | * @since 2.2.0 |
181 | 181 | */ |
182 | - public function deregister_children( array $parent_slugs = array() ) { |
|
182 | + public function deregister_children(array $parent_slugs = array()) { |
|
183 | 183 | |
184 | - $classes = &$this->get_deep( $this->classes, $parent_slugs ); |
|
184 | + $classes = &$this->get_deep($this->classes, $parent_slugs); |
|
185 | 185 | |
186 | - if ( ! $classes ) { |
|
186 | + if ( ! $classes) { |
|
187 | 187 | return; |
188 | 188 | } |
189 | 189 | |
190 | - unset( $classes['_classes'] ); |
|
190 | + unset($classes['_classes']); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | /** |
194 | 194 | * @since 2.2.0 |
195 | 195 | */ |
196 | - public function is_registered( $slug, array $parent_slugs = array() ) { |
|
196 | + public function is_registered($slug, array $parent_slugs = array()) { |
|
197 | 197 | |
198 | 198 | $parent_slugs[] = '_classes'; |
199 | 199 | |
200 | - if ( null !== $slug ) { |
|
200 | + if (null !== $slug) { |
|
201 | 201 | $parent_slugs[] = $slug; |
202 | 202 | } |
203 | 203 | |
204 | - return (bool) $this->get_deep( $this->classes, $parent_slugs ); |
|
204 | + return (bool) $this->get_deep($this->classes, $parent_slugs); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | /** |
@@ -214,19 +214,19 @@ discard block |
||
214 | 214 | * |
215 | 215 | * @return mixed|false A reference to the value, or false if not found. |
216 | 216 | */ |
217 | - protected function &get_deep( array &$array, array $indexes ) { |
|
217 | + protected function &get_deep(array &$array, array $indexes) { |
|
218 | 218 | |
219 | 219 | // Only variable references can be returned by reference. |
220 | 220 | $false = false; |
221 | 221 | $false_reference = &$false; |
222 | 222 | |
223 | - foreach ( $indexes as $index ) { |
|
223 | + foreach ($indexes as $index) { |
|
224 | 224 | |
225 | - if ( ! isset( $array[ $index ] ) ) { |
|
225 | + if ( ! isset($array[$index])) { |
|
226 | 226 | return $false_reference; |
227 | 227 | } |
228 | 228 | |
229 | - $array = &$array[ $index ]; |
|
229 | + $array = &$array[$index]; |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | return $array; |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | * |
51 | 51 | * @return object|false The object or false if it is not registered. |
52 | 52 | */ |
53 | - public function get( $slug ); |
|
53 | + public function get($slug); |
|
54 | 54 | |
55 | 55 | /** |
56 | 56 | * Register a type of object. |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * |
64 | 64 | * @return bool Whether the class was registered successfully. |
65 | 65 | */ |
66 | - public function register( $slug, $class, array $args = array() ); |
|
66 | + public function register($slug, $class, array $args = array()); |
|
67 | 67 | |
68 | 68 | /** |
69 | 69 | * Deregister a type of object |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * |
73 | 73 | * @param string $slug The slug of the class to deregister. |
74 | 74 | */ |
75 | - public function deregister( $slug ); |
|
75 | + public function deregister($slug); |
|
76 | 76 | |
77 | 77 | /** |
78 | 78 | * Check if a type of object is registered by its slug. |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * |
84 | 84 | * @return bool Whether the class is registered. |
85 | 85 | */ |
86 | - public function is_registered( $slug ); |
|
86 | + public function is_registered($slug); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | // EOF |
@@ -30,46 +30,46 @@ discard block |
||
30 | 30 | /** |
31 | 31 | * @since 2.1.0 |
32 | 32 | */ |
33 | - public function get_all( array $args = array() ) { |
|
34 | - return self::construct_with_args( $this->classes, $args ); |
|
33 | + public function get_all(array $args = array()) { |
|
34 | + return self::construct_with_args($this->classes, $args); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
38 | 38 | * @since 2.1.0 |
39 | 39 | */ |
40 | 40 | public function get_all_slugs() { |
41 | - return array_keys( $this->classes ); |
|
41 | + return array_keys($this->classes); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
45 | 45 | * @since 2.1.0 |
46 | 46 | */ |
47 | - public function get( $slug, array $args = array() ) { |
|
47 | + public function get($slug, array $args = array()) { |
|
48 | 48 | |
49 | - if ( ! isset( $this->classes[ $slug ] ) ) { |
|
49 | + if ( ! isset($this->classes[$slug])) { |
|
50 | 50 | return false; |
51 | 51 | } |
52 | 52 | |
53 | - if ( ! empty( $args ) ) { |
|
53 | + if ( ! empty($args)) { |
|
54 | 54 | |
55 | - array_unshift( $args, $slug ); |
|
55 | + array_unshift($args, $slug); |
|
56 | 56 | |
57 | 57 | return wordpoints_construct_class_with_args( |
58 | - $this->classes[ $slug ] |
|
58 | + $this->classes[$slug] |
|
59 | 59 | , $args |
60 | 60 | ); |
61 | 61 | |
62 | 62 | } else { |
63 | - return new $this->classes[ $slug ]( $slug ); |
|
63 | + return new $this->classes[$slug]($slug); |
|
64 | 64 | } |
65 | 65 | } |
66 | 66 | |
67 | 67 | /** |
68 | 68 | * @since 2.1.0 |
69 | 69 | */ |
70 | - public function register( $slug, $class, array $args = array() ) { |
|
70 | + public function register($slug, $class, array $args = array()) { |
|
71 | 71 | |
72 | - $this->classes[ $slug ] = $class; |
|
72 | + $this->classes[$slug] = $class; |
|
73 | 73 | |
74 | 74 | return true; |
75 | 75 | } |
@@ -77,17 +77,17 @@ discard block |
||
77 | 77 | /** |
78 | 78 | * @since 2.1.0 |
79 | 79 | */ |
80 | - public function deregister( $slug ) { |
|
80 | + public function deregister($slug) { |
|
81 | 81 | |
82 | - unset( $this->classes[ $slug ] ); |
|
82 | + unset($this->classes[$slug]); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
86 | 86 | * @since 2.1.0 |
87 | 87 | */ |
88 | - public function is_registered( $slug ) { |
|
88 | + public function is_registered($slug) { |
|
89 | 89 | |
90 | - return isset( $this->classes[ $slug ] ); |
|
90 | + return isset($this->classes[$slug]); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
@@ -114,39 +114,39 @@ discard block |
||
114 | 114 | array $args = array() |
115 | 115 | ) { |
116 | 116 | |
117 | - $pass_slugs = ( ! isset( $args['pass_slugs'] ) || $args['pass_slugs'] ); |
|
117 | + $pass_slugs = ( ! isset($args['pass_slugs']) || $args['pass_slugs']); |
|
118 | 118 | |
119 | 119 | $objects = array(); |
120 | 120 | |
121 | - if ( empty( $construct_with_args ) ) { |
|
121 | + if (empty($construct_with_args)) { |
|
122 | 122 | |
123 | - if ( $pass_slugs ) { |
|
124 | - foreach ( $classes as $slug => $class ) { |
|
125 | - $objects[ $slug ] = new $class( $slug ); |
|
123 | + if ($pass_slugs) { |
|
124 | + foreach ($classes as $slug => $class) { |
|
125 | + $objects[$slug] = new $class($slug); |
|
126 | 126 | } |
127 | 127 | } else { |
128 | - foreach ( $classes as $slug => $class ) { |
|
129 | - $objects[ $slug ] = new $class(); |
|
128 | + foreach ($classes as $slug => $class) { |
|
129 | + $objects[$slug] = new $class(); |
|
130 | 130 | } |
131 | 131 | } |
132 | 132 | |
133 | 133 | } else { |
134 | 134 | |
135 | - if ( $pass_slugs ) { |
|
135 | + if ($pass_slugs) { |
|
136 | 136 | |
137 | - array_unshift( $construct_with_args, null ); |
|
137 | + array_unshift($construct_with_args, null); |
|
138 | 138 | |
139 | - foreach ( $classes as $slug => $class ) { |
|
140 | - $objects[ $slug ] = wordpoints_construct_class_with_args( |
|
139 | + foreach ($classes as $slug => $class) { |
|
140 | + $objects[$slug] = wordpoints_construct_class_with_args( |
|
141 | 141 | $class |
142 | - , array( $slug ) + $construct_with_args |
|
142 | + , array($slug) + $construct_with_args |
|
143 | 143 | ); |
144 | 144 | } |
145 | 145 | |
146 | 146 | } else { |
147 | 147 | |
148 | - foreach ( $classes as $slug => $class ) { |
|
149 | - $objects[ $slug ] = wordpoints_construct_class_with_args( |
|
148 | + foreach ($classes as $slug => $class) { |
|
149 | + $objects[$slug] = wordpoints_construct_class_with_args( |
|
150 | 150 | $class |
151 | 151 | , $construct_with_args |
152 | 152 | ); |
@@ -108,11 +108,11 @@ discard block |
||
108 | 108 | * |
109 | 109 | * @return mixed The entity, or false if not found. |
110 | 110 | */ |
111 | - protected function get_entity( $id ) { |
|
111 | + protected function get_entity($id) { |
|
112 | 112 | |
113 | - $entity = call_user_func( $this->getter, $id ); |
|
113 | + $entity = call_user_func($this->getter, $id); |
|
114 | 114 | |
115 | - if ( ! $this->is_entity( $entity ) ) { |
|
115 | + if ( ! $this->is_entity($entity)) { |
|
116 | 116 | return false; |
117 | 117 | } |
118 | 118 | |
@@ -128,13 +128,13 @@ discard block |
||
128 | 128 | * |
129 | 129 | * @return bool Whether the passed value is an entity. |
130 | 130 | */ |
131 | - protected function is_entity( $entity ) { |
|
131 | + protected function is_entity($entity) { |
|
132 | 132 | |
133 | - if ( ! is_object( $entity ) && ! is_array( $entity ) ) { |
|
133 | + if ( ! is_object($entity) && ! is_array($entity)) { |
|
134 | 134 | return false; |
135 | 135 | } |
136 | 136 | |
137 | - return (bool) $this->get_entity_id( $entity ); |
|
137 | + return (bool) $this->get_entity_id($entity); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
@@ -151,16 +151,16 @@ discard block |
||
151 | 151 | * |
152 | 152 | * @return mixed The entity, or false if not found. |
153 | 153 | */ |
154 | - protected function get_entity_from_context( $id, $context ) { |
|
154 | + protected function get_entity_from_context($id, $context) { |
|
155 | 155 | |
156 | 156 | /** @var WordPoints_Entity_Contexts $contexts */ |
157 | - $contexts = wordpoints_entities()->get_sub_app( 'contexts' ); |
|
157 | + $contexts = wordpoints_entities()->get_sub_app('contexts'); |
|
158 | 158 | |
159 | - if ( ! $contexts->switch_to( $context ) ) { |
|
159 | + if ( ! $contexts->switch_to($context)) { |
|
160 | 160 | return false; |
161 | 161 | } |
162 | 162 | |
163 | - $entity = $this->get_entity( $id ); |
|
163 | + $entity = $this->get_entity($id); |
|
164 | 164 | |
165 | 165 | $contexts->switch_back(); |
166 | 166 | |
@@ -176,13 +176,13 @@ discard block |
||
176 | 176 | * |
177 | 177 | * @return bool Whether the passed value is a GUID for an entity of this type. |
178 | 178 | */ |
179 | - protected function is_guid( $guid ) { |
|
179 | + protected function is_guid($guid) { |
|
180 | 180 | |
181 | - if ( ! is_array( $guid ) ) { |
|
181 | + if ( ! is_array($guid)) { |
|
182 | 182 | return false; |
183 | 183 | } |
184 | 184 | |
185 | - return isset( $guid[ $this->get_slug() ], $guid[ $this->get_context() ] ); |
|
185 | + return isset($guid[$this->get_slug()], $guid[$this->get_context()]); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | /** |
@@ -197,15 +197,15 @@ discard block |
||
197 | 197 | * @type array $context The entity context. |
198 | 198 | * } |
199 | 199 | */ |
200 | - protected function split_guid( $guid ) { |
|
200 | + protected function split_guid($guid) { |
|
201 | 201 | |
202 | 202 | $slug = $this->get_slug(); |
203 | - $id = $guid[ $slug ]; |
|
203 | + $id = $guid[$slug]; |
|
204 | 204 | $context = $guid; |
205 | 205 | |
206 | - unset( $context[ $slug ] ); |
|
206 | + unset($context[$slug]); |
|
207 | 207 | |
208 | - return array( 'id' => $id, 'context' => $context ); |
|
208 | + return array('id' => $id, 'context' => $context); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | /** |
@@ -218,14 +218,14 @@ discard block |
||
218 | 218 | * |
219 | 219 | * @return mixed The value of the attribute of the entity. |
220 | 220 | */ |
221 | - protected function get_attr_value( $entity, $attr ) { |
|
221 | + protected function get_attr_value($entity, $attr) { |
|
222 | 222 | |
223 | - if ( is_array( $entity ) ) { |
|
224 | - if ( isset( $entity[ $attr ] ) ) { |
|
225 | - return $entity[ $attr ]; |
|
223 | + if (is_array($entity)) { |
|
224 | + if (isset($entity[$attr])) { |
|
225 | + return $entity[$attr]; |
|
226 | 226 | } |
227 | 227 | } else { |
228 | - if ( isset( $entity->{$attr} ) ) { |
|
228 | + if (isset($entity->{$attr} )) { |
|
229 | 229 | return $entity->{$attr}; |
230 | 230 | } |
231 | 231 | } |
@@ -242,8 +242,8 @@ discard block |
||
242 | 242 | * |
243 | 243 | * @return mixed The ID of the entity. |
244 | 244 | */ |
245 | - protected function get_entity_id( $entity ) { |
|
246 | - return $this->get_attr_value( $entity, $this->get_id_field() ); |
|
245 | + protected function get_entity_id($entity) { |
|
246 | + return $this->get_attr_value($entity, $this->get_id_field()); |
|
247 | 247 | } |
248 | 248 | |
249 | 249 | /** |
@@ -259,8 +259,8 @@ discard block |
||
259 | 259 | * |
260 | 260 | * @return mixed The human ID of the entity. |
261 | 261 | */ |
262 | - protected function get_entity_human_id( $entity ) { |
|
263 | - return $this->get_attr_value( $entity, $this->human_id_field ); |
|
262 | + protected function get_entity_human_id($entity) { |
|
263 | + return $this->get_attr_value($entity, $this->human_id_field); |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | // |
@@ -302,15 +302,15 @@ discard block |
||
302 | 302 | * |
303 | 303 | * @return string|int|float|false The human identifier for the entity, or false. |
304 | 304 | */ |
305 | - public function get_human_id( $id ) { |
|
305 | + public function get_human_id($id) { |
|
306 | 306 | |
307 | - $entity = $this->get_entity( $id ); |
|
307 | + $entity = $this->get_entity($id); |
|
308 | 308 | |
309 | - if ( ! $entity ) { |
|
309 | + if ( ! $entity) { |
|
310 | 310 | return false; |
311 | 311 | } |
312 | 312 | |
313 | - return $this->get_entity_human_id( $entity ); |
|
313 | + return $this->get_entity_human_id($entity); |
|
314 | 314 | } |
315 | 315 | |
316 | 316 | /** |
@@ -322,8 +322,8 @@ discard block |
||
322 | 322 | * |
323 | 323 | * @return bool Whether or not an entity with that ID exists. |
324 | 324 | */ |
325 | - public function exists( $id ) { |
|
326 | - return (bool) $this->get_entity( $id ); |
|
325 | + public function exists($id) { |
|
326 | + return (bool) $this->get_entity($id); |
|
327 | 327 | } |
328 | 328 | |
329 | 329 | /** |
@@ -338,17 +338,17 @@ discard block |
||
338 | 338 | * |
339 | 339 | * @return WordPoints_Entityish|false The child's object, or false if not found. |
340 | 340 | */ |
341 | - public function get_child( $child_slug ) { |
|
341 | + public function get_child($child_slug) { |
|
342 | 342 | |
343 | - $children = wordpoints_entities()->get_sub_app( 'children' ); |
|
343 | + $children = wordpoints_entities()->get_sub_app('children'); |
|
344 | 344 | |
345 | - $child = $children->get( $this->slug, $child_slug ); |
|
345 | + $child = $children->get($this->slug, $child_slug); |
|
346 | 346 | |
347 | 347 | if ( |
348 | - isset( $this->the_value ) |
|
348 | + isset($this->the_value) |
|
349 | 349 | && $child instanceof WordPoints_Entity_ChildI |
350 | 350 | ) { |
351 | - $child->set_the_value_from_entity( $this ); |
|
351 | + $child->set_the_value_from_entity($this); |
|
352 | 352 | } |
353 | 353 | |
354 | 354 | return $child; |
@@ -371,33 +371,33 @@ discard block |
||
371 | 371 | * |
372 | 372 | * @return bool Whether the value was set. |
373 | 373 | */ |
374 | - public function set_the_value( $value ) { |
|
374 | + public function set_the_value($value) { |
|
375 | 375 | |
376 | 376 | $this->the_value = $this->the_entity = $this->the_context = null; |
377 | 377 | |
378 | - if ( $this->is_entity( $value ) ) { |
|
378 | + if ($this->is_entity($value)) { |
|
379 | 379 | |
380 | 380 | $entity = $value; |
381 | - $value = $this->get_entity_id( $value ); |
|
381 | + $value = $this->get_entity_id($value); |
|
382 | 382 | |
383 | - } elseif ( $this->is_guid( $value ) ) { |
|
383 | + } elseif ($this->is_guid($value)) { |
|
384 | 384 | |
385 | - $guid = $this->split_guid( $value ); |
|
385 | + $guid = $this->split_guid($value); |
|
386 | 386 | $context = $guid['context']; |
387 | 387 | $value = $guid['id']; |
388 | 388 | |
389 | - $entity = $this->get_entity_from_context( $guid['id'], $context ); |
|
389 | + $entity = $this->get_entity_from_context($guid['id'], $context); |
|
390 | 390 | |
391 | 391 | } else { |
392 | 392 | |
393 | - $entity = $this->get_entity( $value ); |
|
393 | + $entity = $this->get_entity($value); |
|
394 | 394 | } |
395 | 395 | |
396 | - if ( ! $entity ) { |
|
396 | + if ( ! $entity) { |
|
397 | 397 | return false; |
398 | 398 | } |
399 | 399 | |
400 | - if ( ! isset( $context ) ) { |
|
400 | + if ( ! isset($context)) { |
|
401 | 401 | $context = wordpoints_entities_get_current_context_id( |
402 | 402 | $this->get_context() |
403 | 403 | ); |
@@ -419,8 +419,8 @@ discard block |
||
419 | 419 | * |
420 | 420 | * @return mixed The value of the attribute. |
421 | 421 | */ |
422 | - public function get_the_attr_value( $attr ) { |
|
423 | - return $this->get_attr_value( $this->the_entity, $attr ); |
|
422 | + public function get_the_attr_value($attr) { |
|
423 | + return $this->get_attr_value($this->the_entity, $attr); |
|
424 | 424 | } |
425 | 425 | |
426 | 426 | /** |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | * @return string|int|float|null The human identifier for the entity, or null. |
445 | 445 | */ |
446 | 446 | public function get_the_human_id() { |
447 | - return $this->get_entity_human_id( $this->the_entity ); |
|
447 | + return $this->get_entity_human_id($this->the_entity); |
|
448 | 448 | } |
449 | 449 | |
450 | 450 | /** |
@@ -478,11 +478,11 @@ discard block |
||
478 | 478 | |
479 | 479 | $guid = $this->get_the_context(); |
480 | 480 | |
481 | - if ( ! is_array( $guid ) ) { |
|
481 | + if ( ! is_array($guid)) { |
|
482 | 482 | return $guid; |
483 | 483 | } |
484 | 484 | |
485 | - $guid = array( $this->slug => $this->get_the_id() ) + $guid; |
|
485 | + $guid = array($this->slug => $this->get_the_id()) + $guid; |
|
486 | 486 | |
487 | 487 | return $guid; |
488 | 488 | } |
@@ -42,7 +42,7 @@ |
||
42 | 42 | * |
43 | 43 | * @return mixed|WP_Error The validated value or a WP_Error on failure. |
44 | 44 | */ |
45 | - public function validate_value( $value ); |
|
45 | + public function validate_value($value); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | // EOF |
@@ -28,7 +28,7 @@ |
||
28 | 28 | * |
29 | 29 | * @param string $slug The slug of this data type. |
30 | 30 | */ |
31 | - public function __construct( $slug ) { |
|
31 | + public function __construct($slug) { |
|
32 | 32 | $this->slug = $slug; |
33 | 33 | } |
34 | 34 |
@@ -17,14 +17,14 @@ |
||
17 | 17 | /** |
18 | 18 | * @since 2.1.0 |
19 | 19 | */ |
20 | - public function validate_value( $value ) { |
|
20 | + public function validate_value($value) { |
|
21 | 21 | |
22 | - wordpoints_int( $value ); |
|
22 | + wordpoints_int($value); |
|
23 | 23 | |
24 | - if ( false === $value ) { |
|
24 | + if (false === $value) { |
|
25 | 25 | return new WP_Error( |
26 | 26 | 'not_integer' |
27 | - , __( '%s must be an integer.', 'wordpoints' ) |
|
27 | + , __('%s must be an integer.', 'wordpoints') |
|
28 | 28 | ); |
29 | 29 | } |
30 | 30 |
@@ -20,12 +20,12 @@ |
||
20 | 20 | /** |
21 | 21 | * @since 2.1.0 |
22 | 22 | */ |
23 | - public function validate_value( $value ) { |
|
23 | + public function validate_value($value) { |
|
24 | 24 | |
25 | - if ( ! is_string( $value ) ) { |
|
25 | + if ( ! is_string($value)) { |
|
26 | 26 | return new WP_Error( |
27 | 27 | 'not_string' |
28 | - , __( '%s must be a text value.', 'wordpoints' ) |
|
28 | + , __('%s must be a text value.', 'wordpoints') |
|
29 | 29 | ); |
30 | 30 | } |
31 | 31 |
@@ -76,7 +76,7 @@ |
||
76 | 76 | * |
77 | 77 | * @param WordPoints_Hook_Fire $fire The hook fire object. |
78 | 78 | */ |
79 | - public function hit( WordPoints_Hook_Fire $fire ); |
|
79 | + public function hit(WordPoints_Hook_Fire $fire); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | // EOF |