@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | * |
| 15 | 15 | * @return Model|WP_Error |
| 16 | 16 | */ |
| 17 | - public function find( $class, $id ); |
|
| 17 | + public function find($class, $id); |
|
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | 20 | * Finds all the models of the provided class for the given params. |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | * |
| 27 | 27 | * @return Collection|WP_Error |
| 28 | 28 | */ |
| 29 | - public function find_by( $class, $params = array() ); |
|
| 29 | + public function find_by($class, $params = array()); |
|
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | 32 | * Saves a new model of the provided class with the given data. |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | * |
| 37 | 37 | * @return Model|WP_Error |
| 38 | 38 | */ |
| 39 | - public function create( $class, $data = array() ); |
|
| 39 | + public function create($class, $data = array()); |
|
| 40 | 40 | |
| 41 | 41 | /** |
| 42 | 42 | * Updates a model with its latest data. |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | * |
| 46 | 46 | * @return Model|WP_Error |
| 47 | 47 | */ |
| 48 | - public function persist( Model $model ); |
|
| 48 | + public function persist(Model $model); |
|
| 49 | 49 | |
| 50 | 50 | /** |
| 51 | 51 | * Delete the provided Model. |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | * |
| 56 | 56 | * @return Model|WP_Error |
| 57 | 57 | */ |
| 58 | - public function delete( Model $model, $force = false ); |
|
| 58 | + public function delete(Model $model, $force = false); |
|
| 59 | 59 | |
| 60 | 60 | /** |
| 61 | 61 | * Frees all currently managed models from the EntityManager. |
@@ -59,9 +59,9 @@ discard block |
||
| 59 | 59 | * @param string $url |
| 60 | 60 | * @param string $version |
| 61 | 61 | */ |
| 62 | - public function __construct( $url, $version = null ) { |
|
| 62 | + public function __construct($url, $version = null) { |
|
| 63 | 63 | $this->url = $url; |
| 64 | - $this->version = $version ? : null; // Empty string should remain null. |
|
| 64 | + $this->version = $version ?: null; // Empty string should remain null. |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | /** |
@@ -69,8 +69,8 @@ discard block |
||
| 69 | 69 | * |
| 70 | 70 | * @param bool $debug |
| 71 | 71 | */ |
| 72 | - public function set_debug( $debug ) { |
|
| 73 | - if ( $debug ) { |
|
| 72 | + public function set_debug($debug) { |
|
| 73 | + if ($debug) { |
|
| 74 | 74 | $this->min = '.min'; |
| 75 | 75 | } else { |
| 76 | 76 | $this->min = ''; |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | * |
| 83 | 83 | * @param array $script |
| 84 | 84 | */ |
| 85 | - public function register_script( $script ) { |
|
| 85 | + public function register_script($script) { |
|
| 86 | 86 | $this->scripts[] = $script; |
| 87 | 87 | } |
| 88 | 88 | |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | * |
| 92 | 92 | * @param array $style |
| 93 | 93 | */ |
| 94 | - public function register_style( $style ) { |
|
| 94 | + public function register_style($style) { |
|
| 95 | 95 | $this->styles[] = $style; |
| 96 | 96 | } |
| 97 | 97 | |
@@ -99,9 +99,9 @@ discard block |
||
| 99 | 99 | * {@inheritDoc} |
| 100 | 100 | */ |
| 101 | 101 | public function enqueue_web_scripts() { |
| 102 | - foreach ( $this->scripts as $script ) { |
|
| 103 | - if ( in_array( $script['type'], array( 'web', 'shared' ) ) ) { |
|
| 104 | - $this->enqueue_script( $script ); |
|
| 102 | + foreach ($this->scripts as $script) { |
|
| 103 | + if (in_array($script['type'], array('web', 'shared'))) { |
|
| 104 | + $this->enqueue_script($script); |
|
| 105 | 105 | } |
| 106 | 106 | } |
| 107 | 107 | } |
@@ -110,9 +110,9 @@ discard block |
||
| 110 | 110 | * {@inheritDoc} |
| 111 | 111 | */ |
| 112 | 112 | public function enqueue_web_styles() { |
| 113 | - foreach ( $this->styles as $style ) { |
|
| 114 | - if ( in_array( $style['type'], array( 'web', 'shared' ) ) ) { |
|
| 115 | - $this->enqueue_style( $style ); |
|
| 113 | + foreach ($this->styles as $style) { |
|
| 114 | + if (in_array($style['type'], array('web', 'shared'))) { |
|
| 115 | + $this->enqueue_style($style); |
|
| 116 | 116 | } |
| 117 | 117 | } |
| 118 | 118 | } |
@@ -121,9 +121,9 @@ discard block |
||
| 121 | 121 | * {@inheritDoc} |
| 122 | 122 | */ |
| 123 | 123 | public function enqueue_admin_scripts() { |
| 124 | - foreach ( $this->scripts as $script ) { |
|
| 125 | - if ( in_array( $script['type'], array( 'admin', 'shared' ) ) ) { |
|
| 126 | - $this->enqueue_script( $script ); |
|
| 124 | + foreach ($this->scripts as $script) { |
|
| 125 | + if (in_array($script['type'], array('admin', 'shared'))) { |
|
| 126 | + $this->enqueue_script($script); |
|
| 127 | 127 | } |
| 128 | 128 | } |
| 129 | 129 | } |
@@ -132,9 +132,9 @@ discard block |
||
| 132 | 132 | * {@inheritDoc} |
| 133 | 133 | */ |
| 134 | 134 | public function enqueue_admin_styles() { |
| 135 | - foreach ( $this->styles as $style ) { |
|
| 136 | - if ( in_array( $style['type'], array( 'admin', 'shared' ) ) ) { |
|
| 137 | - $this->enqueue_style( $style ); |
|
| 135 | + foreach ($this->styles as $style) { |
|
| 136 | + if (in_array($style['type'], array('admin', 'shared'))) { |
|
| 137 | + $this->enqueue_style($style); |
|
| 138 | 138 | } |
| 139 | 139 | } |
| 140 | 140 | } |
@@ -170,19 +170,19 @@ discard block |
||
| 170 | 170 | * |
| 171 | 171 | * @param array $script |
| 172 | 172 | */ |
| 173 | - protected function enqueue_script( $script ) { |
|
| 174 | - if ( $script['condition']() ) { |
|
| 173 | + protected function enqueue_script($script) { |
|
| 174 | + if ($script['condition']()) { |
|
| 175 | 175 | wp_enqueue_script( |
| 176 | 176 | $script['handle'], |
| 177 | 177 | $this->url . $script['src'] . '.js', |
| 178 | - isset( $script['deps'] ) ? $script['deps'] : array(), |
|
| 178 | + isset($script['deps']) ? $script['deps'] : array(), |
|
| 179 | 179 | $this->version, |
| 180 | - isset( $script['footer'] ) ? $script['footer'] : false |
|
| 180 | + isset($script['footer']) ? $script['footer'] : false |
|
| 181 | 181 | ); |
| 182 | 182 | |
| 183 | - if ( isset( $script['localize'] ) ) { |
|
| 184 | - if ( is_callable( $script['localize'] ) ) { // @todo make all properties callables |
|
| 185 | - $script['localize'] = call_user_func( $script['localize'] ); |
|
| 183 | + if (isset($script['localize'])) { |
|
| 184 | + if (is_callable($script['localize'])) { // @todo make all properties callables |
|
| 185 | + $script['localize'] = call_user_func($script['localize']); |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | wp_localize_script( |
@@ -199,14 +199,14 @@ discard block |
||
| 199 | 199 | * |
| 200 | 200 | * @param array $style |
| 201 | 201 | */ |
| 202 | - protected function enqueue_style( $style ) { |
|
| 203 | - if ( $style['condition']() ) { |
|
| 202 | + protected function enqueue_style($style) { |
|
| 203 | + if ($style['condition']()) { |
|
| 204 | 204 | wp_enqueue_style( |
| 205 | 205 | $style['handle'], |
| 206 | 206 | $this->url . $style['src'] . '.css', |
| 207 | - isset( $style['deps'] ) ? $style['deps'] : array(), |
|
| 207 | + isset($style['deps']) ? $style['deps'] : array(), |
|
| 208 | 208 | $this->version, |
| 209 | - isset( $style['media'] ) ? $style['media'] : 'all' |
|
| 209 | + isset($style['media']) ? $style['media'] : 'all' |
|
| 210 | 210 | ); |
| 211 | 211 | } |
| 212 | 212 | } |
@@ -23,15 +23,15 @@ discard block |
||
| 23 | 23 | * |
| 24 | 24 | * @param Container $container |
| 25 | 25 | */ |
| 26 | - public function register( Container $container ) { |
|
| 26 | + public function register(Container $container) { |
|
| 27 | 27 | $this->container = $container; |
| 28 | 28 | |
| 29 | 29 | $container->define( |
| 30 | - array( 'assets' => 'Intraxia\Jaxion\Contract\Assets\Register' ), |
|
| 31 | - $register = new Register( $container->fetch( 'url' ), $container->fetch( 'version' ) ) |
|
| 30 | + array('assets' => 'Intraxia\Jaxion\Contract\Assets\Register'), |
|
| 31 | + $register = new Register($container->fetch('url'), $container->fetch('version')) |
|
| 32 | 32 | ); |
| 33 | 33 | |
| 34 | - $this->add_assets( $register ); |
|
| 34 | + $this->add_assets($register); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | /** |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | * |
| 45 | 45 | * @codeCoverageIgnore |
| 46 | 46 | */ |
| 47 | - protected function add_assets( Register $register ) { |
|
| 47 | + protected function add_assets(Register $register) { |
|
| 48 | 48 | // no-op |
| 49 | 49 | } |
| 50 | 50 | } |
@@ -33,19 +33,19 @@ discard block |
||
| 33 | 33 | * {@inheritDoc} |
| 34 | 34 | */ |
| 35 | 35 | public function run() { |
| 36 | - foreach ( $this->actions as $action ) { |
|
| 36 | + foreach ($this->actions as $action) { |
|
| 37 | 37 | add_action( |
| 38 | 38 | $action['hook'], |
| 39 | - array( $action['service'], $action['method'] ), |
|
| 39 | + array($action['service'], $action['method']), |
|
| 40 | 40 | $action['priority'], |
| 41 | 41 | $action['args'] |
| 42 | 42 | ); |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - foreach ( $this->filters as $filter ) { |
|
| 45 | + foreach ($this->filters as $filter) { |
|
| 46 | 46 | add_filter( |
| 47 | 47 | $filter['hook'], |
| 48 | - array( $filter['service'], $filter['method'] ), |
|
| 48 | + array($filter['service'], $filter['method']), |
|
| 49 | 49 | $filter['priority'], |
| 50 | 50 | $filter['args'] |
| 51 | 51 | ); |
@@ -57,15 +57,15 @@ discard block |
||
| 57 | 57 | * |
| 58 | 58 | * @param HasActions $service |
| 59 | 59 | */ |
| 60 | - public function register_actions( HasActions $service ) { |
|
| 61 | - foreach ( $service->action_hooks() as $action ) { |
|
| 60 | + public function register_actions(HasActions $service) { |
|
| 61 | + foreach ($service->action_hooks() as $action) { |
|
| 62 | 62 | $this->actions = $this->add( |
| 63 | 63 | $this->actions, |
| 64 | 64 | $action['hook'], |
| 65 | 65 | $service, |
| 66 | 66 | $action['method'], |
| 67 | - isset( $action['priority'] ) ? $action['priority'] : 10, |
|
| 68 | - isset( $action['args'] ) ? $action['args'] : 1 |
|
| 67 | + isset($action['priority']) ? $action['priority'] : 10, |
|
| 68 | + isset($action['args']) ? $action['args'] : 1 |
|
| 69 | 69 | ); |
| 70 | 70 | } |
| 71 | 71 | } |
@@ -75,15 +75,15 @@ discard block |
||
| 75 | 75 | * |
| 76 | 76 | * @param HasFilters $service |
| 77 | 77 | */ |
| 78 | - public function register_filters( HasFilters $service ) { |
|
| 79 | - foreach ( $service->filter_hooks() as $filter ) { |
|
| 78 | + public function register_filters(HasFilters $service) { |
|
| 79 | + foreach ($service->filter_hooks() as $filter) { |
|
| 80 | 80 | $this->filters = $this->add( |
| 81 | 81 | $this->filters, |
| 82 | 82 | $filter['hook'], |
| 83 | 83 | $service, |
| 84 | 84 | $filter['method'], |
| 85 | - isset( $filter['priority'] ) ? $filter['priority'] : 10, |
|
| 86 | - isset( $filter['args'] ) ? $filter['args'] : 1 |
|
| 85 | + isset($filter['priority']) ? $filter['priority'] : 10, |
|
| 86 | + isset($filter['args']) ? $filter['args'] : 1 |
|
| 87 | 87 | ); |
| 88 | 88 | } |
| 89 | 89 | } |
@@ -93,8 +93,8 @@ discard block |
||
| 93 | 93 | * |
| 94 | 94 | * @param HasShortcode $service |
| 95 | 95 | */ |
| 96 | - public function register_shortcode( HasShortcode $service ) { |
|
| 97 | - add_shortcode( $service->shortcode_name(), array( $service, 'do_shortcode' ) ); |
|
| 96 | + public function register_shortcode(HasShortcode $service) { |
|
| 97 | + add_shortcode($service->shortcode_name(), array($service, 'do_shortcode')); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | /** |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | * |
| 110 | 110 | * @return array |
| 111 | 111 | */ |
| 112 | - protected function add( $hooks, $hook, $service, $method, $priority, $accepted_args ) { |
|
| 112 | + protected function add($hooks, $hook, $service, $method, $priority, $accepted_args) { |
|
| 113 | 113 | $hooks[] = array( |
| 114 | 114 | 'hook' => $hook, |
| 115 | 115 | 'service' => $service, |
@@ -71,17 +71,17 @@ discard block |
||
| 71 | 71 | * |
| 72 | 72 | * @param ServiceProvider[]|string[] $providers |
| 73 | 73 | */ |
| 74 | - public function __construct( array $providers = array() ) { |
|
| 74 | + public function __construct(array $providers = array()) { |
|
| 75 | 75 | // array_unique ensures we only register each provider once. |
| 76 | - $providers = array_unique( array_merge( $this->providers, $providers ) ); |
|
| 76 | + $providers = array_unique(array_merge($this->providers, $providers)); |
|
| 77 | 77 | |
| 78 | - foreach ( $providers as $provider ) { |
|
| 79 | - if ( is_string( $provider ) && class_exists( $provider ) ) { |
|
| 78 | + foreach ($providers as $provider) { |
|
| 79 | + if (is_string($provider) && class_exists($provider)) { |
|
| 80 | 80 | $provider = new $provider; |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - if ( $provider instanceof ServiceProvider ) { |
|
| 84 | - $this->register( $provider ); |
|
| 83 | + if ($provider instanceof ServiceProvider) { |
|
| 84 | + $this->register($provider); |
|
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | } |
@@ -97,27 +97,27 @@ discard block |
||
| 97 | 97 | * |
| 98 | 98 | * @return $this |
| 99 | 99 | */ |
| 100 | - public function define( $alias, $definition ) { |
|
| 101 | - if ( is_array( $alias ) ) { |
|
| 102 | - $class = current( $alias ); |
|
| 103 | - $alias = key( $alias ); |
|
| 100 | + public function define($alias, $definition) { |
|
| 101 | + if (is_array($alias)) { |
|
| 102 | + $class = current($alias); |
|
| 103 | + $alias = key($alias); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - if ( isset( $this->aliases[ $alias ] ) ) { |
|
| 107 | - throw new DefinedAliasException( $alias ); |
|
| 106 | + if (isset($this->aliases[$alias])) { |
|
| 107 | + throw new DefinedAliasException($alias); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - $this->aliases[ $alias ] = true; |
|
| 111 | - $this->definitions[ $alias ] = $definition; |
|
| 110 | + $this->aliases[$alias] = true; |
|
| 111 | + $this->definitions[$alias] = $definition; |
|
| 112 | 112 | |
| 113 | 113 | // Closures are treated as factories unless |
| 114 | 114 | // defined via Container::share. |
| 115 | - if ( ! $definition instanceof \Closure ) { |
|
| 116 | - $this->shared[ $alias ] = true; |
|
| 115 | + if (!$definition instanceof \Closure) { |
|
| 116 | + $this->shared[$alias] = true; |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - if ( isset( $class ) ) { |
|
| 120 | - $this->classes[ $class ] = $alias; |
|
| 119 | + if (isset($class)) { |
|
| 120 | + $this->classes[$class] = $alias; |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | return $this; |
@@ -133,14 +133,14 @@ discard block |
||
| 133 | 133 | * |
| 134 | 134 | * @return $this |
| 135 | 135 | */ |
| 136 | - public function share( $alias, $definition ) { |
|
| 137 | - $this->define( $alias, $definition ); |
|
| 136 | + public function share($alias, $definition) { |
|
| 137 | + $this->define($alias, $definition); |
|
| 138 | 138 | |
| 139 | - if ( is_array( $alias ) ) { |
|
| 140 | - $alias = key( $alias ); |
|
| 139 | + if (is_array($alias)) { |
|
| 140 | + $alias = key($alias); |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - $this->shared[ $alias ] = true; |
|
| 143 | + $this->shared[$alias] = true; |
|
| 144 | 144 | |
| 145 | 145 | return $this; |
| 146 | 146 | } |
@@ -154,32 +154,32 @@ discard block |
||
| 154 | 154 | * |
| 155 | 155 | * @return mixed |
| 156 | 156 | */ |
| 157 | - public function fetch( $alias ) { |
|
| 158 | - if ( isset( $this->classes[ $alias ] ) ) { |
|
| 157 | + public function fetch($alias) { |
|
| 158 | + if (isset($this->classes[$alias])) { |
|
| 159 | 159 | // If the alias is a class name, |
| 160 | 160 | // then retrieve its linked alias. |
| 161 | 161 | // This is only registered when |
| 162 | 162 | // registering using an array. |
| 163 | - $alias = $this->classes[ $alias ]; |
|
| 163 | + $alias = $this->classes[$alias]; |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - if ( ! isset( $this->aliases[ $alias ] ) ) { |
|
| 167 | - throw new UndefinedAliasException( $alias ); |
|
| 166 | + if (!isset($this->aliases[$alias])) { |
|
| 167 | + throw new UndefinedAliasException($alias); |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | - $value = $this->definitions[ $alias ]; |
|
| 170 | + $value = $this->definitions[$alias]; |
|
| 171 | 171 | |
| 172 | 172 | // If the shared value is a closure, |
| 173 | 173 | // execute it and assign the result |
| 174 | 174 | // in place of the closure. |
| 175 | - if ( $value instanceof \Closure ) { |
|
| 175 | + if ($value instanceof \Closure) { |
|
| 176 | 176 | $factory = $value; |
| 177 | - $value = $factory( $this ); |
|
| 177 | + $value = $factory($this); |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | // If the value is shared, save the shared value. |
| 181 | - if ( isset( $this->shared[ $alias ] ) ) { |
|
| 182 | - $this->definitions[ $alias ] = $value; |
|
| 181 | + if (isset($this->shared[$alias])) { |
|
| 182 | + $this->definitions[$alias] = $value; |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | // Return the fetched value. |
@@ -193,8 +193,8 @@ discard block |
||
| 193 | 193 | * |
| 194 | 194 | * @return bool |
| 195 | 195 | */ |
| 196 | - public function has( $alias ) { |
|
| 197 | - return isset( $this->aliases[ $alias ] ); |
|
| 196 | + public function has($alias) { |
|
| 197 | + return isset($this->aliases[$alias]); |
|
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | /** |
@@ -204,8 +204,8 @@ discard block |
||
| 204 | 204 | * |
| 205 | 205 | * @return $this |
| 206 | 206 | */ |
| 207 | - public function remove( $alias ) { |
|
| 208 | - if ( isset( $this->aliases[ $alias ] ) ) { |
|
| 207 | + public function remove($alias) { |
|
| 208 | + if (isset($this->aliases[$alias])) { |
|
| 209 | 209 | /** |
| 210 | 210 | * If there's no reference in the aliases array, |
| 211 | 211 | * the service won't be found on fetching and |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | * |
| 221 | 221 | * If this is a problem, this may need to be revisited. |
| 222 | 222 | */ |
| 223 | - unset( $this->aliases[ $alias ] ); |
|
| 223 | + unset($this->aliases[$alias]); |
|
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | return $this; |
@@ -233,9 +233,9 @@ discard block |
||
| 233 | 233 | * |
| 234 | 234 | * @return $this |
| 235 | 235 | */ |
| 236 | - public function register( ServiceProvider $provider ) { |
|
| 236 | + public function register(ServiceProvider $provider) { |
|
| 237 | 237 | // @todo make sure provider is only registered once |
| 238 | - $provider->register( $this ); |
|
| 238 | + $provider->register($this); |
|
| 239 | 239 | |
| 240 | 240 | return $this; |
| 241 | 241 | } |
@@ -248,8 +248,8 @@ discard block |
||
| 248 | 248 | * |
| 249 | 249 | * @see define |
| 250 | 250 | */ |
| 251 | - public function offsetSet( $id, $value ) { |
|
| 252 | - $this->define( $id, $value ); |
|
| 251 | + public function offsetSet($id, $value) { |
|
| 252 | + $this->define($id, $value); |
|
| 253 | 253 | } |
| 254 | 254 | |
| 255 | 255 | /** |
@@ -262,8 +262,8 @@ discard block |
||
| 262 | 262 | * |
| 263 | 263 | * @see fetch |
| 264 | 264 | */ |
| 265 | - public function offsetGet( $id ) { |
|
| 266 | - return $this->fetch( $id ); |
|
| 265 | + public function offsetGet($id) { |
|
| 266 | + return $this->fetch($id); |
|
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | /** |
@@ -275,8 +275,8 @@ discard block |
||
| 275 | 275 | * |
| 276 | 276 | * @see has |
| 277 | 277 | */ |
| 278 | - public function offsetExists( $id ) { |
|
| 279 | - return $this->has( $id ); |
|
| 278 | + public function offsetExists($id) { |
|
| 279 | + return $this->has($id); |
|
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | /** |
@@ -286,8 +286,8 @@ discard block |
||
| 286 | 286 | * |
| 287 | 287 | * @see remove |
| 288 | 288 | */ |
| 289 | - public function offsetUnset( $id ) { |
|
| 290 | - $this->remove( $id ); |
|
| 289 | + public function offsetUnset($id) { |
|
| 290 | + $this->remove($id); |
|
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | /** |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | */ |
| 296 | 296 | public function rewind() { |
| 297 | 297 | $this->position = 0; |
| 298 | - $this->keys = array_keys( $this->aliases ); |
|
| 298 | + $this->keys = array_keys($this->aliases); |
|
| 299 | 299 | } |
| 300 | 300 | |
| 301 | 301 | /** |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | * @return object |
| 305 | 305 | */ |
| 306 | 306 | public function current() { |
| 307 | - return $this->fetch( $this->keys[ $this->position ] ); |
|
| 307 | + return $this->fetch($this->keys[$this->position]); |
|
| 308 | 308 | } |
| 309 | 309 | |
| 310 | 310 | /** |
@@ -313,14 +313,14 @@ discard block |
||
| 313 | 313 | * @return string |
| 314 | 314 | */ |
| 315 | 315 | public function key() { |
| 316 | - return $this->keys[ $this->position ]; |
|
| 316 | + return $this->keys[$this->position]; |
|
| 317 | 317 | } |
| 318 | 318 | |
| 319 | 319 | /** |
| 320 | 320 | * Increments to the next step in the loop. |
| 321 | 321 | */ |
| 322 | 322 | public function next() { |
| 323 | - $this->position ++; |
|
| 323 | + $this->position++; |
|
| 324 | 324 | } |
| 325 | 325 | |
| 326 | 326 | /** |
@@ -329,6 +329,6 @@ discard block |
||
| 329 | 329 | * @return bool |
| 330 | 330 | */ |
| 331 | 331 | public function valid() { |
| 332 | - return isset( $this->keys[ $this->position ] ); |
|
| 332 | + return isset($this->keys[$this->position]); |
|
| 333 | 333 | } |
| 334 | 334 | } |
@@ -36,21 +36,21 @@ discard block |
||
| 36 | 36 | * |
| 37 | 37 | * @throws ApplicationAlreadyBootedException |
| 38 | 38 | */ |
| 39 | - public function __construct( $file, array $providers = array() ) { |
|
| 40 | - if ( null !== static::$instance ) { |
|
| 39 | + public function __construct($file, array $providers = array()) { |
|
| 40 | + if (null !== static::$instance) { |
|
| 41 | 41 | throw new ApplicationAlreadyBootedException; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | static::$instance = $this; |
| 45 | 45 | |
| 46 | - $this->register_constants( $file ); |
|
| 46 | + $this->register_constants($file); |
|
| 47 | 47 | $this->register_core_services(); |
| 48 | 48 | $this->load_i18n(); |
| 49 | 49 | |
| 50 | - register_activation_hook( $file, array( $this, 'activate' ) ); |
|
| 51 | - register_deactivation_hook( $file, array( $this, 'deactivate' ) ); |
|
| 50 | + register_activation_hook($file, array($this, 'activate')); |
|
| 51 | + register_deactivation_hook($file, array($this, 'deactivate')); |
|
| 52 | 52 | |
| 53 | - parent::__construct( $providers ); |
|
| 53 | + parent::__construct($providers); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | /** |
@@ -59,27 +59,27 @@ discard block |
||
| 59 | 59 | * @throws UnexpectedValueException |
| 60 | 60 | */ |
| 61 | 61 | public function boot() { |
| 62 | - $loader = $this->fetch( 'loader' ); |
|
| 62 | + $loader = $this->fetch('loader'); |
|
| 63 | 63 | |
| 64 | - if ( ! $loader instanceof LoaderContract ) { |
|
| 64 | + if (!$loader instanceof LoaderContract) { |
|
| 65 | 65 | throw new UnexpectedValueException; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - foreach ( $this as $alias => $value ) { |
|
| 69 | - if ( $value instanceof HasActions ) { |
|
| 70 | - $loader->register_actions( $value ); |
|
| 68 | + foreach ($this as $alias => $value) { |
|
| 69 | + if ($value instanceof HasActions) { |
|
| 70 | + $loader->register_actions($value); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - if ( $value instanceof HasFilters ) { |
|
| 74 | - $loader->register_filters( $value ); |
|
| 73 | + if ($value instanceof HasFilters) { |
|
| 74 | + $loader->register_filters($value); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - if ( $value instanceof HasShortcode ) { |
|
| 78 | - $loader->register_shortcode( $value ); |
|
| 77 | + if ($value instanceof HasShortcode) { |
|
| 78 | + $loader->register_shortcode($value); |
|
| 79 | 79 | } |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - add_action( 'plugins_loaded', array( $loader, 'run' ) ); |
|
| 82 | + add_action('plugins_loaded', array($loader, 'run')); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | /** |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | * @throws ApplicationNotBootedException |
| 108 | 108 | */ |
| 109 | 109 | public static function instance() { |
| 110 | - if ( null === static::$instance ) { |
|
| 110 | + if (null === static::$instance) { |
|
| 111 | 111 | throw new ApplicationNotBootedException; |
| 112 | 112 | } |
| 113 | 113 | |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | * {@inheritDoc} |
| 119 | 119 | */ |
| 120 | 120 | public static function shutdown() { |
| 121 | - if ( null !== static::$instance ) { |
|
| 121 | + if (null !== static::$instance) { |
|
| 122 | 122 | static::$instance = null; |
| 123 | 123 | } |
| 124 | 124 | } |
@@ -128,20 +128,20 @@ discard block |
||
| 128 | 128 | * |
| 129 | 129 | * @param string $file |
| 130 | 130 | */ |
| 131 | - private function register_constants( $file ) { |
|
| 132 | - $this->share( 'url', plugin_dir_url( $file ) ); |
|
| 133 | - $this->share( 'path', plugin_dir_path( $file ) ); |
|
| 134 | - $this->share( 'basename', $basename = plugin_basename( $file ) ); |
|
| 135 | - $this->share( 'slug', dirname( $basename ) ); |
|
| 136 | - $this->share( 'version', static::VERSION ); |
|
| 131 | + private function register_constants($file) { |
|
| 132 | + $this->share('url', plugin_dir_url($file)); |
|
| 133 | + $this->share('path', plugin_dir_path($file)); |
|
| 134 | + $this->share('basename', $basename = plugin_basename($file)); |
|
| 135 | + $this->share('slug', dirname($basename)); |
|
| 136 | + $this->share('version', static::VERSION); |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | /** |
| 140 | 140 | * Registers the built-in services with the Application container. |
| 141 | 141 | */ |
| 142 | 142 | private function register_core_services() { |
| 143 | - $this->share( array( 'loader' => 'Intraxia\Jaxion\Contract\Core\Loader' ), function ( $app ) { |
|
| 144 | - return new Loader( $app ); |
|
| 143 | + $this->share(array('loader' => 'Intraxia\Jaxion\Contract\Core\Loader'), function($app) { |
|
| 144 | + return new Loader($app); |
|
| 145 | 145 | } ); |
| 146 | 146 | } |
| 147 | 147 | |
@@ -150,9 +150,9 @@ discard block |
||
| 150 | 150 | */ |
| 151 | 151 | private function load_i18n() { |
| 152 | 152 | load_plugin_textdomain( |
| 153 | - $this->fetch( 'basename' ), |
|
| 153 | + $this->fetch('basename'), |
|
| 154 | 154 | false, |
| 155 | - basename( $this->fetch( 'path' ) ) . '/languages/' |
|
| 155 | + basename($this->fetch('path')) . '/languages/' |
|
| 156 | 156 | ); |
| 157 | 157 | } |
| 158 | 158 | } |
@@ -39,9 +39,9 @@ discard block |
||
| 39 | 39 | * |
| 40 | 40 | * @return bool |
| 41 | 41 | */ |
| 42 | - protected static function get_found( $class, $id ) { |
|
| 43 | - if ( isset( self::$found[ $class ][ $id ] ) ) { |
|
| 44 | - return self::$found[ $class ][ $id ]; |
|
| 42 | + protected static function get_found($class, $id) { |
|
| 43 | + if (isset(self::$found[$class][$id])) { |
|
| 44 | + return self::$found[$class][$id]; |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | return false; |
@@ -88,15 +88,15 @@ discard block |
||
| 88 | 88 | * @param EntityManager $database |
| 89 | 89 | * @param string $class |
| 90 | 90 | */ |
| 91 | - public function __construct( EntityManager $database, $class ) { |
|
| 91 | + public function __construct(EntityManager $database, $class) { |
|
| 92 | 92 | $this->database = $database; |
| 93 | 93 | $this->class = $class; |
| 94 | 94 | $this->prefix = $database->get_prefix(); |
| 95 | 95 | $this->main = $database->get_main_query(); |
| 96 | 96 | $this->wpdb = $database->get_wpdb(); |
| 97 | 97 | |
| 98 | - if ( ! isset( self::$found[ $class ] ) ) { |
|
| 99 | - self::$found[ $class ] = array(); |
|
| 98 | + if (!isset(self::$found[$class])) { |
|
| 99 | + self::$found[$class] = array(); |
|
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | 102 | |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | * |
| 108 | 108 | * @return Model|WP_Error |
| 109 | 109 | */ |
| 110 | - abstract public function find( $id ); |
|
| 110 | + abstract public function find($id); |
|
| 111 | 111 | |
| 112 | 112 | /** |
| 113 | 113 | * Finds all the models of the repository class for the given params. |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | * |
| 117 | 117 | * @return Collection|WP_Error |
| 118 | 118 | */ |
| 119 | - abstract public function find_by( array $params = array() ); |
|
| 119 | + abstract public function find_by(array $params = array()); |
|
| 120 | 120 | |
| 121 | 121 | /** |
| 122 | 122 | * Create and saves a new model of the repository class |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | * |
| 127 | 127 | * @return Model|WP_Error |
| 128 | 128 | */ |
| 129 | - abstract public function create( array $data = array() ); |
|
| 129 | + abstract public function create(array $data = array()); |
|
| 130 | 130 | |
| 131 | 131 | /** |
| 132 | 132 | * Updates a model with its latest data. |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | * |
| 136 | 136 | * @return Model|WP_Error |
| 137 | 137 | */ |
| 138 | - abstract public function persist( Model $model ); |
|
| 138 | + abstract public function persist(Model $model); |
|
| 139 | 139 | |
| 140 | 140 | /** |
| 141 | 141 | * Delete the provided Model. |
@@ -145,15 +145,15 @@ discard block |
||
| 145 | 145 | * |
| 146 | 146 | * @return Model|WP_Error |
| 147 | 147 | */ |
| 148 | - abstract public function delete( Model $model, $force = false ); |
|
| 148 | + abstract public function delete(Model $model, $force = false); |
|
| 149 | 149 | |
| 150 | 150 | /** |
| 151 | 151 | * Registers the found Model with the EntityManager. |
| 152 | 152 | * |
| 153 | 153 | * @param Model $model |
| 154 | 154 | */ |
| 155 | - public function register_model( Model $model ) { |
|
| 156 | - self::$found[ $this->class ][ $model->get_primary_id() ] = $model; |
|
| 155 | + public function register_model(Model $model) { |
|
| 156 | + self::$found[$this->class][$model->get_primary_id()] = $model; |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | /** |
@@ -161,21 +161,21 @@ discard block |
||
| 161 | 161 | * |
| 162 | 162 | * @param Model|UsesCustomTable $model |
| 163 | 163 | */ |
| 164 | - protected function fill_table_attrs_from_table( Model $model ) { |
|
| 165 | - $sql[] = "SELECT * FROM {$this->make_table_name( $model )}"; |
|
| 164 | + protected function fill_table_attrs_from_table(Model $model) { |
|
| 165 | + $sql[] = "SELECT * FROM {$this->make_table_name($model)}"; |
|
| 166 | 166 | $sql[] = "WHERE {$model->get_foreign_key()} = %d"; |
| 167 | 167 | |
| 168 | 168 | $sql = $this->wpdb->prepare( |
| 169 | - implode( ' ', $sql ), |
|
| 169 | + implode(' ', $sql), |
|
| 170 | 170 | $model->get_primary_id() |
| 171 | 171 | ); |
| 172 | 172 | |
| 173 | - $row = $this->wpdb->get_row( $sql, ARRAY_A ); |
|
| 173 | + $row = $this->wpdb->get_row($sql, ARRAY_A); |
|
| 174 | 174 | |
| 175 | 175 | $model->unguard(); |
| 176 | 176 | |
| 177 | - foreach ( $row as $key => $value ) { |
|
| 178 | - $model->set_attribute( $key, $value ); |
|
| 177 | + foreach ($row as $key => $value) { |
|
| 178 | + $model->set_attribute($key, $value); |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | $model->reguard(); |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | * |
| 189 | 189 | * @throws LogicException |
| 190 | 190 | */ |
| 191 | - protected function save_table_attributes_to_table( Model $model ) { |
|
| 191 | + protected function save_table_attributes_to_table(Model $model) { |
|
| 192 | 192 | throw new LogicException; |
| 193 | 193 | } |
| 194 | 194 | |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | * |
| 200 | 200 | * @throws LogicException |
| 201 | 201 | */ |
| 202 | - protected function delete_table_attributes_from_table( Model $model ) { |
|
| 202 | + protected function delete_table_attributes_from_table(Model $model) { |
|
| 203 | 203 | throw new LogicException; |
| 204 | 204 | } |
| 205 | 205 | |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | * |
| 211 | 211 | * @return string |
| 212 | 212 | */ |
| 213 | - protected function make_table_name( UsesCustomTable $model ) { |
|
| 213 | + protected function make_table_name(UsesCustomTable $model) { |
|
| 214 | 214 | return "{$this->wpdb->prefix}{$this->prefix}_{$model::get_table_name()}"; |
| 215 | 215 | } |
| 216 | 216 | } |
@@ -20,12 +20,12 @@ discard block |
||
| 20 | 20 | * |
| 21 | 21 | * @return WP_Term|false |
| 22 | 22 | */ |
| 23 | - protected function get_wp_object_by_id( $id ) { |
|
| 23 | + protected function get_wp_object_by_id($id) { |
|
| 24 | 24 | $class = $this->class; |
| 25 | 25 | |
| 26 | - $term = get_term( $id, $class::get_taxonomy() ); |
|
| 26 | + $term = get_term($id, $class::get_taxonomy()); |
|
| 27 | 27 | |
| 28 | - if ( is_wp_error( $term ) ) { |
|
| 28 | + if (is_wp_error($term)) { |
|
| 29 | 29 | return false; |
| 30 | 30 | } |
| 31 | 31 | |
@@ -39,10 +39,10 @@ discard block |
||
| 39 | 39 | * |
| 40 | 40 | * @return WP_Term[] |
| 41 | 41 | */ |
| 42 | - protected function get_wp_objects_by_params( $params ) { |
|
| 42 | + protected function get_wp_objects_by_params($params) { |
|
| 43 | 43 | $class = $this->class; |
| 44 | 44 | |
| 45 | - return get_terms( $class::get_taxonomy(), $params ); |
|
| 45 | + return get_terms($class::get_taxonomy(), $params); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /** |
@@ -50,16 +50,16 @@ discard block |
||
| 50 | 50 | * |
| 51 | 51 | * @param Model $model |
| 52 | 52 | */ |
| 53 | - protected function fill_table_attrs_from_meta( Model $model ) { |
|
| 53 | + protected function fill_table_attrs_from_meta(Model $model) { |
|
| 54 | 54 | $model->unguard(); |
| 55 | 55 | |
| 56 | - if ( $model instanceof UsesWordPressTerm ) { |
|
| 57 | - foreach ( $model->get_table_keys() as $key ) { |
|
| 56 | + if ($model instanceof UsesWordPressTerm) { |
|
| 57 | + foreach ($model->get_table_keys() as $key) { |
|
| 58 | 58 | $model->set_attribute( |
| 59 | 59 | $key, |
| 60 | 60 | get_term_meta( |
| 61 | 61 | $model->get_primary_id(), |
| 62 | - $this->make_meta_key( $key ), |
|
| 62 | + $this->make_meta_key($key), |
|
| 63 | 63 | true |
| 64 | 64 | ) |
| 65 | 65 | ); |
@@ -76,12 +76,12 @@ discard block |
||
| 76 | 76 | * |
| 77 | 77 | * @return int|WP_Error |
| 78 | 78 | */ |
| 79 | - protected function save_wp_object( Model $model ) { |
|
| 79 | + protected function save_wp_object(Model $model) { |
|
| 80 | 80 | $class = $this->class; |
| 81 | 81 | $object = $model->get_underlying_wp_object(); |
| 82 | 82 | |
| 83 | 83 | $term_id = $object->term_id; |
| 84 | - unset( $object->term_id ); |
|
| 84 | + unset($object->term_id); |
|
| 85 | 85 | |
| 86 | 86 | $result = wp_update_term( |
| 87 | 87 | $term_id, |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | (array) $object |
| 90 | 90 | ); |
| 91 | 91 | |
| 92 | - if ( is_wp_error( $result ) ) { |
|
| 92 | + if (is_wp_error($result)) { |
|
| 93 | 93 | return $result; |
| 94 | 94 | } |
| 95 | 95 | |
@@ -101,11 +101,11 @@ discard block |
||
| 101 | 101 | * |
| 102 | 102 | * @param Model $model |
| 103 | 103 | */ |
| 104 | - protected function save_table_attributes_to_meta( Model $model ) { |
|
| 105 | - foreach ( $model->get_changed_table_attributes() as $attribute => $value ) { |
|
| 104 | + protected function save_table_attributes_to_meta(Model $model) { |
|
| 105 | + foreach ($model->get_changed_table_attributes() as $attribute => $value) { |
|
| 106 | 106 | update_term_meta( |
| 107 | 107 | $model->get_primary_id(), |
| 108 | - $this->make_meta_key( $attribute ), |
|
| 108 | + $this->make_meta_key($attribute), |
|
| 109 | 109 | $value |
| 110 | 110 | ); |
| 111 | 111 | } |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | * @param Model $model |
| 118 | 118 | * @param bool $force |
| 119 | 119 | */ |
| 120 | - protected function delete_wp_object( Model $model, $force = false ) { |
|
| 120 | + protected function delete_wp_object(Model $model, $force = false) { |
|
| 121 | 121 | $class = $this->class; |
| 122 | 122 | |
| 123 | 123 | wp_delete_term( |
@@ -131,11 +131,11 @@ discard block |
||
| 131 | 131 | * |
| 132 | 132 | * @param Model $model |
| 133 | 133 | */ |
| 134 | - protected function delete_table_attributes_from_meta( Model $model ) { |
|
| 135 | - foreach ( $model->get_table_attributes() as $attribute ) { |
|
| 134 | + protected function delete_table_attributes_from_meta(Model $model) { |
|
| 135 | + foreach ($model->get_table_attributes() as $attribute) { |
|
| 136 | 136 | delete_term_meta( |
| 137 | 137 | $model->get_primary_id(), |
| 138 | - $this->make_meta_key( $attribute ) |
|
| 138 | + $this->make_meta_key($attribute) |
|
| 139 | 139 | ); |
| 140 | 140 | } |
| 141 | 141 | } |
@@ -24,14 +24,14 @@ discard block |
||
| 24 | 24 | * |
| 25 | 25 | * @return WP_Post|false |
| 26 | 26 | */ |
| 27 | - protected function get_wp_object_by_id( $id ) { |
|
| 28 | - $args = array_merge( $this->get_wp_query_args(), array( |
|
| 27 | + protected function get_wp_object_by_id($id) { |
|
| 28 | + $args = array_merge($this->get_wp_query_args(), array( |
|
| 29 | 29 | 'p' => (int) $id, |
| 30 | - ) ); |
|
| 30 | + )); |
|
| 31 | 31 | |
| 32 | - $object = $this->main->query( $args ); |
|
| 32 | + $object = $this->main->query($args); |
|
| 33 | 33 | |
| 34 | - if ( ! $object ) { |
|
| 34 | + if (!$object) { |
|
| 35 | 35 | return false; |
| 36 | 36 | } |
| 37 | 37 | |
@@ -45,13 +45,13 @@ discard block |
||
| 45 | 45 | * |
| 46 | 46 | * @return WP_Post[] |
| 47 | 47 | */ |
| 48 | - protected function get_wp_objects_by_params( $params ) { |
|
| 48 | + protected function get_wp_objects_by_params($params) { |
|
| 49 | 49 | $args = array_merge( |
| 50 | 50 | $this->get_wp_query_args(), |
| 51 | 51 | $params |
| 52 | 52 | ); |
| 53 | 53 | |
| 54 | - return $this->main->query( $args ); |
|
| 54 | + return $this->main->query($args); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
@@ -59,16 +59,16 @@ discard block |
||
| 59 | 59 | * |
| 60 | 60 | * @param Model $model |
| 61 | 61 | */ |
| 62 | - protected function fill_table_attrs_from_meta( Model $model ) { |
|
| 62 | + protected function fill_table_attrs_from_meta(Model $model) { |
|
| 63 | 63 | $model->unguard(); |
| 64 | 64 | |
| 65 | - if ( $model instanceof UsesWordPressPost ) { |
|
| 66 | - foreach ( $model->get_table_keys() as $key ) { |
|
| 65 | + if ($model instanceof UsesWordPressPost) { |
|
| 66 | + foreach ($model->get_table_keys() as $key) { |
|
| 67 | 67 | $model->set_attribute( |
| 68 | 68 | $key, |
| 69 | 69 | get_post_meta( |
| 70 | 70 | $model->get_primary_id(), |
| 71 | - $this->make_meta_key( $key ), |
|
| 71 | + $this->make_meta_key($key), |
|
| 72 | 72 | true |
| 73 | 73 | ) |
| 74 | 74 | ); |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | */ |
| 98 | 98 | $model = new $this->class; |
| 99 | 99 | |
| 100 | - foreach ( $model->get_related_keys() as $related_key ) { |
|
| 100 | + foreach ($model->get_related_keys() as $related_key) { |
|
| 101 | 101 | /** |
| 102 | 102 | * Relation object. |
| 103 | 103 | * |
@@ -105,18 +105,18 @@ discard block |
||
| 105 | 105 | */ |
| 106 | 106 | $relation = $model->{"related_{$related_key}"}(); |
| 107 | 107 | |
| 108 | - if ( $relation instanceof HasMany && |
|
| 108 | + if ($relation instanceof HasMany && |
|
| 109 | 109 | $relation->get_relationship_type() === 'post_post' && |
| 110 | 110 | $relation->get_foreign_key() === 'post_parent' |
| 111 | 111 | ) { |
| 112 | 112 | $args['post_parent'] = 0; |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - if ( $relation instanceof BelongsToOne && |
|
| 115 | + if ($relation instanceof BelongsToOne && |
|
| 116 | 116 | $relation->get_relationship_type() === 'post_post' && |
| 117 | 117 | $relation->get_local_key() === 'post_parent' |
| 118 | 118 | ) { |
| 119 | - $args['post_parent__not_in'] = array( 0 ); |
|
| 119 | + $args['post_parent__not_in'] = array(0); |
|
| 120 | 120 | } |
| 121 | 121 | } |
| 122 | 122 | |
@@ -130,12 +130,11 @@ discard block |
||
| 130 | 130 | * |
| 131 | 131 | * @return int|WP_Error |
| 132 | 132 | */ |
| 133 | - protected function save_wp_object( Model $model ) { |
|
| 133 | + protected function save_wp_object(Model $model) { |
|
| 134 | 134 | $object = $model->get_underlying_wp_object(); |
| 135 | 135 | |
| 136 | - return isset( $object->ID ) ? |
|
| 137 | - wp_update_post( $object, true ) : |
|
| 138 | - wp_insert_post( $object->to_array(), true ); |
|
| 136 | + return isset($object->ID) ? |
|
| 137 | + wp_update_post($object, true) : wp_insert_post($object->to_array(), true); |
|
| 139 | 138 | } |
| 140 | 139 | |
| 141 | 140 | /** |
@@ -143,11 +142,11 @@ discard block |
||
| 143 | 142 | * |
| 144 | 143 | * @param Model $model |
| 145 | 144 | */ |
| 146 | - protected function save_table_attributes_to_meta( Model $model ) { |
|
| 147 | - foreach ( $model->get_changed_table_attributes() as $attribute => $value ) { |
|
| 145 | + protected function save_table_attributes_to_meta(Model $model) { |
|
| 146 | + foreach ($model->get_changed_table_attributes() as $attribute => $value) { |
|
| 148 | 147 | update_post_meta( |
| 149 | 148 | $model->get_primary_id(), |
| 150 | - $this->make_meta_key( $attribute ), |
|
| 149 | + $this->make_meta_key($attribute), |
|
| 151 | 150 | $value |
| 152 | 151 | ); |
| 153 | 152 | } |
@@ -159,7 +158,7 @@ discard block |
||
| 159 | 158 | * @param Model $model |
| 160 | 159 | * @param bool $force |
| 161 | 160 | */ |
| 162 | - protected function delete_wp_object( Model $model, $force = false ) { |
|
| 161 | + protected function delete_wp_object(Model $model, $force = false) { |
|
| 163 | 162 | wp_delete_post( |
| 164 | 163 | $model->get_primary_id(), |
| 165 | 164 | $force |
@@ -171,8 +170,8 @@ discard block |
||
| 171 | 170 | * |
| 172 | 171 | * @param Model $model |
| 173 | 172 | */ |
| 174 | - protected function delete_table_attributes_from_meta( Model $model ) { |
|
| 175 | - foreach ( $model->get_table_keys() as $key ) { |
|
| 173 | + protected function delete_table_attributes_from_meta(Model $model) { |
|
| 174 | + foreach ($model->get_table_keys() as $key) { |
|
| 176 | 175 | delete_post_meta( |
| 177 | 176 | $model->get_primary_id(), |
| 178 | 177 | $key |