@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | use Silk\Hook; |
4 | 4 | |
5 | -if (! function_exists('on')) : |
|
5 | +if ( ! function_exists('on')) : |
|
6 | 6 | /** |
7 | 7 | * Create and set a new event listener |
8 | 8 | * |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | } |
20 | 20 | endif; |
21 | 21 | |
22 | -if (! function_exists('off')) : |
|
22 | +if ( ! function_exists('off')) : |
|
23 | 23 | /** |
24 | 24 | * Remove an event listener |
25 | 25 | * |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | return $removed; |
36 | 36 | } |
37 | 37 | |
38 | - return on($handle, function ($given = null) use ($handle, $callback, $priority) { |
|
38 | + return on($handle, function($given = null) use ($handle, $callback, $priority) { |
|
39 | 39 | remove_filter($handle, $callback, $priority); |
40 | 40 | return $given; |
41 | 41 | })->withPriority($priority - 1); |
@@ -18,7 +18,7 @@ |
||
18 | 18 | |
19 | 19 | /** |
20 | 20 | * @param string $type Meta type |
21 | - * @param int|string $object_id ID of the object metadata is for |
|
21 | + * @param integer $object_id ID of the object metadata is for |
|
22 | 22 | * @param string $key Meta key |
23 | 23 | */ |
24 | 24 | public function __construct($type, $object_id, $key) |
@@ -69,7 +69,7 @@ |
||
69 | 69 | */ |
70 | 70 | protected function handler() |
71 | 71 | { |
72 | - return ''; // Override this in a sub-class |
|
72 | + return ''; // Override this in a sub-class |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
@@ -61,10 +61,10 @@ |
||
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
64 | - * Call the shortcode's handler and return the output. |
|
65 | - * |
|
66 | - * @return mixed Rendered shortcode output |
|
67 | - */ |
|
64 | + * Call the shortcode's handler and return the output. |
|
65 | + * |
|
66 | + * @return mixed Rendered shortcode output |
|
67 | + */ |
|
68 | 68 | public function render() |
69 | 69 | { |
70 | 70 | $dedicated_method = "{$this->tag}_handler"; |
@@ -73,7 +73,7 @@ |
||
73 | 73 | $modelClass = $this->model ? get_class($this->model) : Post::class; |
74 | 74 | |
75 | 75 | return Collection::make($this->query->get_posts()) |
76 | - ->map(function ($post) use ($modelClass) { |
|
76 | + ->map(function($post) use ($modelClass) { |
|
77 | 77 | return new $modelClass($post); |
78 | 78 | }); |
79 | 79 | } |
@@ -80,7 +80,7 @@ |
||
80 | 80 | */ |
81 | 81 | public function mediateCallback($given = null) |
82 | 82 | { |
83 | - if (! $this->shouldInvoke(func_get_args())) { |
|
83 | + if ( ! $this->shouldInvoke(func_get_args())) { |
|
84 | 84 | return $given; |
85 | 85 | } |
86 | 86 |
@@ -194,7 +194,7 @@ |
||
194 | 194 | /** |
195 | 195 | * Set the priority the callback should be registered with. |
196 | 196 | * |
197 | - * @param mixed $priority The callback priority |
|
197 | + * @param integer $priority The callback priority |
|
198 | 198 | * |
199 | 199 | * @return $this |
200 | 200 | */ |
@@ -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 |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | */ |
69 | 69 | public function __construct(WP_Post $post = null) |
70 | 70 | { |
71 | - if (! $post) { |
|
71 | + if ( ! $post) { |
|
72 | 72 | $post = new WP_Post(new stdClass); |
73 | 73 | $post->post_type = static::postTypeId(); |
74 | 74 | } |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | */ |
137 | 137 | public static function fromGlobal() |
138 | 138 | { |
139 | - if (! $GLOBALS['post'] instanceof WP_Post) { |
|
139 | + if ( ! $GLOBALS['post'] instanceof WP_Post) { |
|
140 | 140 | throw new PostNotFoundException('Global $post not an instance of WP_Post'); |
141 | 141 | } |
142 | 142 | |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | */ |
268 | 268 | public function save() |
269 | 269 | { |
270 | - if (! $this->id) { |
|
270 | + if ( ! $this->id) { |
|
271 | 271 | $result = wp_insert_post($this->post->to_array(), true); |
272 | 272 | } else { |
273 | 273 | $result = wp_update_post($this->post, true); |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | */ |
62 | 62 | public static function load($slug) |
63 | 63 | { |
64 | - if (! $object = get_post_type_object($slug)) { |
|
64 | + if ( ! $object = get_post_type_object($slug)) { |
|
65 | 65 | throw new NonExistentPostTypeException("No post type exists with name '$slug'."); |
66 | 66 | } |
67 | 67 | |
@@ -98,12 +98,12 @@ discard block |
||
98 | 98 | */ |
99 | 99 | public function supports($features) |
100 | 100 | { |
101 | - if (! is_array($features)) { |
|
101 | + if ( ! is_array($features)) { |
|
102 | 102 | $features = func_get_args(); |
103 | 103 | } |
104 | 104 | |
105 | 105 | return ! collect($features) |
106 | - ->contains(function ($key, $feature) { |
|
106 | + ->contains(function($key, $feature) { |
|
107 | 107 | return ! post_type_supports($this->slug, $feature); |
108 | 108 | }); |
109 | 109 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | public function removeSupportFor($features) |
131 | 131 | { |
132 | 132 | collect(is_array($features) ? $features : func_get_args()) |
133 | - ->each(function ($features) { |
|
133 | + ->each(function($features) { |
|
134 | 134 | remove_post_type_support($this->slug, $features); |
135 | 135 | }); |
136 | 136 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | */ |
145 | 145 | public function unregister() |
146 | 146 | { |
147 | - if (! static::exists($this->slug)) { |
|
147 | + if ( ! static::exists($this->slug)) { |
|
148 | 148 | throw new NonExistentPostTypeException("No post type exists with name '{$this->slug}'."); |
149 | 149 | } |
150 | 150 |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | /** |
84 | 84 | * Get the post type object. |
85 | 85 | * |
86 | - * @return object |
|
86 | + * @return stdClass |
|
87 | 87 | */ |
88 | 88 | public function object() |
89 | 89 | { |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * @param string,...|array $features string - First feature of possible many, |
97 | 97 | * array - Many features to check support for. |
98 | 98 | * |
99 | - * @return mixed |
|
99 | + * @return boolean |
|
100 | 100 | */ |
101 | 101 | public function supports($features) |
102 | 102 | { |
@@ -3,10 +3,7 @@ |
||
3 | 3 | namespace Silk\Post; |
4 | 4 | |
5 | 5 | use stdClass; |
6 | -use InvalidArgumentException; |
|
7 | -use Illuminate\Support\Collection; |
|
8 | 6 | use Silk\Exception\WP_ErrorException; |
9 | -use Silk\Post\Exception\InvalidPostTypeNameException; |
|
10 | 7 | use Silk\Post\Exception\NonExistentPostTypeException; |
11 | 8 | use Silk\Post\PostTypeBuilder; |
12 | 9 |
@@ -74,7 +74,7 @@ |
||
74 | 74 | */ |
75 | 75 | public function supports($features) |
76 | 76 | { |
77 | - if (! is_array($features)) { |
|
77 | + if ( ! is_array($features)) { |
|
78 | 78 | $features = func_get_args(); |
79 | 79 | } |
80 | 80 |