@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | { |
| 70 | 70 | $attributes = is_array($post) ? $post : []; |
| 71 | 71 | |
| 72 | - if (! $post instanceof WP_Post) { |
|
| 72 | + if (!$post instanceof WP_Post) { |
|
| 73 | 73 | $post = new WP_Post(new stdClass); |
| 74 | 74 | $post->post_type = static::postTypeId(); |
| 75 | 75 | } elseif ($post->post_type !== static::postTypeId()) { |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | */ |
| 142 | 142 | public static function fromGlobal() |
| 143 | 143 | { |
| 144 | - if (! $GLOBALS['post'] instanceof WP_Post) { |
|
| 144 | + if (!$GLOBALS['post'] instanceof WP_Post) { |
|
| 145 | 145 | throw new PostNotFoundException('Global $post not an instance of WP_Post'); |
| 146 | 146 | } |
| 147 | 147 | |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | */ |
| 229 | 229 | public function save() |
| 230 | 230 | { |
| 231 | - if (! $this->id) { |
|
| 231 | + if (!$this->id) { |
|
| 232 | 232 | $result = wp_insert_post($this->object->to_array(), true); |
| 233 | 233 | } else { |
| 234 | 234 | $result = wp_update_post($this->object, true); |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | { |
| 18 | 18 | $aliased = $this->getAliasedObject(); |
| 19 | 19 | |
| 20 | - if (is_object($aliased) || ! empty(static::OBJECT_TYPE)) { |
|
| 20 | + if (is_object($aliased) || !empty(static::OBJECT_TYPE)) { |
|
| 21 | 21 | /** |
| 22 | 22 | * Automatically alias shorthand syntax for type_name |
| 23 | 23 | * Eg: 'post_content' is aliased to 'content' |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | { |
| 30 | 30 | $attributes = is_array($user) ? $user : []; |
| 31 | 31 | |
| 32 | - if (! $user instanceof WP_User) { |
|
| 32 | + if (!$user instanceof WP_User) { |
|
| 33 | 33 | $user = new WP_User(); |
| 34 | 34 | } |
| 35 | 35 | |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | public static function fromID($id) |
| 51 | 51 | { |
| 52 | - if (! $user = get_user_by('id', $id)) { |
|
| 52 | + if (!$user = get_user_by('id', $id)) { |
|
| 53 | 53 | throw new UserNotFoundException("No user found with ID $id"); |
| 54 | 54 | } |
| 55 | 55 | |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | public static function fromUsername($username) |
| 69 | 69 | { |
| 70 | - if (! $user = get_user_by('login', $username)) { |
|
| 70 | + if (!$user = get_user_by('login', $username)) { |
|
| 71 | 71 | throw new UserNotFoundException("No user found with username: $username"); |
| 72 | 72 | } |
| 73 | 73 | |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | public static function fromEmail($email) |
| 87 | 87 | { |
| 88 | - if (! $user = get_user_by('email', $email)) { |
|
| 88 | + if (!$user = get_user_by('email', $email)) { |
|
| 89 | 89 | throw new UserNotFoundException("No user found with email address: $email"); |
| 90 | 90 | } |
| 91 | 91 | |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | */ |
| 104 | 104 | public static function fromSlug($slug) |
| 105 | 105 | { |
| 106 | - if (! $user = get_user_by('slug', $slug)) { |
|
| 106 | + if (!$user = get_user_by('slug', $slug)) { |
|
| 107 | 107 | throw new UserNotFoundException("No user found with slug: $slug"); |
| 108 | 108 | } |
| 109 | 109 | |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | */ |
| 150 | 150 | public function save() |
| 151 | 151 | { |
| 152 | - if (! $this->id) { |
|
| 152 | + if (!$this->id) { |
|
| 153 | 153 | $result = wp_insert_user($this->object); |
| 154 | 154 | } else { |
| 155 | 155 | $result = wp_update_user($this->object); |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | 'spam', |
| 231 | 231 | 'deleted', |
| 232 | 232 | ])->diff(array_keys((array) $user->data)) |
| 233 | - ->each(function ($property) use ($user) { |
|
| 233 | + ->each(function($property) use ($user) { |
|
| 234 | 234 | $user->data->$property = null; // exists but ! isset |
| 235 | 235 | }); |
| 236 | 236 | |
@@ -29,10 +29,10 @@ |
||
| 29 | 29 | const ID_PROPERTY = ''; |
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | - * Get a new query builder for the model. |
|
| 33 | - * |
|
| 34 | - * @return \Silk\Contracts\Query\BuildsQueries |
|
| 35 | - */ |
|
| 32 | + * Get a new query builder for the model. |
|
| 33 | + * |
|
| 34 | + * @return \Silk\Contracts\Query\BuildsQueries |
|
| 35 | + */ |
|
| 36 | 36 | abstract public function newQuery(); |
| 37 | 37 | |
| 38 | 38 | /** |
@@ -98,7 +98,7 @@ |
||
| 98 | 98 | { |
| 99 | 99 | if ($this->model) { |
| 100 | 100 | $this->set('taxonomy', $this->model->taxonomy) |
| 101 | - ->set('fields', 'all'); |
|
| 101 | + ->set('fields', 'all'); |
|
| 102 | 102 | } elseif ($this->taxonomy) { |
| 103 | 103 | $this->set('taxonomy', $this->taxonomy); |
| 104 | 104 | } |
@@ -123,7 +123,7 @@ |
||
| 123 | 123 | { |
| 124 | 124 | if ($this->model) { |
| 125 | 125 | $this->set('post_type', $this->model->post_type) |
| 126 | - ->set('fields', ''); // as WP_Post objects |
|
| 126 | + ->set('fields', ''); // as WP_Post objects |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | return $this->query->get_posts(); |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | */ |
| 22 | 22 | public function __construct(WP_User_Query $query = null) |
| 23 | 23 | { |
| 24 | - if (! $query) { |
|
| 24 | + if (!$query) { |
|
| 25 | 25 | $query = new WP_User_Query(); |
| 26 | 26 | } |
| 27 | 27 | |
@@ -54,9 +54,9 @@ |
||
| 54 | 54 | $modelClass = get_class($this->model); |
| 55 | 55 | |
| 56 | 56 | return Collection::make($this->query()) |
| 57 | - ->map(function ($result) use ($modelClass) { |
|
| 58 | - return new $modelClass($result); |
|
| 59 | - }); |
|
| 57 | + ->map(function ($result) use ($modelClass) { |
|
| 58 | + return new $modelClass($result); |
|
| 59 | + }); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | /** |
@@ -54,7 +54,7 @@ |
||
| 54 | 54 | $modelClass = get_class($this->model); |
| 55 | 55 | |
| 56 | 56 | return Collection::make($this->query()) |
| 57 | - ->map(function ($result) use ($modelClass) { |
|
| 57 | + ->map(function($result) use ($modelClass) { |
|
| 58 | 58 | return new $modelClass($result); |
| 59 | 59 | }); |
| 60 | 60 | } |
@@ -195,7 +195,7 @@ |
||
| 195 | 195 | /** |
| 196 | 196 | * Get a property from the aliased object by the model's key. |
| 197 | 197 | * |
| 198 | - * @param $key |
|
| 198 | + * @param string $key |
|
| 199 | 199 | * |
| 200 | 200 | * @return mixed|null |
| 201 | 201 | */ |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | */ |
| 30 | 30 | protected function aliasGet($key) |
| 31 | 31 | { |
| 32 | - if (! $expanded = $this->expandAlias($key)) { |
|
| 32 | + if (!$expanded = $this->expandAlias($key)) { |
|
| 33 | 33 | return null; |
| 34 | 34 | } |
| 35 | 35 | |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | */ |
| 59 | 59 | public function __get($property) |
| 60 | 60 | { |
| 61 | - if (! is_null($aliased = $this->aliasGet($property))) { |
|
| 61 | + if (!is_null($aliased = $this->aliasGet($property))) { |
|
| 62 | 62 | return $aliased; |
| 63 | 63 | } |
| 64 | 64 | |
@@ -74,6 +74,6 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | public function __isset($property) |
| 76 | 76 | { |
| 77 | - return ! is_null($this->__get($property)); |
|
| 77 | + return !is_null($this->__get($property)); |
|
| 78 | 78 | } |
| 79 | 79 | } |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | */ |
| 20 | 20 | public function __construct($object) |
| 21 | 21 | { |
| 22 | - if (! is_object($object) || ! in_array(get_class($object), ['stdClass', 'WP_Post_Type'])) { |
|
| 22 | + if (!is_object($object) || !in_array(get_class($object), ['stdClass', 'WP_Post_Type'])) { |
|
| 23 | 23 | throw new \InvalidArgumentException(static::class . ' can only be constructed with a Post Type object.'); |
| 24 | 24 | } |
| 25 | 25 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | public static function load($id) |
| 56 | 56 | { |
| 57 | - if (! $object = get_post_type_object($id)) { |
|
| 57 | + if (!$object = get_post_type_object($id)) { |
|
| 58 | 58 | throw new NonExistentPostTypeException("No post type exists with name '$id'."); |
| 59 | 59 | } |
| 60 | 60 | |
@@ -91,13 +91,13 @@ discard block |
||
| 91 | 91 | */ |
| 92 | 92 | public function supports($features) |
| 93 | 93 | { |
| 94 | - if (! is_array($features)) { |
|
| 94 | + if (!is_array($features)) { |
|
| 95 | 95 | $features = func_get_args(); |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - return ! Collection::make($features) |
|
| 99 | - ->contains(function ($key, $feature) { |
|
| 100 | - return ! post_type_supports($this->id(), $feature); |
|
| 98 | + return !Collection::make($features) |
|
| 99 | + ->contains(function($key, $feature) { |
|
| 100 | + return !post_type_supports($this->id(), $feature); |
|
| 101 | 101 | }); |
| 102 | 102 | } |
| 103 | 103 | |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | public function removeSupportFor($features) |
| 128 | 128 | { |
| 129 | 129 | Collection::make(is_array($features) ? $features : func_get_args()) |
| 130 | - ->each(function ($features) { |
|
| 130 | + ->each(function($features) { |
|
| 131 | 131 | remove_post_type_support($this->id(), $features); |
| 132 | 132 | }); |
| 133 | 133 | |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | { |
| 147 | 147 | $id = $this->id(); |
| 148 | 148 | |
| 149 | - if (! static::exists($id)) { |
|
| 149 | + if (!static::exists($id)) { |
|
| 150 | 150 | throw new NonExistentPostTypeException("No post type exists with name '{$id}'."); |
| 151 | 151 | } |
| 152 | 152 | |