@@ -49,7 +49,7 @@ |
||
| 49 | 49 | * Adapted from Str::snake() |
| 50 | 50 | * @link https://github.com/laravel/framework/blob/5.2/src/Illuminate/Support/Str.php |
| 51 | 51 | */ |
| 52 | - if (! ctype_lower($name)) { |
|
| 52 | + if (!ctype_lower($name)) { |
|
| 53 | 53 | $name = strtolower(preg_replace('/(.)(?=[A-Z])/u', '$1_', $name)); |
| 54 | 54 | } |
| 55 | 55 | |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | public function supports($features) |
| 45 | 45 | { |
| 46 | - if (! is_array($features)) { |
|
| 46 | + if (!is_array($features)) { |
|
| 47 | 47 | $features = func_get_args(); |
| 48 | 48 | } |
| 49 | 49 | |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | */ |
| 98 | 98 | public function register() |
| 99 | 99 | { |
| 100 | - if (! $this->id || strlen($this->id) > 20) { |
|
| 100 | + if (!$this->id || strlen($this->id) > 20) { |
|
| 101 | 101 | throw new InvalidPostTypeNameException('Post type names must be between 1 and 20 characters in length.'); |
| 102 | 102 | } |
| 103 | 103 | |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | */ |
| 21 | 21 | public function __construct($object) |
| 22 | 22 | { |
| 23 | - if (! is_object($object) || ! in_array(get_class($object), ['stdClass', 'WP_Post_Type'])) { |
|
| 23 | + if (!is_object($object) || !in_array(get_class($object), ['stdClass', 'WP_Post_Type'])) { |
|
| 24 | 24 | throw new \InvalidArgumentException(static::class . ' can only be constructed with a Post Type object.'); |
| 25 | 25 | } |
| 26 | 26 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | */ |
| 56 | 56 | public static function load($slug) |
| 57 | 57 | { |
| 58 | - if (! $object = get_post_type_object($slug)) { |
|
| 58 | + if (!$object = get_post_type_object($slug)) { |
|
| 59 | 59 | throw new NonExistentPostTypeException("No post type exists with name '$slug'."); |
| 60 | 60 | } |
| 61 | 61 | |
@@ -84,13 +84,13 @@ discard block |
||
| 84 | 84 | */ |
| 85 | 85 | public function supports($features) |
| 86 | 86 | { |
| 87 | - if (! is_array($features)) { |
|
| 87 | + if (!is_array($features)) { |
|
| 88 | 88 | $features = func_get_args(); |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - return ! Collection::make($features) |
|
| 92 | - ->contains(function ($key, $feature) { |
|
| 93 | - return ! post_type_supports($this->slug, $feature); |
|
| 91 | + return !Collection::make($features) |
|
| 92 | + ->contains(function($key, $feature) { |
|
| 93 | + return !post_type_supports($this->slug, $feature); |
|
| 94 | 94 | }); |
| 95 | 95 | } |
| 96 | 96 | |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | public function removeSupportFor($features) |
| 117 | 117 | { |
| 118 | 118 | Collection::make(is_array($features) ? $features : func_get_args()) |
| 119 | - ->each(function ($features) { |
|
| 119 | + ->each(function($features) { |
|
| 120 | 120 | remove_post_type_support($this->slug, $features); |
| 121 | 121 | }); |
| 122 | 122 | |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | */ |
| 131 | 131 | public function unregister() |
| 132 | 132 | { |
| 133 | - if (! static::exists($this->slug)) { |
|
| 133 | + if (!static::exists($this->slug)) { |
|
| 134 | 134 | throw new NonExistentPostTypeException("No post type exists with name '{$this->slug}'."); |
| 135 | 135 | } |
| 136 | 136 | |
@@ -44,10 +44,10 @@ |
||
| 44 | 44 | abstract public static function typeId(); |
| 45 | 45 | |
| 46 | 46 | /** |
| 47 | - * Get a new query builder for the model. |
|
| 48 | - * |
|
| 49 | - * @return \Silk\Contracts\BuildsQueries |
|
| 50 | - */ |
|
| 47 | + * Get a new query builder for the model. |
|
| 48 | + * |
|
| 49 | + * @return \Silk\Contracts\BuildsQueries |
|
| 50 | + */ |
|
| 51 | 51 | abstract public function newQuery(); |
| 52 | 52 | |
| 53 | 53 | /** |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | { |
| 29 | 29 | $attributes = is_array($user) ? $user : []; |
| 30 | 30 | |
| 31 | - if (! $user instanceof WP_User) { |
|
| 31 | + if (!$user instanceof WP_User) { |
|
| 32 | 32 | $user = new WP_User(); |
| 33 | 33 | } |
| 34 | 34 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | public static function fromID($id) |
| 50 | 50 | { |
| 51 | - if (! $user = get_user_by('id', $id)) { |
|
| 51 | + if (!$user = get_user_by('id', $id)) { |
|
| 52 | 52 | throw new UserNotFoundException("No user found with ID $id"); |
| 53 | 53 | } |
| 54 | 54 | |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | */ |
| 67 | 67 | public static function fromUsername($username) |
| 68 | 68 | { |
| 69 | - if (! $user = get_user_by('login', $username)) { |
|
| 69 | + if (!$user = get_user_by('login', $username)) { |
|
| 70 | 70 | throw new UserNotFoundException("No user found with username: $username"); |
| 71 | 71 | } |
| 72 | 72 | |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | */ |
| 85 | 85 | public static function fromEmail($email) |
| 86 | 86 | { |
| 87 | - if (! $user = get_user_by('email', $email)) { |
|
| 87 | + if (!$user = get_user_by('email', $email)) { |
|
| 88 | 88 | throw new UserNotFoundException("No user found with email address: $email"); |
| 89 | 89 | } |
| 90 | 90 | |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | */ |
| 103 | 103 | public static function fromSlug($slug) |
| 104 | 104 | { |
| 105 | - if (! $user = get_user_by('slug', $slug)) { |
|
| 105 | + if (!$user = get_user_by('slug', $slug)) { |
|
| 106 | 106 | throw new UserNotFoundException("No user found with slug: $slug"); |
| 107 | 107 | } |
| 108 | 108 | |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | */ |
| 149 | 149 | public function save() |
| 150 | 150 | { |
| 151 | - if (! $this->id) { |
|
| 151 | + if (!$this->id) { |
|
| 152 | 152 | $result = wp_insert_user($this->object); |
| 153 | 153 | } else { |
| 154 | 154 | $result = wp_update_user($this->object); |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | ]; |
| 232 | 232 | |
| 233 | 233 | foreach ($properties as $property) { |
| 234 | - if (! property_exists($user->data, $property)) { |
|
| 234 | + if (!property_exists($user->data, $property)) { |
|
| 235 | 235 | $user->data->$property = null; // exists but ! isset |
| 236 | 236 | } |
| 237 | 237 | } |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | { |
| 129 | 129 | $arguments = func_get_args(); |
| 130 | 130 | |
| 131 | - if (! $this->shouldInvoke($arguments)) { |
|
| 131 | + if (!$this->shouldInvoke($arguments)) { |
|
| 132 | 132 | return $given; |
| 133 | 133 | } |
| 134 | 134 | |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | * Check if any of the conditions returns false, |
| 157 | 157 | * if so, do not invoke. |
| 158 | 158 | */ |
| 159 | - return ! $this->conditions()->contains(function ($key, $callback) use ($arguments) { |
|
| 159 | + return !$this->conditions()->contains(function($key, $callback) use ($arguments) { |
|
| 160 | 160 | return false === $callback->callArray($arguments); |
| 161 | 161 | }); |
| 162 | 162 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | public function __construct(WP_Query $query = null) |
| 31 | 31 | { |
| 32 | - if (! $query) { |
|
| 32 | + if (!$query) { |
|
| 33 | 33 | $query = new WP_Query(); |
| 34 | 34 | } |
| 35 | 35 | |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | $modelClass = get_class($this->model); |
| 142 | 142 | |
| 143 | 143 | return Collection::make($this->query->get_posts()) |
| 144 | - ->map(function ($post) use ($modelClass) { |
|
| 144 | + ->map(function($post) use ($modelClass) { |
|
| 145 | 145 | return new $modelClass($post); |
| 146 | 146 | }); |
| 147 | 147 | } |
@@ -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 | |
@@ -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); |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | { |
| 54 | 54 | $attributes = is_array($term) ? $term : []; |
| 55 | 55 | |
| 56 | - if (! $term instanceof WP_Term) { |
|
| 56 | + if (!$term instanceof WP_Term) { |
|
| 57 | 57 | $term = new WP_Term(new stdClass); |
| 58 | 58 | $term->taxonomy = static::TAXONOMY; |
| 59 | 59 | } elseif ($term->taxonomy != static::TAXONOMY) { |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | public static function fromID($id) |
| 91 | 91 | { |
| 92 | - if (! $term = get_term_by('id', (int) $id, static::TAXONOMY)) { |
|
| 92 | + if (!$term = get_term_by('id', (int) $id, static::TAXONOMY)) { |
|
| 93 | 93 | throw new TermNotFoundException("No term found with ID $id."); |
| 94 | 94 | } |
| 95 | 95 | |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | */ |
| 108 | 108 | public static function fromSlug($slug) |
| 109 | 109 | { |
| 110 | - if (! $term = get_term_by('slug', $slug, static::TAXONOMY)) { |
|
| 110 | + if (!$term = get_term_by('slug', $slug, static::TAXONOMY)) { |
|
| 111 | 111 | throw new TermNotFoundException("No term found with slug '$slug'."); |
| 112 | 112 | } |
| 113 | 113 | |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | public function ancestors() |
| 164 | 164 | { |
| 165 | 165 | return Collection::make(get_ancestors($this->id, static::TAXONOMY, 'taxonomy')) |
| 166 | - ->map(function ($term_ID) { |
|
| 166 | + ->map(function($term_ID) { |
|
| 167 | 167 | return static::fromID($term_ID); |
| 168 | 168 | }); |
| 169 | 169 | } |