@@ -26,43 +26,43 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @throws ApplicationAlreadyBootedException |
28 | 28 | */ |
29 | - public function __construct( $file, array $providers = array() ) { |
|
30 | - if ( static::$instance !== null ) { |
|
29 | + public function __construct($file, array $providers = array()) { |
|
30 | + if (static::$instance !== null) { |
|
31 | 31 | throw new ApplicationAlreadyBootedException; |
32 | 32 | } |
33 | 33 | |
34 | 34 | static::$instance = $this; |
35 | 35 | |
36 | - parent::__construct( $providers ); |
|
37 | - $this->register_constants( $file ); |
|
36 | + parent::__construct($providers); |
|
37 | + $this->register_constants($file); |
|
38 | 38 | $this->register_core_services(); |
39 | 39 | $this->load_i18n(); |
40 | 40 | |
41 | - register_activation_hook( $file, array( $this, 'activate' ) ); |
|
42 | - register_deactivation_hook( $file, array( $this, 'deactivate' ) ); |
|
41 | + register_activation_hook($file, array($this, 'activate')); |
|
42 | + register_deactivation_hook($file, array($this, 'deactivate')); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
46 | 46 | * {@inheritDoc} |
47 | 47 | */ |
48 | 48 | public function boot() { |
49 | - $loader = $this->fetch( 'loader' ); |
|
49 | + $loader = $this->fetch('loader'); |
|
50 | 50 | |
51 | - if ( ! $loader instanceof LoaderContract ) { |
|
51 | + if (!$loader instanceof LoaderContract) { |
|
52 | 52 | throw new \UnexpectedValueException; |
53 | 53 | } |
54 | 54 | |
55 | - foreach ( $this as $alias => $value ) { |
|
56 | - if ( $value instanceof HasActions ) { |
|
57 | - $loader->register_actions( $value ); |
|
55 | + foreach ($this as $alias => $value) { |
|
56 | + if ($value instanceof HasActions) { |
|
57 | + $loader->register_actions($value); |
|
58 | 58 | } |
59 | 59 | |
60 | - if ( $value instanceof HasFilters ) { |
|
61 | - $loader->register_filters( $value ); |
|
60 | + if ($value instanceof HasFilters) { |
|
61 | + $loader->register_filters($value); |
|
62 | 62 | } |
63 | 63 | } |
64 | 64 | |
65 | - add_action( 'plugins_loaded', array( $loader, 'run' ) ); |
|
65 | + add_action('plugins_loaded', array($loader, 'run')); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * @throws ApplicationNotBootedException |
91 | 91 | */ |
92 | 92 | public static function instance() { |
93 | - if ( static::$instance === null ) { |
|
93 | + if (static::$instance === null) { |
|
94 | 94 | throw new ApplicationNotBootedException; |
95 | 95 | } |
96 | 96 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * {@inheritDoc} |
102 | 102 | */ |
103 | 103 | public static function shutdown() { |
104 | - if ( static::$instance !== null ) { |
|
104 | + if (static::$instance !== null) { |
|
105 | 105 | static::$instance = null; |
106 | 106 | } |
107 | 107 | } |
@@ -111,21 +111,21 @@ discard block |
||
111 | 111 | * |
112 | 112 | * @param string $file |
113 | 113 | */ |
114 | - private function register_constants( $file ) { |
|
115 | - $this->share( 'url', plugin_dir_url( $file ) ); |
|
116 | - $this->share( 'path', plugin_dir_path( $file ) ); |
|
117 | - $this->share( 'basename', plugin_basename( $file ) ); |
|
114 | + private function register_constants($file) { |
|
115 | + $this->share('url', plugin_dir_url($file)); |
|
116 | + $this->share('path', plugin_dir_path($file)); |
|
117 | + $this->share('basename', plugin_basename($file)); |
|
118 | 118 | |
119 | - $plugin_data = get_plugin_data( $file, false, false ); |
|
120 | - $this->share( 'version', isset( $plugin_data['Version'] ) ? $plugin_data['Version'] : null ); |
|
119 | + $plugin_data = get_plugin_data($file, false, false); |
|
120 | + $this->share('version', isset($plugin_data['Version']) ? $plugin_data['Version'] : null); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | /** |
124 | 124 | * Registers the built-in services with the Application container. |
125 | 125 | */ |
126 | 126 | private function register_core_services() { |
127 | - $this->share( array( 'loader' => 'Intraxia\Jaxion\Contract\Core\Loader' ), function ( $app ) { |
|
128 | - return new Loader( $app ); |
|
127 | + $this->share(array('loader' => 'Intraxia\Jaxion\Contract\Core\Loader'), function($app) { |
|
128 | + return new Loader($app); |
|
129 | 129 | } ); |
130 | 130 | } |
131 | 131 | |
@@ -134,9 +134,9 @@ discard block |
||
134 | 134 | */ |
135 | 135 | private function load_i18n() { |
136 | 136 | load_plugin_textdomain( |
137 | - $this->fetch( 'basename' ), |
|
137 | + $this->fetch('basename'), |
|
138 | 138 | false, |
139 | - basename( $this->fetch( 'path' ) ) . '/languages/' |
|
139 | + basename($this->fetch('path')) . '/languages/' |
|
140 | 140 | ); |
141 | 141 | } |
142 | 142 | } |
@@ -32,19 +32,19 @@ discard block |
||
32 | 32 | * {@inheritDoc} |
33 | 33 | */ |
34 | 34 | public function run() { |
35 | - foreach ( $this->actions as $action ) { |
|
35 | + foreach ($this->actions as $action) { |
|
36 | 36 | add_action( |
37 | 37 | $action['hook'], |
38 | - array( $action['service'], $action['method'] ), |
|
38 | + array($action['service'], $action['method']), |
|
39 | 39 | $action['priority'], |
40 | 40 | $action['args'] |
41 | 41 | ); |
42 | 42 | } |
43 | 43 | |
44 | - foreach ( $this->filters as $filter ) { |
|
44 | + foreach ($this->filters as $filter) { |
|
45 | 45 | add_filter( |
46 | 46 | $filter['hook'], |
47 | - array( $filter['service'], $filter['method'] ), |
|
47 | + array($filter['service'], $filter['method']), |
|
48 | 48 | $filter['priority'], |
49 | 49 | $filter['args'] |
50 | 50 | ); |
@@ -56,15 +56,15 @@ discard block |
||
56 | 56 | * |
57 | 57 | * @param HasActions $service |
58 | 58 | */ |
59 | - public function register_actions( HasActions $service ) { |
|
60 | - foreach ( $service->action_hooks() as $action ) { |
|
59 | + public function register_actions(HasActions $service) { |
|
60 | + foreach ($service->action_hooks() as $action) { |
|
61 | 61 | $this->actions = $this->add( |
62 | 62 | $this->actions, |
63 | 63 | $action['hook'], |
64 | 64 | $service, |
65 | 65 | $action['method'], |
66 | - isset( $action['priority'] ) ? $action['priority'] : 10, |
|
67 | - isset( $action['args'] ) ? $action['args'] : 1 |
|
66 | + isset($action['priority']) ? $action['priority'] : 10, |
|
67 | + isset($action['args']) ? $action['args'] : 1 |
|
68 | 68 | ); |
69 | 69 | } |
70 | 70 | } |
@@ -74,15 +74,15 @@ discard block |
||
74 | 74 | * |
75 | 75 | * @param HasFilters $service |
76 | 76 | */ |
77 | - public function register_filters( HasFilters $service ) { |
|
78 | - foreach ( $service->filter_hooks() as $filter ) { |
|
77 | + public function register_filters(HasFilters $service) { |
|
78 | + foreach ($service->filter_hooks() as $filter) { |
|
79 | 79 | $this->filters = $this->add( |
80 | 80 | $this->filters, |
81 | 81 | $filter['hook'], |
82 | 82 | $service, |
83 | 83 | $filter['method'], |
84 | - isset( $filter['priority'] ) ? $filter['priority'] : 10, |
|
85 | - isset( $filter['args'] ) ? $filter['args'] : 1 |
|
84 | + isset($filter['priority']) ? $filter['priority'] : 10, |
|
85 | + isset($filter['args']) ? $filter['args'] : 1 |
|
86 | 86 | ); |
87 | 87 | } |
88 | 88 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * |
100 | 100 | * @return array |
101 | 101 | */ |
102 | - protected function add( $hooks, $hook, $service, $method, $priority, $accepted_args ) { |
|
102 | + protected function add($hooks, $hook, $service, $method, $priority, $accepted_args) { |
|
103 | 103 | $hooks[] = array( |
104 | 104 | 'hook' => $hook, |
105 | 105 | 'service' => $service, |
@@ -62,14 +62,14 @@ discard block |
||
62 | 62 | * |
63 | 63 | * @param ServiceProvider[]|string[] $providers |
64 | 64 | */ |
65 | - public function __construct( array $providers = array() ) { |
|
66 | - foreach ( $providers as $provider ) { |
|
67 | - if ( is_string( $provider ) && class_exists( $provider ) ) { |
|
65 | + public function __construct(array $providers = array()) { |
|
66 | + foreach ($providers as $provider) { |
|
67 | + if (is_string($provider) && class_exists($provider)) { |
|
68 | 68 | $provider = new $provider; |
69 | 69 | } |
70 | 70 | |
71 | - if ( $provider instanceof ServiceProvider ) { |
|
72 | - $this->register( $provider ); |
|
71 | + if ($provider instanceof ServiceProvider) { |
|
72 | + $this->register($provider); |
|
73 | 73 | } |
74 | 74 | } |
75 | 75 | } |
@@ -85,27 +85,27 @@ discard block |
||
85 | 85 | * |
86 | 86 | * @return $this |
87 | 87 | */ |
88 | - public function define( $alias, $definition ) { |
|
89 | - if ( is_array( $alias ) ) { |
|
90 | - $class = current( $alias ); |
|
91 | - $alias = key( $alias ); |
|
88 | + public function define($alias, $definition) { |
|
89 | + if (is_array($alias)) { |
|
90 | + $class = current($alias); |
|
91 | + $alias = key($alias); |
|
92 | 92 | } |
93 | 93 | |
94 | - if ( isset( $this->aliases[ $alias ] ) ) { |
|
94 | + if (isset($this->aliases[$alias])) { |
|
95 | 95 | throw new DefinedAliasException; |
96 | 96 | } |
97 | 97 | |
98 | - $this->aliases[ $alias ] = true; |
|
99 | - $this->definitions[ $alias ] = $definition; |
|
98 | + $this->aliases[$alias] = true; |
|
99 | + $this->definitions[$alias] = $definition; |
|
100 | 100 | |
101 | 101 | // Closures are treated as factories unless |
102 | 102 | // defined via Container::share. |
103 | - if ( ! $definition instanceof \Closure ) { |
|
104 | - $this->shared[ $alias ] = true; |
|
103 | + if (!$definition instanceof \Closure) { |
|
104 | + $this->shared[$alias] = true; |
|
105 | 105 | } |
106 | 106 | |
107 | - if ( isset( $class ) ) { |
|
108 | - $this->classes[ $class ] = $alias; |
|
107 | + if (isset($class)) { |
|
108 | + $this->classes[$class] = $alias; |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | return $this; |
@@ -121,14 +121,14 @@ discard block |
||
121 | 121 | * |
122 | 122 | * @return $this |
123 | 123 | */ |
124 | - public function share( $alias, $definition ) { |
|
125 | - $this->define( $alias, $definition ); |
|
124 | + public function share($alias, $definition) { |
|
125 | + $this->define($alias, $definition); |
|
126 | 126 | |
127 | - if ( is_array( $alias ) ) { |
|
128 | - $alias = key( $alias ); |
|
127 | + if (is_array($alias)) { |
|
128 | + $alias = key($alias); |
|
129 | 129 | } |
130 | 130 | |
131 | - $this->shared[ $alias ] = true; |
|
131 | + $this->shared[$alias] = true; |
|
132 | 132 | |
133 | 133 | return $this; |
134 | 134 | } |
@@ -142,32 +142,32 @@ discard block |
||
142 | 142 | * |
143 | 143 | * @return mixed |
144 | 144 | */ |
145 | - public function fetch( $alias ) { |
|
146 | - if ( isset( $this->classes[ $alias ] ) ) { |
|
145 | + public function fetch($alias) { |
|
146 | + if (isset($this->classes[$alias])) { |
|
147 | 147 | // If the alias is a class name, |
148 | 148 | // then retrieve its linked alias. |
149 | 149 | // This is only registered when |
150 | 150 | // registering using an array. |
151 | - $alias = $this->classes[ $alias ]; |
|
151 | + $alias = $this->classes[$alias]; |
|
152 | 152 | } |
153 | 153 | |
154 | - if ( ! isset( $this->aliases[ $alias ] ) ) { |
|
154 | + if (!isset($this->aliases[$alias])) { |
|
155 | 155 | throw new UndefinedAliasException; |
156 | 156 | } |
157 | 157 | |
158 | - $value = $this->definitions[ $alias ]; |
|
158 | + $value = $this->definitions[$alias]; |
|
159 | 159 | |
160 | 160 | // If the shared value is a closure, |
161 | 161 | // execute it and assign the result |
162 | 162 | // in place of the closure. |
163 | - if ( $value instanceof \Closure ) { |
|
163 | + if ($value instanceof \Closure) { |
|
164 | 164 | $factory = $value; |
165 | - $value = $factory( $this ); |
|
165 | + $value = $factory($this); |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | // If the value is shared, save the shared value. |
169 | - if ( isset( $this->shared[ $alias ] ) ) { |
|
170 | - $this->definitions[ $alias ] = $value; |
|
169 | + if (isset($this->shared[$alias])) { |
|
170 | + $this->definitions[$alias] = $value; |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | // Return the fetched value. |
@@ -181,8 +181,8 @@ discard block |
||
181 | 181 | * |
182 | 182 | * @return bool |
183 | 183 | */ |
184 | - public function has( $alias ) { |
|
185 | - return isset( $this->aliases[ $alias ] ); |
|
184 | + public function has($alias) { |
|
185 | + return isset($this->aliases[$alias]); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | /** |
@@ -192,8 +192,8 @@ discard block |
||
192 | 192 | * |
193 | 193 | * @return $this |
194 | 194 | */ |
195 | - public function remove( $alias ) { |
|
196 | - if ( isset( $this->aliases[ $alias ] ) ) { |
|
195 | + public function remove($alias) { |
|
196 | + if (isset($this->aliases[$alias])) { |
|
197 | 197 | /** |
198 | 198 | * If there's no reference in the aliases array, |
199 | 199 | * the service won't be found on fetching and |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | * |
209 | 209 | * If this is a problem, this may need to be revisited. |
210 | 210 | */ |
211 | - unset( $this->aliases[ $alias ] ); |
|
211 | + unset($this->aliases[$alias]); |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | return $this; |
@@ -221,8 +221,8 @@ discard block |
||
221 | 221 | * |
222 | 222 | * @return $this |
223 | 223 | */ |
224 | - public function register( ServiceProvider $provider ) { |
|
225 | - $provider->register( $this ); |
|
224 | + public function register(ServiceProvider $provider) { |
|
225 | + $provider->register($this); |
|
226 | 226 | |
227 | 227 | return $this; |
228 | 228 | } |
@@ -235,8 +235,8 @@ discard block |
||
235 | 235 | * |
236 | 236 | * @see define |
237 | 237 | */ |
238 | - public function offsetSet( $id, $value ) { |
|
239 | - $this->define( $id, $value ); |
|
238 | + public function offsetSet($id, $value) { |
|
239 | + $this->define($id, $value); |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | /** |
@@ -249,8 +249,8 @@ discard block |
||
249 | 249 | * |
250 | 250 | * @see fetch |
251 | 251 | */ |
252 | - public function offsetGet( $id ) { |
|
253 | - return $this->fetch( $id ); |
|
252 | + public function offsetGet($id) { |
|
253 | + return $this->fetch($id); |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | /** |
@@ -262,8 +262,8 @@ discard block |
||
262 | 262 | * |
263 | 263 | * @see has |
264 | 264 | */ |
265 | - public function offsetExists( $id ) { |
|
266 | - return $this->has( $id ); |
|
265 | + public function offsetExists($id) { |
|
266 | + return $this->has($id); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | /** |
@@ -273,8 +273,8 @@ discard block |
||
273 | 273 | * |
274 | 274 | * @see remove |
275 | 275 | */ |
276 | - public function offsetUnset( $id ) { |
|
277 | - $this->remove( $id ); |
|
276 | + public function offsetUnset($id) { |
|
277 | + $this->remove($id); |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | /** |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | */ |
283 | 283 | public function rewind() { |
284 | 284 | $this->position = 0; |
285 | - $this->keys = array_keys( $this->aliases ); |
|
285 | + $this->keys = array_keys($this->aliases); |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | /** |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | * @return object |
292 | 292 | */ |
293 | 293 | public function current() { |
294 | - return $this->fetch( $this->keys[ $this->position ] ); |
|
294 | + return $this->fetch($this->keys[$this->position]); |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | /** |
@@ -300,14 +300,14 @@ discard block |
||
300 | 300 | * @return string |
301 | 301 | */ |
302 | 302 | public function key() { |
303 | - return $this->keys[ $this->position ]; |
|
303 | + return $this->keys[$this->position]; |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | /** |
307 | 307 | * Increments to the next step in the loop. |
308 | 308 | */ |
309 | 309 | public function next() { |
310 | - $this->position ++; |
|
310 | + $this->position++; |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | /** |
@@ -316,6 +316,6 @@ discard block |
||
316 | 316 | * @return bool |
317 | 317 | */ |
318 | 318 | public function valid() { |
319 | - return isset( $this->keys[ $this->position ] ); |
|
319 | + return isset($this->keys[$this->position]); |
|
320 | 320 | } |
321 | 321 | } |
@@ -30,7 +30,7 @@ |
||
30 | 30 | * |
31 | 31 | * @var array |
32 | 32 | */ |
33 | - protected $fillable = array( 'ID', 'author', 'slug', 'title', 'publish_date', 'content', 'excerpt' ); |
|
33 | + protected $fillable = array('ID', 'author', 'slug', 'title', 'publish_date', 'content', 'excerpt'); |
|
34 | 34 | |
35 | 35 | /** |
36 | 36 | * ID property maps to ID. |
@@ -66,12 +66,12 @@ discard block |
||
66 | 66 | * |
67 | 67 | * @param array <string, mixed> $attributes |
68 | 68 | */ |
69 | - public function __construct( array $attributes = array() ) { |
|
70 | - foreach ( $attributes as $name => $value ) { |
|
71 | - $this->set_attribute( $name, $value ); |
|
69 | + public function __construct(array $attributes = array()) { |
|
70 | + foreach ($attributes as $name => $value) { |
|
71 | + $this->set_attribute($name, $value); |
|
72 | 72 | } |
73 | 73 | |
74 | - if ( $this->post && ! isset( $this->attributes['post'] ) ) { |
|
74 | + if ($this->post && !isset($this->attributes['post'])) { |
|
75 | 75 | $this->create_default_post(); |
76 | 76 | } |
77 | 77 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * @return false|WP_Post |
98 | 98 | */ |
99 | 99 | public function get_underlying_post() { |
100 | - if ( isset( $this->attributes['post'] ) ) { |
|
100 | + if (isset($this->attributes['post'])) { |
|
101 | 101 | return $this->attributes['post']; |
102 | 102 | } |
103 | 103 | |
@@ -112,8 +112,8 @@ discard block |
||
112 | 112 | * @param string $name |
113 | 113 | * @param mixed $value |
114 | 114 | */ |
115 | - public function __set( $name, $value ) { |
|
116 | - $this->set_attribute( $name, $value ); |
|
115 | + public function __set($name, $value) { |
|
116 | + $this->set_attribute($name, $value); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | /** |
@@ -126,24 +126,24 @@ discard block |
||
126 | 126 | * @param string $name |
127 | 127 | * @param mixed $value |
128 | 128 | */ |
129 | - private function set_attribute( $name, $value ) { |
|
130 | - if ( 'post' === $name ) { |
|
131 | - $this->override_post( $value ); |
|
129 | + private function set_attribute($name, $value) { |
|
130 | + if ('post' === $name) { |
|
131 | + $this->override_post($value); |
|
132 | 132 | |
133 | 133 | return; |
134 | 134 | } |
135 | 135 | |
136 | - if ( ! $this->is_fillable( $name ) ) { |
|
136 | + if (!$this->is_fillable($name)) { |
|
137 | 137 | return; |
138 | 138 | } |
139 | 139 | |
140 | - if ( $method = $this->has_map_method( $name ) ) { |
|
140 | + if ($method = $this->has_map_method($name)) { |
|
141 | 141 | $this->attributes['post']->{$this->{$method}()} = $value; |
142 | 142 | |
143 | 143 | return; |
144 | 144 | } |
145 | 145 | |
146 | - $this->attributes['table'][ $name ] = $value; |
|
146 | + $this->attributes['table'][$name] = $value; |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | /** |
@@ -155,18 +155,18 @@ discard block |
||
155 | 155 | * |
156 | 156 | * @return bool |
157 | 157 | */ |
158 | - private function is_fillable( $name ) { |
|
158 | + private function is_fillable($name) { |
|
159 | 159 | // `type` is not fillable at all. |
160 | - if ( 'type' === $name ) { |
|
160 | + if ('type' === $name) { |
|
161 | 161 | return false; |
162 | 162 | } |
163 | 163 | |
164 | 164 | // If the `$fillable` array hasn't been defined, pass everything. |
165 | - if ( ! $this->fillable ) { |
|
165 | + if (!$this->fillable) { |
|
166 | 166 | return true; |
167 | 167 | } |
168 | 168 | |
169 | - return in_array( $name, $this->fillable ); |
|
169 | + return in_array($name, $this->fillable); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | /** |
@@ -176,8 +176,8 @@ discard block |
||
176 | 176 | * |
177 | 177 | * @param WP_Post $value |
178 | 178 | */ |
179 | - private function override_post( WP_Post $value ) { |
|
180 | - $this->attributes['post'] = $this->enforce_post_defaults( $value ); |
|
179 | + private function override_post(WP_Post $value) { |
|
180 | + $this->attributes['post'] = $this->enforce_post_defaults($value); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | /** |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | * and stores it in the attributes. |
188 | 188 | */ |
189 | 189 | private function create_default_post() { |
190 | - $this->attributes['post'] = $this->enforce_post_defaults( new WP_Post( new stdClass ) ); |
|
190 | + $this->attributes['post'] = $this->enforce_post_defaults(new WP_Post(new stdClass)); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | /** |
@@ -201,8 +201,8 @@ discard block |
||
201 | 201 | * |
202 | 202 | * @return WP_Post |
203 | 203 | */ |
204 | - protected function enforce_post_defaults( WP_Post $post ) { |
|
205 | - if ( is_string( $this->type ) ) { |
|
204 | + protected function enforce_post_defaults(WP_Post $post) { |
|
205 | + if (is_string($this->type)) { |
|
206 | 206 | $post->post_type = $this->type; |
207 | 207 | } |
208 | 208 | |
@@ -218,8 +218,8 @@ discard block |
||
218 | 218 | * |
219 | 219 | * @return mixed |
220 | 220 | */ |
221 | - public function __get( $name ) { |
|
222 | - return $this->get_attribute( $name ); |
|
221 | + public function __get($name) { |
|
222 | + return $this->get_attribute($name); |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | /** |
@@ -234,19 +234,19 @@ discard block |
||
234 | 234 | * |
235 | 235 | * @throws PropertyDoesNotExistException If property isn't found. |
236 | 236 | */ |
237 | - protected function get_attribute( $name ) { |
|
238 | - if ( 'type' === $name ) { |
|
237 | + protected function get_attribute($name) { |
|
238 | + if ('type' === $name) { |
|
239 | 239 | return $this->type; |
240 | 240 | } |
241 | 241 | |
242 | - if ( $method = $this->has_map_method( $name ) ) { |
|
242 | + if ($method = $this->has_map_method($name)) { |
|
243 | 243 | $value = $this->attributes['post']->{$this->{$method}()}; |
244 | 244 | } else { |
245 | - if ( ! isset( $this->attributes['table'][ $name ] ) ) { |
|
245 | + if (!isset($this->attributes['table'][$name])) { |
|
246 | 246 | throw new PropertyDoesNotExistException; |
247 | 247 | } |
248 | 248 | |
249 | - $value = $this->attributes['table'][ $name ]; |
|
249 | + $value = $this->attributes['table'][$name]; |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | return $value; |
@@ -264,8 +264,8 @@ discard block |
||
264 | 264 | * |
265 | 265 | * @return false|string |
266 | 266 | */ |
267 | - protected function has_map_method( $name ) { |
|
268 | - if ( method_exists( $this, $method = "map_{$name}" ) ) { |
|
267 | + protected function has_map_method($name) { |
|
268 | + if (method_exists($this, $method = "map_{$name}")) { |
|
269 | 269 | return $method; |
270 | 270 | } |
271 | 271 |
@@ -14,7 +14,7 @@ |
||
14 | 14 | * |
15 | 15 | * @throws \Intraxia\Jaxion\Core\ApplicationAlreadyBootedException |
16 | 16 | */ |
17 | - public function __construct( $file ); |
|
17 | + public function __construct($file); |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * Starts up the Application. |
@@ -10,5 +10,5 @@ |
||
10 | 10 | * |
11 | 11 | * @param Container $container |
12 | 12 | */ |
13 | - public function register( Container $container ); |
|
13 | + public function register(Container $container); |
|
14 | 14 | } |
15 | 15 | \ No newline at end of file |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | * |
19 | 19 | * @param HasActions $service |
20 | 20 | */ |
21 | - public function register_actions( HasActions $service ); |
|
21 | + public function register_actions(HasActions $service); |
|
22 | 22 | |
23 | 23 | /** |
24 | 24 | * Registers the service's filters with the loader. |
@@ -28,5 +28,5 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @param HasFilters $service |
30 | 30 | */ |
31 | - public function register_filters( HasFilters $service ); |
|
31 | + public function register_filters(HasFilters $service); |
|
32 | 32 | } |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | * |
21 | 21 | * @return $this |
22 | 22 | */ |
23 | - public function define( $alias, $definition ); |
|
23 | + public function define($alias, $definition); |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * Defines a new singleton on the Container. |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * |
34 | 34 | * @return $this |
35 | 35 | */ |
36 | - public function share( $alias, $definition ); |
|
36 | + public function share($alias, $definition); |
|
37 | 37 | |
38 | 38 | /** |
39 | 39 | * Fetches the value for the provided alias. |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * |
43 | 43 | * @return mixed |
44 | 44 | */ |
45 | - public function fetch( $alias ); |
|
45 | + public function fetch($alias); |
|
46 | 46 | |
47 | 47 | /** |
48 | 48 | * Checks whether the provided alias exists on the container. |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | * |
52 | 52 | * @return bool |
53 | 53 | */ |
54 | - public function has( $alias ); |
|
54 | + public function has($alias); |
|
55 | 55 | |
56 | 56 | /** |
57 | 57 | * Removes the provided alias from the container. |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * |
61 | 61 | * @return bool |
62 | 62 | */ |
63 | - public function remove( $alias ); |
|
63 | + public function remove($alias); |
|
64 | 64 | |
65 | 65 | /** |
66 | 66 | * Registers a service provider with the container. |
@@ -72,5 +72,5 @@ discard block |
||
72 | 72 | * |
73 | 73 | * @param ServiceProvider $provider |
74 | 74 | */ |
75 | - public function register( ServiceProvider $provider ); |
|
75 | + public function register(ServiceProvider $provider); |
|
76 | 76 | } |