@@ -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 |
@@ -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 |
@@ -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); |
@@ -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 |
@@ -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 | } |
@@ -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 | /** |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public function __construct(WP_User $user = null) |
38 | 38 | { |
39 | - if (! $user) { |
|
39 | + if (!$user) { |
|
40 | 40 | $user = new WP_User; |
41 | 41 | } |
42 | 42 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | */ |
55 | 55 | public static function fromID($id) |
56 | 56 | { |
57 | - if (! $user = get_user_by('id', $id)) { |
|
57 | + if (!$user = get_user_by('id', $id)) { |
|
58 | 58 | throw new UserNotFoundException("No user found with ID $id"); |
59 | 59 | } |
60 | 60 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public static function fromUsername($username) |
74 | 74 | { |
75 | - if (! $user = get_user_by('login', $username)) { |
|
75 | + if (!$user = get_user_by('login', $username)) { |
|
76 | 76 | throw new UserNotFoundException("No user found with username: $username"); |
77 | 77 | } |
78 | 78 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public static function fromEmail($email) |
92 | 92 | { |
93 | - if (! $user = get_user_by('email', $email)) { |
|
93 | + if (!$user = get_user_by('email', $email)) { |
|
94 | 94 | throw new UserNotFoundException("No user found with email address: $email"); |
95 | 95 | } |
96 | 96 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | */ |
109 | 109 | public static function fromSlug($slug) |
110 | 110 | { |
111 | - if (! $user = get_user_by('slug', $slug)) { |
|
111 | + if (!$user = get_user_by('slug', $slug)) { |
|
112 | 112 | throw new UserNotFoundException("No user found with slug: $slug"); |
113 | 113 | } |
114 | 114 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | */ |
150 | 150 | public function __get($property) |
151 | 151 | { |
152 | - if (! array_key_exists($property, $this->objectAliases)) { |
|
152 | + if (!array_key_exists($property, $this->objectAliases)) { |
|
153 | 153 | return parent::__get($property); |
154 | 154 | } |
155 | 155 |