@@ -81,7 +81,7 @@ |
||
| 81 | 81 | * @param string,...|array $features string - First feature of possible many, |
| 82 | 82 | * array - Many features to check support for. |
| 83 | 83 | * |
| 84 | - * @return mixed |
|
| 84 | + * @return boolean |
|
| 85 | 85 | */ |
| 86 | 86 | public function supports($features) |
| 87 | 87 | { |
@@ -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 | /** |
@@ -193,7 +193,7 @@ |
||
| 193 | 193 | */ |
| 194 | 194 | public function __isset($property) |
| 195 | 195 | { |
| 196 | - return ! is_null($this->__get($property)); |
|
| 196 | + return !is_null($this->__get($property)); |
|
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | /** |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | return $this->object->$property; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - if (! array_key_exists($property, $this->objectAliases)) { |
|
| 53 | + if (!array_key_exists($property, $this->objectAliases)) { |
|
| 54 | 54 | return null; |
| 55 | 55 | } |
| 56 | 56 | |
@@ -66,6 +66,6 @@ discard block |
||
| 66 | 66 | */ |
| 67 | 67 | public function __isset($property) |
| 68 | 68 | { |
| 69 | - return ! is_null($this->__get($property)); |
|
| 69 | + return !is_null($this->__get($property)); |
|
| 70 | 70 | } |
| 71 | 71 | } |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | public function __construct($taxonomy) |
| 46 | 46 | { |
| 47 | - if (empty($taxonomy->name) || ! static::exists($taxonomy->name)) { |
|
| 47 | + if (empty($taxonomy->name) || !static::exists($taxonomy->name)) { |
|
| 48 | 48 | throw new NonExistentTaxonomyException; |
| 49 | 49 | } |
| 50 | 50 | |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | return static::load($identifier); |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - if (! $identifier || strlen($identifier) > 32) { |
|
| 69 | + if (!$identifier || strlen($identifier) > 32) { |
|
| 70 | 70 | throw new InvalidTaxonomyNameException('Taxonomy names must be between 1 and 32 characters in length.'); |
| 71 | 71 | } |
| 72 | 72 | |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | */ |
| 85 | 85 | public static function load($identifier) |
| 86 | 86 | { |
| 87 | - if (! $object = get_taxonomy($identifier)) { |
|
| 87 | + if (!$object = get_taxonomy($identifier)) { |
|
| 88 | 88 | throw new NonExistentTaxonomyException("No taxonomy exists with name '$identifier'."); |
| 89 | 89 | } |
| 90 | 90 | |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | public function postTypes() |
| 122 | 122 | { |
| 123 | 123 | return Collection::make($this->object_type) |
| 124 | - ->map(function ($post_type) { |
|
| 124 | + ->map(function($post_type) { |
|
| 125 | 125 | return PostType::load($post_type); |
| 126 | 126 | }); |
| 127 | 127 | } |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | */ |
| 137 | 137 | public function unregister() |
| 138 | 138 | { |
| 139 | - if (! $this->exists($this->id)) { |
|
| 139 | + if (!$this->exists($this->id)) { |
|
| 140 | 140 | throw new NonExistentTaxonomyException; |
| 141 | 141 | } |
| 142 | 142 | |
@@ -67,7 +67,7 @@ |
||
| 67 | 67 | */ |
| 68 | 68 | public function register() |
| 69 | 69 | { |
| 70 | - if (! $this->id || strlen($this->id) > 32) { |
|
| 70 | + if (!$this->id || strlen($this->id) > 32) { |
|
| 71 | 71 | throw new InvalidTaxonomyNameException('Taxonomy names must be between 1 and 32 characters in length.'); |
| 72 | 72 | } |
| 73 | 73 | |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | */ |
| 67 | 67 | public function __construct(WP_Post $post = null) |
| 68 | 68 | { |
| 69 | - if (! $post) { |
|
| 69 | + if (!$post) { |
|
| 70 | 70 | $post = new WP_Post(new stdClass); |
| 71 | 71 | $post->post_type = static::postTypeId(); |
| 72 | 72 | } |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | */ |
| 134 | 134 | public static function fromGlobal() |
| 135 | 135 | { |
| 136 | - if (! $GLOBALS['post'] instanceof WP_Post) { |
|
| 136 | + if (!$GLOBALS['post'] instanceof WP_Post) { |
|
| 137 | 137 | throw new PostNotFoundException('Global $post not an instance of WP_Post'); |
| 138 | 138 | } |
| 139 | 139 | |
@@ -9,7 +9,7 @@ |
||
| 9 | 9 | { |
| 10 | 10 | public function execute() |
| 11 | 11 | { |
| 12 | - if (! $this->model->id) { |
|
| 12 | + if (!$this->model->id) { |
|
| 13 | 13 | $result = wp_insert_post($this->model->object->to_array(), true); |
| 14 | 14 | } else { |
| 15 | 15 | $result = wp_update_post($this->model->object, true); |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | public function __construct(WP_Term $term = null) |
| 53 | 53 | { |
| 54 | - if (! $term) { |
|
| 54 | + if (!$term) { |
|
| 55 | 55 | $term = new WP_Term(new stdClass); |
| 56 | 56 | $term->taxonomy = static::TAXONOMY; |
| 57 | 57 | } elseif ($term->taxonomy != static::TAXONOMY) { |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | */ |
| 85 | 85 | public static function fromID($id) |
| 86 | 86 | { |
| 87 | - if (! $term = get_term_by('id', (int) $id, static::TAXONOMY)) { |
|
| 87 | + if (!$term = get_term_by('id', (int) $id, static::TAXONOMY)) { |
|
| 88 | 88 | throw new TermNotFoundException("No term found with ID $id."); |
| 89 | 89 | } |
| 90 | 90 | |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | */ |
| 103 | 103 | public static function fromSlug($slug) |
| 104 | 104 | { |
| 105 | - if (! $term = get_term_by('slug', $slug, static::TAXONOMY)) { |
|
| 105 | + if (!$term = get_term_by('slug', $slug, static::TAXONOMY)) { |
|
| 106 | 106 | throw new TermNotFoundException("No term found with slug '$slug'."); |
| 107 | 107 | } |
| 108 | 108 | |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | public function ancestors() |
| 190 | 190 | { |
| 191 | 191 | return Collection::make(get_ancestors($this->id, static::TAXONOMY, 'taxonomy')) |
| 192 | - ->map(function ($term_ID) { |
|
| 192 | + ->map(function($term_ID) { |
|
| 193 | 193 | return static::fromID($term_ID); |
| 194 | 194 | }); |
| 195 | 195 | } |