Passed
Push — master ( b1f119...6c0127 )
by Paul
11:00 queued 04:12
created
plugin/Modules/Schema.php 2 patches
Indentation   +267 added lines, -267 removed lines patch added patch discarded remove patch
@@ -12,291 +12,291 @@
 block discarded – undo
12 12
 
13 13
 class Schema
14 14
 {
15
-    /**
16
-     * @var array
17
-     */
18
-    protected $args;
15
+	/**
16
+	 * @var array
17
+	 */
18
+	protected $args;
19 19
 
20
-    /**
21
-     * @var array
22
-     */
23
-    protected $ratingCounts;
20
+	/**
21
+	 * @var array
22
+	 */
23
+	protected $ratingCounts;
24 24
 
25
-    /**
26
-     * @return array
27
-     */
28
-    public function build(array $args = [])
29
-    {
30
-        $this->args = $args;
31
-        $schema = $this->buildSummary($args);
32
-        $reviews = [];
33
-        foreach (glsr(ReviewManager::class)->get($this->args) as $review) {
34
-            // Only include critic reviews that have been directly produced by your site, not reviews from third-party sites or syndicated reviews.
35
-            // @see https://developers.google.com/search/docs/data-types/review
36
-            if ('local' != $review->review_type) {
37
-                continue;
38
-            }
39
-            $reviews[] = $this->buildReview($review);
40
-        }
41
-        if (!empty($reviews)) {
42
-            array_walk($reviews, function (&$review) {
43
-                unset($review['@context']);
44
-                unset($review['itemReviewed']);
45
-            });
46
-            $schema['review'] = $reviews;
47
-        }
48
-        return $schema;
49
-    }
25
+	/**
26
+	 * @return array
27
+	 */
28
+	public function build(array $args = [])
29
+	{
30
+		$this->args = $args;
31
+		$schema = $this->buildSummary($args);
32
+		$reviews = [];
33
+		foreach (glsr(ReviewManager::class)->get($this->args) as $review) {
34
+			// Only include critic reviews that have been directly produced by your site, not reviews from third-party sites or syndicated reviews.
35
+			// @see https://developers.google.com/search/docs/data-types/review
36
+			if ('local' != $review->review_type) {
37
+				continue;
38
+			}
39
+			$reviews[] = $this->buildReview($review);
40
+		}
41
+		if (!empty($reviews)) {
42
+			array_walk($reviews, function (&$review) {
43
+				unset($review['@context']);
44
+				unset($review['itemReviewed']);
45
+			});
46
+			$schema['review'] = $reviews;
47
+		}
48
+		return $schema;
49
+	}
50 50
 
51
-    /**
52
-     * @param array|null $args
53
-     * @return array
54
-     */
55
-    public function buildSummary($args = null)
56
-    {
57
-        if (is_array($args)) {
58
-            $this->args = $args;
59
-        }
60
-        $buildSummary = Helper::buildMethodName($this->getSchemaOptionValue('type'), 'buildSummaryFor');
61
-        $count = array_sum($this->getRatingCounts());
62
-        $schema = method_exists($this, $buildSummary)
63
-            ? $this->$buildSummary()
64
-            : $this->buildSummaryForCustom();
65
-        if (!empty($count)) {
66
-            $schema->aggregateRating(
67
-                $this->getSchemaType('AggregateRating')
68
-                    ->ratingValue($this->getRatingValue())
69
-                    ->reviewCount($count)
70
-                    ->bestRating(glsr()->constant('MAX_RATING', Rating::class))
71
-                    ->worstRating(glsr()->constant('MIN_RATING', Rating::class))
72
-            );
73
-        }
74
-        $schema = $schema->toArray();
75
-        return apply_filters('site-reviews/schema/'.$schema['@type'], $schema, $args);
76
-    }
51
+	/**
52
+	 * @param array|null $args
53
+	 * @return array
54
+	 */
55
+	public function buildSummary($args = null)
56
+	{
57
+		if (is_array($args)) {
58
+			$this->args = $args;
59
+		}
60
+		$buildSummary = Helper::buildMethodName($this->getSchemaOptionValue('type'), 'buildSummaryFor');
61
+		$count = array_sum($this->getRatingCounts());
62
+		$schema = method_exists($this, $buildSummary)
63
+			? $this->$buildSummary()
64
+			: $this->buildSummaryForCustom();
65
+		if (!empty($count)) {
66
+			$schema->aggregateRating(
67
+				$this->getSchemaType('AggregateRating')
68
+					->ratingValue($this->getRatingValue())
69
+					->reviewCount($count)
70
+					->bestRating(glsr()->constant('MAX_RATING', Rating::class))
71
+					->worstRating(glsr()->constant('MIN_RATING', Rating::class))
72
+			);
73
+		}
74
+		$schema = $schema->toArray();
75
+		return apply_filters('site-reviews/schema/'.$schema['@type'], $schema, $args);
76
+	}
77 77
 
78
-    /**
79
-     * @return void
80
-     */
81
-    public function render()
82
-    {
83
-        if (empty(glsr()->schemas)) {
84
-            return;
85
-        }
86
-        printf('<script type="application/ld+json">%s</script>', json_encode(
87
-            apply_filters('site-reviews/schema/all', glsr()->schemas),
88
-            JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES
89
-        ));
90
-    }
78
+	/**
79
+	 * @return void
80
+	 */
81
+	public function render()
82
+	{
83
+		if (empty(glsr()->schemas)) {
84
+			return;
85
+		}
86
+		printf('<script type="application/ld+json">%s</script>', json_encode(
87
+			apply_filters('site-reviews/schema/all', glsr()->schemas),
88
+			JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES
89
+		));
90
+	}
91 91
 
92
-    /**
93
-     * @return void
94
-     */
95
-    public function store(array $schema)
96
-    {
97
-        $schemas = glsr()->schemas;
98
-        $schemas[] = $schema;
99
-        glsr()->schemas = array_map('unserialize', array_unique(array_map('serialize', $schemas)));
100
-    }
92
+	/**
93
+	 * @return void
94
+	 */
95
+	public function store(array $schema)
96
+	{
97
+		$schemas = glsr()->schemas;
98
+		$schemas[] = $schema;
99
+		glsr()->schemas = array_map('unserialize', array_unique(array_map('serialize', $schemas)));
100
+	}
101 101
 
102
-    /**
103
-     * @param Review $review
104
-     * @return array
105
-     */
106
-    protected function buildReview($review)
107
-    {
108
-        $schema = $this->getSchemaType('Review')
109
-            ->doIf(!in_array('title', $this->args['hide']), function ($schema) use ($review) {
110
-                $schema->name($review->title);
111
-            })
112
-            ->doIf(!in_array('excerpt', $this->args['hide']), function ($schema) use ($review) {
113
-                $schema->reviewBody($review->content);
114
-            })
115
-            ->datePublished((new DateTime($review->date)))
116
-            ->author($this->getSchemaType('Person')->name($review->author))
117
-            ->itemReviewed($this->getSchemaType()->name($this->getSchemaOptionValue('name')));
118
-        if (!empty($review->rating)) {
119
-            $schema->reviewRating(
120
-                $this->getSchemaType('Rating')
121
-                    ->ratingValue($review->rating)
122
-                    ->bestRating(glsr()->constant('MAX_RATING', Rating::class))
123
-                    ->worstRating(glsr()->constant('MIN_RATING', Rating::class))
124
-            );
125
-        }
126
-        return apply_filters('site-reviews/schema/review', $schema->toArray(), $review, $this->args);
127
-    }
102
+	/**
103
+	 * @param Review $review
104
+	 * @return array
105
+	 */
106
+	protected function buildReview($review)
107
+	{
108
+		$schema = $this->getSchemaType('Review')
109
+			->doIf(!in_array('title', $this->args['hide']), function ($schema) use ($review) {
110
+				$schema->name($review->title);
111
+			})
112
+			->doIf(!in_array('excerpt', $this->args['hide']), function ($schema) use ($review) {
113
+				$schema->reviewBody($review->content);
114
+			})
115
+			->datePublished((new DateTime($review->date)))
116
+			->author($this->getSchemaType('Person')->name($review->author))
117
+			->itemReviewed($this->getSchemaType()->name($this->getSchemaOptionValue('name')));
118
+		if (!empty($review->rating)) {
119
+			$schema->reviewRating(
120
+				$this->getSchemaType('Rating')
121
+					->ratingValue($review->rating)
122
+					->bestRating(glsr()->constant('MAX_RATING', Rating::class))
123
+					->worstRating(glsr()->constant('MIN_RATING', Rating::class))
124
+			);
125
+		}
126
+		return apply_filters('site-reviews/schema/review', $schema->toArray(), $review, $this->args);
127
+	}
128 128
 
129
-    /**
130
-     * @param mixed $schema
131
-     * @return mixed
132
-     */
133
-    protected function buildSchemaValues($schema, array $values = [])
134
-    {
135
-        foreach ($values as $value) {
136
-            $option = $this->getSchemaOptionValue($value);
137
-            if (empty($option)) {
138
-                continue;
139
-            }
140
-            $schema->$value($option);
141
-        }
142
-        return $schema;
143
-    }
129
+	/**
130
+	 * @param mixed $schema
131
+	 * @return mixed
132
+	 */
133
+	protected function buildSchemaValues($schema, array $values = [])
134
+	{
135
+		foreach ($values as $value) {
136
+			$option = $this->getSchemaOptionValue($value);
137
+			if (empty($option)) {
138
+				continue;
139
+			}
140
+			$schema->$value($option);
141
+		}
142
+		return $schema;
143
+	}
144 144
 
145
-    /**
146
-     * @return mixed
147
-     */
148
-    protected function buildSummaryForCustom()
149
-    {
150
-        return $this->buildSchemaValues($this->getSchemaType(), [
151
-            'description', 'image', 'name', 'url',
152
-        ]);
153
-    }
145
+	/**
146
+	 * @return mixed
147
+	 */
148
+	protected function buildSummaryForCustom()
149
+	{
150
+		return $this->buildSchemaValues($this->getSchemaType(), [
151
+			'description', 'image', 'name', 'url',
152
+		]);
153
+	}
154 154
 
155
-    /**
156
-     * @return mixed
157
-     */
158
-    protected function buildSummaryForLocalBusiness()
159
-    {
160
-        return $this->buildSchemaValues($this->buildSummaryForCustom(), [
161
-            'address', 'priceRange', 'telephone',
162
-        ]);
163
-    }
155
+	/**
156
+	 * @return mixed
157
+	 */
158
+	protected function buildSummaryForLocalBusiness()
159
+	{
160
+		return $this->buildSchemaValues($this->buildSummaryForCustom(), [
161
+			'address', 'priceRange', 'telephone',
162
+		]);
163
+	}
164 164
 
165
-    /**
166
-     * @return mixed
167
-     */
168
-    protected function buildSummaryForProduct()
169
-    {
170
-        $offerType = $this->getSchemaOption('offerType', 'AggregateOffer');
171
-        $offers = $this->buildSchemaValues($this->getSchemaType($offerType), [
172
-            'highPrice', 'lowPrice', 'price', 'priceCurrency',
173
-        ]);
174
-        return $this->buildSummaryForCustom()
175
-            ->doIf(!empty($offers->getProperties()), function ($schema) use ($offers) {
176
-                $schema->offers($offers);
177
-            })
178
-            ->setProperty('@id', $this->getSchemaOptionValue('url').'#product');
179
-    }
165
+	/**
166
+	 * @return mixed
167
+	 */
168
+	protected function buildSummaryForProduct()
169
+	{
170
+		$offerType = $this->getSchemaOption('offerType', 'AggregateOffer');
171
+		$offers = $this->buildSchemaValues($this->getSchemaType($offerType), [
172
+			'highPrice', 'lowPrice', 'price', 'priceCurrency',
173
+		]);
174
+		return $this->buildSummaryForCustom()
175
+			->doIf(!empty($offers->getProperties()), function ($schema) use ($offers) {
176
+				$schema->offers($offers);
177
+			})
178
+			->setProperty('@id', $this->getSchemaOptionValue('url').'#product');
179
+	}
180 180
 
181
-    /**
182
-     * @return array
183
-     */
184
-    protected function getRatingCounts()
185
-    {
186
-        if (!isset($this->ratingCounts)) {
187
-            $this->ratingCounts = glsr(ReviewManager::class)->getRatingCounts($this->args);
188
-        }
189
-        return $this->ratingCounts;
190
-    }
181
+	/**
182
+	 * @return array
183
+	 */
184
+	protected function getRatingCounts()
185
+	{
186
+		if (!isset($this->ratingCounts)) {
187
+			$this->ratingCounts = glsr(ReviewManager::class)->getRatingCounts($this->args);
188
+		}
189
+		return $this->ratingCounts;
190
+	}
191 191
 
192
-    /**
193
-     * @return int|float
194
-     */
195
-    protected function getRatingValue()
196
-    {
197
-        return glsr(Rating::class)->getAverage($this->getRatingCounts());
198
-    }
192
+	/**
193
+	 * @return int|float
194
+	 */
195
+	protected function getRatingValue()
196
+	{
197
+		return glsr(Rating::class)->getAverage($this->getRatingCounts());
198
+	}
199 199
 
200
-    /**
201
-     * @param string $option
202
-     * @param string $fallback
203
-     * @return string
204
-     */
205
-    protected function getSchemaOption($option, $fallback)
206
-    {
207
-        $option = strtolower($option);
208
-        if ($schemaOption = trim((string) get_post_meta(intval(get_the_ID()), 'schema_'.$option, true))) {
209
-            return $schemaOption;
210
-        }
211
-        $setting = glsr(OptionManager::class)->get('settings.schema.'.$option);
212
-        if (is_array($setting)) {
213
-            return $this->getSchemaOptionDefault($setting, $fallback);
214
-        }
215
-        return !empty($setting)
216
-            ? $setting
217
-            : $fallback;
218
-    }
200
+	/**
201
+	 * @param string $option
202
+	 * @param string $fallback
203
+	 * @return string
204
+	 */
205
+	protected function getSchemaOption($option, $fallback)
206
+	{
207
+		$option = strtolower($option);
208
+		if ($schemaOption = trim((string) get_post_meta(intval(get_the_ID()), 'schema_'.$option, true))) {
209
+			return $schemaOption;
210
+		}
211
+		$setting = glsr(OptionManager::class)->get('settings.schema.'.$option);
212
+		if (is_array($setting)) {
213
+			return $this->getSchemaOptionDefault($setting, $fallback);
214
+		}
215
+		return !empty($setting)
216
+			? $setting
217
+			: $fallback;
218
+	}
219 219
 
220
-    /**
221
-     * @param string $fallback
222
-     * @return string
223
-     */
224
-    protected function getSchemaOptionDefault(array $setting, $fallback)
225
-    {
226
-        $setting = wp_parse_args($setting, [
227
-            'custom' => '',
228
-            'default' => $fallback,
229
-        ]);
230
-        return 'custom' != $setting['default']
231
-            ? $setting['default']
232
-            : $setting['custom'];
233
-    }
220
+	/**
221
+	 * @param string $fallback
222
+	 * @return string
223
+	 */
224
+	protected function getSchemaOptionDefault(array $setting, $fallback)
225
+	{
226
+		$setting = wp_parse_args($setting, [
227
+			'custom' => '',
228
+			'default' => $fallback,
229
+		]);
230
+		return 'custom' != $setting['default']
231
+			? $setting['default']
232
+			: $setting['custom'];
233
+	}
234 234
 
235
-    /**
236
-     * @param string $option
237
-     * @param string $fallback
238
-     * @return void|string
239
-     */
240
-    protected function getSchemaOptionValue($option, $fallback = 'post')
241
-    {
242
-        $value = $this->getSchemaOption($option, $fallback);
243
-        if ($value != $fallback) {
244
-            return $value;
245
-        }
246
-        if (!is_single() && !is_page()) {
247
-            return;
248
-        }
249
-        $method = Helper::buildMethodName($option, 'getThing');
250
-        if (method_exists($this, $method)) {
251
-            return $this->$method();
252
-        }
253
-    }
235
+	/**
236
+	 * @param string $option
237
+	 * @param string $fallback
238
+	 * @return void|string
239
+	 */
240
+	protected function getSchemaOptionValue($option, $fallback = 'post')
241
+	{
242
+		$value = $this->getSchemaOption($option, $fallback);
243
+		if ($value != $fallback) {
244
+			return $value;
245
+		}
246
+		if (!is_single() && !is_page()) {
247
+			return;
248
+		}
249
+		$method = Helper::buildMethodName($option, 'getThing');
250
+		if (method_exists($this, $method)) {
251
+			return $this->$method();
252
+		}
253
+	}
254 254
 
255
-    /**
256
-     * @param string|null $type
257
-     * @return mixed
258
-     */
259
-    protected function getSchemaType($type = null)
260
-    {
261
-        if (!is_string($type)) {
262
-            $type = $this->getSchemaOption('type', 'LocalBusiness');
263
-        }
264
-        $className = Helper::buildClassName($type, 'Modules\Schema');
265
-        return class_exists($className)
266
-            ? new $className()
267
-            : new UnknownType($type);
268
-    }
255
+	/**
256
+	 * @param string|null $type
257
+	 * @return mixed
258
+	 */
259
+	protected function getSchemaType($type = null)
260
+	{
261
+		if (!is_string($type)) {
262
+			$type = $this->getSchemaOption('type', 'LocalBusiness');
263
+		}
264
+		$className = Helper::buildClassName($type, 'Modules\Schema');
265
+		return class_exists($className)
266
+			? new $className()
267
+			: new UnknownType($type);
268
+	}
269 269
 
270
-    /**
271
-     * @return string
272
-     */
273
-    protected function getThingDescription()
274
-    {
275
-        $description = strip_shortcodes(wp_strip_all_tags(get_the_excerpt()));
276
-        return wp_trim_words($description, apply_filters('excerpt_length', 55));
277
-    }
270
+	/**
271
+	 * @return string
272
+	 */
273
+	protected function getThingDescription()
274
+	{
275
+		$description = strip_shortcodes(wp_strip_all_tags(get_the_excerpt()));
276
+		return wp_trim_words($description, apply_filters('excerpt_length', 55));
277
+	}
278 278
 
279
-    /**
280
-     * @return string
281
-     */
282
-    protected function getThingImage()
283
-    {
284
-        return (string) get_the_post_thumbnail_url(null, 'large');
285
-    }
279
+	/**
280
+	 * @return string
281
+	 */
282
+	protected function getThingImage()
283
+	{
284
+		return (string) get_the_post_thumbnail_url(null, 'large');
285
+	}
286 286
 
287
-    /**
288
-     * @return string
289
-     */
290
-    protected function getThingName()
291
-    {
292
-        return get_the_title();
293
-    }
287
+	/**
288
+	 * @return string
289
+	 */
290
+	protected function getThingName()
291
+	{
292
+		return get_the_title();
293
+	}
294 294
 
295
-    /**
296
-     * @return string
297
-     */
298
-    protected function getThingUrl()
299
-    {
300
-        return (string) get_the_permalink();
301
-    }
295
+	/**
296
+	 * @return string
297
+	 */
298
+	protected function getThingUrl()
299
+	{
300
+		return (string) get_the_permalink();
301
+	}
302 302
 }
Please login to merge, or discard this patch.
Spacing   +83 added lines, -83 removed lines patch added patch discarded remove patch
@@ -25,21 +25,21 @@  discard block
 block discarded – undo
25 25
     /**
26 26
      * @return array
27 27
      */
28
-    public function build(array $args = [])
28
+    public function build( array $args = [] )
29 29
     {
30 30
         $this->args = $args;
31
-        $schema = $this->buildSummary($args);
31
+        $schema = $this->buildSummary( $args );
32 32
         $reviews = [];
33
-        foreach (glsr(ReviewManager::class)->get($this->args) as $review) {
33
+        foreach( glsr( ReviewManager::class )->get( $this->args ) as $review ) {
34 34
             // Only include critic reviews that have been directly produced by your site, not reviews from third-party sites or syndicated reviews.
35 35
             // @see https://developers.google.com/search/docs/data-types/review
36
-            if ('local' != $review->review_type) {
36
+            if( 'local' != $review->review_type ) {
37 37
                 continue;
38 38
             }
39
-            $reviews[] = $this->buildReview($review);
39
+            $reviews[] = $this->buildReview( $review );
40 40
         }
41
-        if (!empty($reviews)) {
42
-            array_walk($reviews, function (&$review) {
41
+        if( !empty($reviews) ) {
42
+            array_walk( $reviews, function( &$review ) {
43 43
                 unset($review['@context']);
44 44
                 unset($review['itemReviewed']);
45 45
             });
@@ -52,27 +52,27 @@  discard block
 block discarded – undo
52 52
      * @param array|null $args
53 53
      * @return array
54 54
      */
55
-    public function buildSummary($args = null)
55
+    public function buildSummary( $args = null )
56 56
     {
57
-        if (is_array($args)) {
57
+        if( is_array( $args ) ) {
58 58
             $this->args = $args;
59 59
         }
60
-        $buildSummary = Helper::buildMethodName($this->getSchemaOptionValue('type'), 'buildSummaryFor');
61
-        $count = array_sum($this->getRatingCounts());
62
-        $schema = method_exists($this, $buildSummary)
60
+        $buildSummary = Helper::buildMethodName( $this->getSchemaOptionValue( 'type' ), 'buildSummaryFor' );
61
+        $count = array_sum( $this->getRatingCounts() );
62
+        $schema = method_exists( $this, $buildSummary )
63 63
             ? $this->$buildSummary()
64 64
             : $this->buildSummaryForCustom();
65
-        if (!empty($count)) {
65
+        if( !empty($count) ) {
66 66
             $schema->aggregateRating(
67
-                $this->getSchemaType('AggregateRating')
68
-                    ->ratingValue($this->getRatingValue())
69
-                    ->reviewCount($count)
70
-                    ->bestRating(glsr()->constant('MAX_RATING', Rating::class))
71
-                    ->worstRating(glsr()->constant('MIN_RATING', Rating::class))
67
+                $this->getSchemaType( 'AggregateRating' )
68
+                    ->ratingValue( $this->getRatingValue() )
69
+                    ->reviewCount( $count )
70
+                    ->bestRating( glsr()->constant( 'MAX_RATING', Rating::class ) )
71
+                    ->worstRating( glsr()->constant( 'MIN_RATING', Rating::class ) )
72 72
             );
73 73
         }
74 74
         $schema = $schema->toArray();
75
-        return apply_filters('site-reviews/schema/'.$schema['@type'], $schema, $args);
75
+        return apply_filters( 'site-reviews/schema/'.$schema['@type'], $schema, $args );
76 76
     }
77 77
 
78 78
     /**
@@ -80,64 +80,64 @@  discard block
 block discarded – undo
80 80
      */
81 81
     public function render()
82 82
     {
83
-        if (empty(glsr()->schemas)) {
83
+        if( empty(glsr()->schemas) ) {
84 84
             return;
85 85
         }
86
-        printf('<script type="application/ld+json">%s</script>', json_encode(
87
-            apply_filters('site-reviews/schema/all', glsr()->schemas),
86
+        printf( '<script type="application/ld+json">%s</script>', json_encode(
87
+            apply_filters( 'site-reviews/schema/all', glsr()->schemas ),
88 88
             JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES
89
-        ));
89
+        ) );
90 90
     }
91 91
 
92 92
     /**
93 93
      * @return void
94 94
      */
95
-    public function store(array $schema)
95
+    public function store( array $schema )
96 96
     {
97 97
         $schemas = glsr()->schemas;
98 98
         $schemas[] = $schema;
99
-        glsr()->schemas = array_map('unserialize', array_unique(array_map('serialize', $schemas)));
99
+        glsr()->schemas = array_map( 'unserialize', array_unique( array_map( 'serialize', $schemas ) ) );
100 100
     }
101 101
 
102 102
     /**
103 103
      * @param Review $review
104 104
      * @return array
105 105
      */
106
-    protected function buildReview($review)
106
+    protected function buildReview( $review )
107 107
     {
108
-        $schema = $this->getSchemaType('Review')
109
-            ->doIf(!in_array('title', $this->args['hide']), function ($schema) use ($review) {
110
-                $schema->name($review->title);
108
+        $schema = $this->getSchemaType( 'Review' )
109
+            ->doIf( !in_array( 'title', $this->args['hide'] ), function( $schema ) use ($review) {
110
+                $schema->name( $review->title );
111 111
             })
112
-            ->doIf(!in_array('excerpt', $this->args['hide']), function ($schema) use ($review) {
113
-                $schema->reviewBody($review->content);
112
+            ->doIf( !in_array( 'excerpt', $this->args['hide'] ), function( $schema ) use ($review) {
113
+                $schema->reviewBody( $review->content );
114 114
             })
115
-            ->datePublished((new DateTime($review->date)))
116
-            ->author($this->getSchemaType('Person')->name($review->author))
117
-            ->itemReviewed($this->getSchemaType()->name($this->getSchemaOptionValue('name')));
118
-        if (!empty($review->rating)) {
115
+            ->datePublished( (new DateTime( $review->date )) )
116
+            ->author( $this->getSchemaType( 'Person' )->name( $review->author ) )
117
+            ->itemReviewed( $this->getSchemaType()->name( $this->getSchemaOptionValue( 'name' ) ) );
118
+        if( !empty($review->rating) ) {
119 119
             $schema->reviewRating(
120
-                $this->getSchemaType('Rating')
121
-                    ->ratingValue($review->rating)
122
-                    ->bestRating(glsr()->constant('MAX_RATING', Rating::class))
123
-                    ->worstRating(glsr()->constant('MIN_RATING', Rating::class))
120
+                $this->getSchemaType( 'Rating' )
121
+                    ->ratingValue( $review->rating )
122
+                    ->bestRating( glsr()->constant( 'MAX_RATING', Rating::class ) )
123
+                    ->worstRating( glsr()->constant( 'MIN_RATING', Rating::class ) )
124 124
             );
125 125
         }
126
-        return apply_filters('site-reviews/schema/review', $schema->toArray(), $review, $this->args);
126
+        return apply_filters( 'site-reviews/schema/review', $schema->toArray(), $review, $this->args );
127 127
     }
128 128
 
129 129
     /**
130 130
      * @param mixed $schema
131 131
      * @return mixed
132 132
      */
133
-    protected function buildSchemaValues($schema, array $values = [])
133
+    protected function buildSchemaValues( $schema, array $values = [] )
134 134
     {
135
-        foreach ($values as $value) {
136
-            $option = $this->getSchemaOptionValue($value);
137
-            if (empty($option)) {
135
+        foreach( $values as $value ) {
136
+            $option = $this->getSchemaOptionValue( $value );
137
+            if( empty($option) ) {
138 138
                 continue;
139 139
             }
140
-            $schema->$value($option);
140
+            $schema->$value( $option );
141 141
         }
142 142
         return $schema;
143 143
     }
@@ -147,9 +147,9 @@  discard block
 block discarded – undo
147 147
      */
148 148
     protected function buildSummaryForCustom()
149 149
     {
150
-        return $this->buildSchemaValues($this->getSchemaType(), [
150
+        return $this->buildSchemaValues( $this->getSchemaType(), [
151 151
             'description', 'image', 'name', 'url',
152
-        ]);
152
+        ] );
153 153
     }
154 154
 
155 155
     /**
@@ -157,9 +157,9 @@  discard block
 block discarded – undo
157 157
      */
158 158
     protected function buildSummaryForLocalBusiness()
159 159
     {
160
-        return $this->buildSchemaValues($this->buildSummaryForCustom(), [
160
+        return $this->buildSchemaValues( $this->buildSummaryForCustom(), [
161 161
             'address', 'priceRange', 'telephone',
162
-        ]);
162
+        ] );
163 163
     }
164 164
 
165 165
     /**
@@ -167,15 +167,15 @@  discard block
 block discarded – undo
167 167
      */
168 168
     protected function buildSummaryForProduct()
169 169
     {
170
-        $offerType = $this->getSchemaOption('offerType', 'AggregateOffer');
171
-        $offers = $this->buildSchemaValues($this->getSchemaType($offerType), [
170
+        $offerType = $this->getSchemaOption( 'offerType', 'AggregateOffer' );
171
+        $offers = $this->buildSchemaValues( $this->getSchemaType( $offerType ), [
172 172
             'highPrice', 'lowPrice', 'price', 'priceCurrency',
173
-        ]);
173
+        ] );
174 174
         return $this->buildSummaryForCustom()
175
-            ->doIf(!empty($offers->getProperties()), function ($schema) use ($offers) {
176
-                $schema->offers($offers);
175
+            ->doIf( !empty($offers->getProperties()), function( $schema ) use ($offers) {
176
+                $schema->offers( $offers );
177 177
             })
178
-            ->setProperty('@id', $this->getSchemaOptionValue('url').'#product');
178
+            ->setProperty( '@id', $this->getSchemaOptionValue( 'url' ).'#product' );
179 179
     }
180 180
 
181 181
     /**
@@ -183,8 +183,8 @@  discard block
 block discarded – undo
183 183
      */
184 184
     protected function getRatingCounts()
185 185
     {
186
-        if (!isset($this->ratingCounts)) {
187
-            $this->ratingCounts = glsr(ReviewManager::class)->getRatingCounts($this->args);
186
+        if( !isset($this->ratingCounts) ) {
187
+            $this->ratingCounts = glsr( ReviewManager::class )->getRatingCounts( $this->args );
188 188
         }
189 189
         return $this->ratingCounts;
190 190
     }
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
      */
195 195
     protected function getRatingValue()
196 196
     {
197
-        return glsr(Rating::class)->getAverage($this->getRatingCounts());
197
+        return glsr( Rating::class )->getAverage( $this->getRatingCounts() );
198 198
     }
199 199
 
200 200
     /**
@@ -202,15 +202,15 @@  discard block
 block discarded – undo
202 202
      * @param string $fallback
203 203
      * @return string
204 204
      */
205
-    protected function getSchemaOption($option, $fallback)
205
+    protected function getSchemaOption( $option, $fallback )
206 206
     {
207
-        $option = strtolower($option);
208
-        if ($schemaOption = trim((string) get_post_meta(intval(get_the_ID()), 'schema_'.$option, true))) {
207
+        $option = strtolower( $option );
208
+        if( $schemaOption = trim( (string)get_post_meta( intval( get_the_ID() ), 'schema_'.$option, true ) ) ) {
209 209
             return $schemaOption;
210 210
         }
211
-        $setting = glsr(OptionManager::class)->get('settings.schema.'.$option);
212
-        if (is_array($setting)) {
213
-            return $this->getSchemaOptionDefault($setting, $fallback);
211
+        $setting = glsr( OptionManager::class )->get( 'settings.schema.'.$option );
212
+        if( is_array( $setting ) ) {
213
+            return $this->getSchemaOptionDefault( $setting, $fallback );
214 214
         }
215 215
         return !empty($setting)
216 216
             ? $setting
@@ -221,12 +221,12 @@  discard block
 block discarded – undo
221 221
      * @param string $fallback
222 222
      * @return string
223 223
      */
224
-    protected function getSchemaOptionDefault(array $setting, $fallback)
224
+    protected function getSchemaOptionDefault( array $setting, $fallback )
225 225
     {
226
-        $setting = wp_parse_args($setting, [
226
+        $setting = wp_parse_args( $setting, [
227 227
             'custom' => '',
228 228
             'default' => $fallback,
229
-        ]);
229
+        ] );
230 230
         return 'custom' != $setting['default']
231 231
             ? $setting['default']
232 232
             : $setting['custom'];
@@ -237,17 +237,17 @@  discard block
 block discarded – undo
237 237
      * @param string $fallback
238 238
      * @return void|string
239 239
      */
240
-    protected function getSchemaOptionValue($option, $fallback = 'post')
240
+    protected function getSchemaOptionValue( $option, $fallback = 'post' )
241 241
     {
242
-        $value = $this->getSchemaOption($option, $fallback);
243
-        if ($value != $fallback) {
242
+        $value = $this->getSchemaOption( $option, $fallback );
243
+        if( $value != $fallback ) {
244 244
             return $value;
245 245
         }
246
-        if (!is_single() && !is_page()) {
246
+        if( !is_single() && !is_page() ) {
247 247
             return;
248 248
         }
249
-        $method = Helper::buildMethodName($option, 'getThing');
250
-        if (method_exists($this, $method)) {
249
+        $method = Helper::buildMethodName( $option, 'getThing' );
250
+        if( method_exists( $this, $method ) ) {
251 251
             return $this->$method();
252 252
         }
253 253
     }
@@ -256,15 +256,15 @@  discard block
 block discarded – undo
256 256
      * @param string|null $type
257 257
      * @return mixed
258 258
      */
259
-    protected function getSchemaType($type = null)
259
+    protected function getSchemaType( $type = null )
260 260
     {
261
-        if (!is_string($type)) {
262
-            $type = $this->getSchemaOption('type', 'LocalBusiness');
261
+        if( !is_string( $type ) ) {
262
+            $type = $this->getSchemaOption( 'type', 'LocalBusiness' );
263 263
         }
264
-        $className = Helper::buildClassName($type, 'Modules\Schema');
265
-        return class_exists($className)
264
+        $className = Helper::buildClassName( $type, 'Modules\Schema' );
265
+        return class_exists( $className )
266 266
             ? new $className()
267
-            : new UnknownType($type);
267
+            : new UnknownType( $type );
268 268
     }
269 269
 
270 270
     /**
@@ -272,8 +272,8 @@  discard block
 block discarded – undo
272 272
      */
273 273
     protected function getThingDescription()
274 274
     {
275
-        $description = strip_shortcodes(wp_strip_all_tags(get_the_excerpt()));
276
-        return wp_trim_words($description, apply_filters('excerpt_length', 55));
275
+        $description = strip_shortcodes( wp_strip_all_tags( get_the_excerpt() ) );
276
+        return wp_trim_words( $description, apply_filters( 'excerpt_length', 55 ) );
277 277
     }
278 278
 
279 279
     /**
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
      */
282 282
     protected function getThingImage()
283 283
     {
284
-        return (string) get_the_post_thumbnail_url(null, 'large');
284
+        return (string)get_the_post_thumbnail_url( null, 'large' );
285 285
     }
286 286
 
287 287
     /**
@@ -297,6 +297,6 @@  discard block
 block discarded – undo
297 297
      */
298 298
     protected function getThingUrl()
299 299
     {
300
-        return (string) get_the_permalink();
300
+        return (string)get_the_permalink();
301 301
     }
302 302
 }
Please login to merge, or discard this patch.
plugin/Controllers/EditorController/Metaboxes.php 2 patches
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -7,33 +7,33 @@
 block discarded – undo
7 7
 
8 8
 class Metaboxes
9 9
 {
10
-    /**
11
-     * @param int $postId
12
-     * @return void
13
-     */
14
-    public function saveAssignedToMetabox($postId)
15
-    {
16
-        if (!wp_verify_nonce(Helper::filterInput('_nonce-assigned-to'), 'assigned_to')) {
17
-            return;
18
-        }
19
-        $assignedTo = strval(Helper::filterInput('assigned_to'));
20
-        glsr(Database::class)->update($postId, 'assigned_to', $assignedTo);
21
-    }
10
+	/**
11
+	 * @param int $postId
12
+	 * @return void
13
+	 */
14
+	public function saveAssignedToMetabox($postId)
15
+	{
16
+		if (!wp_verify_nonce(Helper::filterInput('_nonce-assigned-to'), 'assigned_to')) {
17
+			return;
18
+		}
19
+		$assignedTo = strval(Helper::filterInput('assigned_to'));
20
+		glsr(Database::class)->update($postId, 'assigned_to', $assignedTo);
21
+	}
22 22
 
23
-    /**
24
-     * @param int $postId
25
-     * @return mixed
26
-     */
27
-    public function saveResponseMetabox($postId)
28
-    {
29
-        if (!wp_verify_nonce(Helper::filterInput('_nonce-response'), 'response')) {
30
-            return;
31
-        }
32
-        $response = strval(Helper::filterInput('response'));
33
-        glsr(Database::class)->update($postId, 'response', trim(wp_kses($response, [
34
-            'a' => ['href' => [], 'title' => []],
35
-            'em' => [],
36
-            'strong' => [],
37
-        ])));
38
-    }
23
+	/**
24
+	 * @param int $postId
25
+	 * @return mixed
26
+	 */
27
+	public function saveResponseMetabox($postId)
28
+	{
29
+		if (!wp_verify_nonce(Helper::filterInput('_nonce-response'), 'response')) {
30
+			return;
31
+		}
32
+		$response = strval(Helper::filterInput('response'));
33
+		glsr(Database::class)->update($postId, 'response', trim(wp_kses($response, [
34
+			'a' => ['href' => [], 'title' => []],
35
+			'em' => [],
36
+			'strong' => [],
37
+		])));
38
+	}
39 39
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -11,29 +11,29 @@
 block discarded – undo
11 11
      * @param int $postId
12 12
      * @return void
13 13
      */
14
-    public function saveAssignedToMetabox($postId)
14
+    public function saveAssignedToMetabox( $postId )
15 15
     {
16
-        if (!wp_verify_nonce(Helper::filterInput('_nonce-assigned-to'), 'assigned_to')) {
16
+        if( !wp_verify_nonce( Helper::filterInput( '_nonce-assigned-to' ), 'assigned_to' ) ) {
17 17
             return;
18 18
         }
19
-        $assignedTo = strval(Helper::filterInput('assigned_to'));
20
-        glsr(Database::class)->update($postId, 'assigned_to', $assignedTo);
19
+        $assignedTo = strval( Helper::filterInput( 'assigned_to' ) );
20
+        glsr( Database::class )->update( $postId, 'assigned_to', $assignedTo );
21 21
     }
22 22
 
23 23
     /**
24 24
      * @param int $postId
25 25
      * @return mixed
26 26
      */
27
-    public function saveResponseMetabox($postId)
27
+    public function saveResponseMetabox( $postId )
28 28
     {
29
-        if (!wp_verify_nonce(Helper::filterInput('_nonce-response'), 'response')) {
29
+        if( !wp_verify_nonce( Helper::filterInput( '_nonce-response' ), 'response' ) ) {
30 30
             return;
31 31
         }
32
-        $response = strval(Helper::filterInput('response'));
33
-        glsr(Database::class)->update($postId, 'response', trim(wp_kses($response, [
32
+        $response = strval( Helper::filterInput( 'response' ) );
33
+        glsr( Database::class )->update( $postId, 'response', trim( wp_kses( $response, [
34 34
             'a' => ['href' => [], 'title' => []],
35 35
             'em' => [],
36 36
             'strong' => [],
37
-        ])));
37
+        ] ) ) );
38 38
     }
39 39
 }
Please login to merge, or discard this patch.
plugin/Controllers/BlocksController.php 2 patches
Indentation   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -8,85 +8,85 @@
 block discarded – undo
8 8
 
9 9
 class BlocksController extends Controller
10 10
 {
11
-    /**
12
-     * @param array $categories
13
-     * @return array
14
-     * @filter block_categories
15
-     */
16
-    public function filterBlockCategories($categories)
17
-    {
18
-        $categories = Arr::consolidateArray($categories);
19
-        $categories[] = [
20
-            'icon' => null,
21
-            'slug' => Application::ID,
22
-            'title' => glsr()->name,
23
-        ];
24
-        return $categories;
25
-    }
11
+	/**
12
+	 * @param array $categories
13
+	 * @return array
14
+	 * @filter block_categories
15
+	 */
16
+	public function filterBlockCategories($categories)
17
+	{
18
+		$categories = Arr::consolidateArray($categories);
19
+		$categories[] = [
20
+			'icon' => null,
21
+			'slug' => Application::ID,
22
+			'title' => glsr()->name,
23
+		];
24
+		return $categories;
25
+	}
26 26
 
27
-    /**
28
-     * @param array $editors
29
-     * @param string $postType
30
-     * @return array
31
-     * @filter classic_editor_enabled_editors_for_post_type
32
-     * @plugin classic-editor/classic-editor.php
33
-     */
34
-    public function filterEnabledEditors($editors, $postType)
35
-    {
36
-        return Application::POST_TYPE == $postType
37
-            ? ['block_editor' => false, 'classic_editor' => false]
38
-            : $editors;
39
-    }
27
+	/**
28
+	 * @param array $editors
29
+	 * @param string $postType
30
+	 * @return array
31
+	 * @filter classic_editor_enabled_editors_for_post_type
32
+	 * @plugin classic-editor/classic-editor.php
33
+	 */
34
+	public function filterEnabledEditors($editors, $postType)
35
+	{
36
+		return Application::POST_TYPE == $postType
37
+			? ['block_editor' => false, 'classic_editor' => false]
38
+			: $editors;
39
+	}
40 40
 
41
-    /**
42
-     * @param bool $bool
43
-     * @param string $postType
44
-     * @return bool
45
-     * @filter use_block_editor_for_post_type
46
-     */
47
-    public function filterUseBlockEditor($bool, $postType)
48
-    {
49
-        return Application::POST_TYPE == $postType
50
-            ? false
51
-            : $bool;
52
-    }
41
+	/**
42
+	 * @param bool $bool
43
+	 * @param string $postType
44
+	 * @return bool
45
+	 * @filter use_block_editor_for_post_type
46
+	 */
47
+	public function filterUseBlockEditor($bool, $postType)
48
+	{
49
+		return Application::POST_TYPE == $postType
50
+			? false
51
+			: $bool;
52
+	}
53 53
 
54
-    /**
55
-     * @return void
56
-     */
57
-    public function registerAssets()
58
-    {
59
-        wp_register_style(
60
-            Application::ID.'/blocks',
61
-            glsr()->url('assets/styles/'.Application::ID.'-blocks.css'),
62
-            ['wp-edit-blocks'],
63
-            glsr()->version
64
-        );
65
-        wp_register_script(
66
-            Application::ID.'/blocks',
67
-            glsr()->url('assets/scripts/'.Application::ID.'-blocks.js'),
68
-            ['wp-api-fetch', 'wp-blocks', 'wp-i18n', 'wp-editor', 'wp-element', Application::ID],
69
-            glsr()->version
70
-        );
71
-    }
54
+	/**
55
+	 * @return void
56
+	 */
57
+	public function registerAssets()
58
+	{
59
+		wp_register_style(
60
+			Application::ID.'/blocks',
61
+			glsr()->url('assets/styles/'.Application::ID.'-blocks.css'),
62
+			['wp-edit-blocks'],
63
+			glsr()->version
64
+		);
65
+		wp_register_script(
66
+			Application::ID.'/blocks',
67
+			glsr()->url('assets/scripts/'.Application::ID.'-blocks.js'),
68
+			['wp-api-fetch', 'wp-blocks', 'wp-i18n', 'wp-editor', 'wp-element', Application::ID],
69
+			glsr()->version
70
+		);
71
+	}
72 72
 
73
-    /**
74
-     * @return void
75
-     * @action init
76
-     */
77
-    public function registerBlocks()
78
-    {
79
-        $blocks = [
80
-            'form', 'reviews', 'summary',
81
-        ];
82
-        foreach ($blocks as $block) {
83
-            $id = str_replace('_reviews', '', Application::ID.'_'.$block);
84
-            $blockClass = Helper::buildClassName($id.'-block', 'Blocks');
85
-            if (!class_exists($blockClass)) {
86
-                glsr_log()->error(sprintf('Class missing (%s)', $blockClass));
87
-                continue;
88
-            }
89
-            glsr($blockClass)->register($block);
90
-        }
91
-    }
73
+	/**
74
+	 * @return void
75
+	 * @action init
76
+	 */
77
+	public function registerBlocks()
78
+	{
79
+		$blocks = [
80
+			'form', 'reviews', 'summary',
81
+		];
82
+		foreach ($blocks as $block) {
83
+			$id = str_replace('_reviews', '', Application::ID.'_'.$block);
84
+			$blockClass = Helper::buildClassName($id.'-block', 'Blocks');
85
+			if (!class_exists($blockClass)) {
86
+				glsr_log()->error(sprintf('Class missing (%s)', $blockClass));
87
+				continue;
88
+			}
89
+			glsr($blockClass)->register($block);
90
+		}
91
+	}
92 92
 }
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -13,9 +13,9 @@  discard block
 block discarded – undo
13 13
      * @return array
14 14
      * @filter block_categories
15 15
      */
16
-    public function filterBlockCategories($categories)
16
+    public function filterBlockCategories( $categories )
17 17
     {
18
-        $categories = Arr::consolidateArray($categories);
18
+        $categories = Arr::consolidateArray( $categories );
19 19
         $categories[] = [
20 20
             'icon' => null,
21 21
             'slug' => Application::ID,
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
      * @filter classic_editor_enabled_editors_for_post_type
32 32
      * @plugin classic-editor/classic-editor.php
33 33
      */
34
-    public function filterEnabledEditors($editors, $postType)
34
+    public function filterEnabledEditors( $editors, $postType )
35 35
     {
36 36
         return Application::POST_TYPE == $postType
37 37
             ? ['block_editor' => false, 'classic_editor' => false]
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
      * @return bool
45 45
      * @filter use_block_editor_for_post_type
46 46
      */
47
-    public function filterUseBlockEditor($bool, $postType)
47
+    public function filterUseBlockEditor( $bool, $postType )
48 48
     {
49 49
         return Application::POST_TYPE == $postType
50 50
             ? false
@@ -58,13 +58,13 @@  discard block
 block discarded – undo
58 58
     {
59 59
         wp_register_style(
60 60
             Application::ID.'/blocks',
61
-            glsr()->url('assets/styles/'.Application::ID.'-blocks.css'),
61
+            glsr()->url( 'assets/styles/'.Application::ID.'-blocks.css' ),
62 62
             ['wp-edit-blocks'],
63 63
             glsr()->version
64 64
         );
65 65
         wp_register_script(
66 66
             Application::ID.'/blocks',
67
-            glsr()->url('assets/scripts/'.Application::ID.'-blocks.js'),
67
+            glsr()->url( 'assets/scripts/'.Application::ID.'-blocks.js' ),
68 68
             ['wp-api-fetch', 'wp-blocks', 'wp-i18n', 'wp-editor', 'wp-element', Application::ID],
69 69
             glsr()->version
70 70
         );
@@ -79,14 +79,14 @@  discard block
 block discarded – undo
79 79
         $blocks = [
80 80
             'form', 'reviews', 'summary',
81 81
         ];
82
-        foreach ($blocks as $block) {
83
-            $id = str_replace('_reviews', '', Application::ID.'_'.$block);
84
-            $blockClass = Helper::buildClassName($id.'-block', 'Blocks');
85
-            if (!class_exists($blockClass)) {
86
-                glsr_log()->error(sprintf('Class missing (%s)', $blockClass));
82
+        foreach( $blocks as $block ) {
83
+            $id = str_replace( '_reviews', '', Application::ID.'_'.$block );
84
+            $blockClass = Helper::buildClassName( $id.'-block', 'Blocks' );
85
+            if( !class_exists( $blockClass ) ) {
86
+                glsr_log()->error( sprintf( 'Class missing (%s)', $blockClass ) );
87 87
                 continue;
88 88
             }
89
-            glsr($blockClass)->register($block);
89
+            glsr( $blockClass )->register( $block );
90 90
         }
91 91
     }
92 92
 }
Please login to merge, or discard this patch.
plugin/Handlers/RegisterShortcodes.php 2 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -7,18 +7,18 @@
 block discarded – undo
7 7
 
8 8
 class RegisterShortcodes
9 9
 {
10
-    /**
11
-     * @return void
12
-     */
13
-    public function handle(Command $command)
14
-    {
15
-        foreach ($command->shortcodes as $shortcode) {
16
-            $shortcodeClass = Helper::buildClassName($shortcode.'-shortcode', 'Shortcodes');
17
-            if (!class_exists($shortcodeClass)) {
18
-                glsr_log()->error(sprintf('Class missing (%s)', $shortcodeClass));
19
-                continue;
20
-            }
21
-            add_shortcode($shortcode, [glsr($shortcodeClass), 'buildShortcode']);
22
-        }
23
-    }
10
+	/**
11
+	 * @return void
12
+	 */
13
+	public function handle(Command $command)
14
+	{
15
+		foreach ($command->shortcodes as $shortcode) {
16
+			$shortcodeClass = Helper::buildClassName($shortcode.'-shortcode', 'Shortcodes');
17
+			if (!class_exists($shortcodeClass)) {
18
+				glsr_log()->error(sprintf('Class missing (%s)', $shortcodeClass));
19
+				continue;
20
+			}
21
+			add_shortcode($shortcode, [glsr($shortcodeClass), 'buildShortcode']);
22
+		}
23
+	}
24 24
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -10,15 +10,15 @@
 block discarded – undo
10 10
     /**
11 11
      * @return void
12 12
      */
13
-    public function handle(Command $command)
13
+    public function handle( Command $command )
14 14
     {
15
-        foreach ($command->shortcodes as $shortcode) {
16
-            $shortcodeClass = Helper::buildClassName($shortcode.'-shortcode', 'Shortcodes');
17
-            if (!class_exists($shortcodeClass)) {
18
-                glsr_log()->error(sprintf('Class missing (%s)', $shortcodeClass));
15
+        foreach( $command->shortcodes as $shortcode ) {
16
+            $shortcodeClass = Helper::buildClassName( $shortcode.'-shortcode', 'Shortcodes' );
17
+            if( !class_exists( $shortcodeClass ) ) {
18
+                glsr_log()->error( sprintf( 'Class missing (%s)', $shortcodeClass ) );
19 19
                 continue;
20 20
             }
21
-            add_shortcode($shortcode, [glsr($shortcodeClass), 'buildShortcode']);
21
+            add_shortcode( $shortcode, [glsr( $shortcodeClass ), 'buildShortcode'] );
22 22
         }
23 23
     }
24 24
 }
Please login to merge, or discard this patch.
plugin/Handlers/RegisterTinymcePopups.php 2 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -7,22 +7,22 @@
 block discarded – undo
7 7
 
8 8
 class RegisterTinymcePopups
9 9
 {
10
-    /**
11
-     * @return void
12
-     */
13
-    public function handle(Command $command)
14
-    {
15
-        foreach ($command->popups as $slug => $label) {
16
-            $buttonClass = Helper::buildClassName($slug.'-popup', 'Shortcodes');
17
-            if (!class_exists($buttonClass)) {
18
-                glsr_log()->error(sprintf('Class missing (%s)', $buttonClass));
19
-                continue;
20
-            }
21
-            $shortcode = glsr($buttonClass)->register($slug, [
22
-                'label' => $label,
23
-                'title' => $label,
24
-            ]);
25
-            glsr()->mceShortcodes[$slug] = $shortcode->properties;
26
-        }
27
-    }
10
+	/**
11
+	 * @return void
12
+	 */
13
+	public function handle(Command $command)
14
+	{
15
+		foreach ($command->popups as $slug => $label) {
16
+			$buttonClass = Helper::buildClassName($slug.'-popup', 'Shortcodes');
17
+			if (!class_exists($buttonClass)) {
18
+				glsr_log()->error(sprintf('Class missing (%s)', $buttonClass));
19
+				continue;
20
+			}
21
+			$shortcode = glsr($buttonClass)->register($slug, [
22
+				'label' => $label,
23
+				'title' => $label,
24
+			]);
25
+			glsr()->mceShortcodes[$slug] = $shortcode->properties;
26
+		}
27
+	}
28 28
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -10,18 +10,18 @@
 block discarded – undo
10 10
     /**
11 11
      * @return void
12 12
      */
13
-    public function handle(Command $command)
13
+    public function handle( Command $command )
14 14
     {
15
-        foreach ($command->popups as $slug => $label) {
16
-            $buttonClass = Helper::buildClassName($slug.'-popup', 'Shortcodes');
17
-            if (!class_exists($buttonClass)) {
18
-                glsr_log()->error(sprintf('Class missing (%s)', $buttonClass));
15
+        foreach( $command->popups as $slug => $label ) {
16
+            $buttonClass = Helper::buildClassName( $slug.'-popup', 'Shortcodes' );
17
+            if( !class_exists( $buttonClass ) ) {
18
+                glsr_log()->error( sprintf( 'Class missing (%s)', $buttonClass ) );
19 19
                 continue;
20 20
             }
21
-            $shortcode = glsr($buttonClass)->register($slug, [
21
+            $shortcode = glsr( $buttonClass )->register( $slug, [
22 22
                 'label' => $label,
23 23
                 'title' => $label,
24
-            ]);
24
+            ] );
25 25
             glsr()->mceShortcodes[$slug] = $shortcode->properties;
26 26
         }
27 27
     }
Please login to merge, or discard this patch.
plugin/Handlers/RegisterWidgets.php 2 patches
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -8,21 +8,21 @@
 block discarded – undo
8 8
 
9 9
 class RegisterWidgets
10 10
 {
11
-    /**
12
-     * @return void
13
-     */
14
-    public function handle(Command $command)
15
-    {
16
-        global $wp_widget_factory;
17
-        foreach ($command->widgets as $key => $values) {
18
-            $widgetClass = Helper::buildClassName($key.'-widget', 'Widgets');
19
-            if (!class_exists($widgetClass)) {
20
-                glsr_log()->error(sprintf('Class missing (%s)', $widgetClass));
21
-                continue;
22
-            }
23
-            // Here we bypass register_widget() in order to pass our custom values to the widget
24
-            $widget = new $widgetClass(Application::ID.'_'.$key, $values['title'], $values);
25
-            $wp_widget_factory->widgets[$widgetClass] = $widget;
26
-        }
27
-    }
11
+	/**
12
+	 * @return void
13
+	 */
14
+	public function handle(Command $command)
15
+	{
16
+		global $wp_widget_factory;
17
+		foreach ($command->widgets as $key => $values) {
18
+			$widgetClass = Helper::buildClassName($key.'-widget', 'Widgets');
19
+			if (!class_exists($widgetClass)) {
20
+				glsr_log()->error(sprintf('Class missing (%s)', $widgetClass));
21
+				continue;
22
+			}
23
+			// Here we bypass register_widget() in order to pass our custom values to the widget
24
+			$widget = new $widgetClass(Application::ID.'_'.$key, $values['title'], $values);
25
+			$wp_widget_factory->widgets[$widgetClass] = $widget;
26
+		}
27
+	}
28 28
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -11,17 +11,17 @@
 block discarded – undo
11 11
     /**
12 12
      * @return void
13 13
      */
14
-    public function handle(Command $command)
14
+    public function handle( Command $command )
15 15
     {
16 16
         global $wp_widget_factory;
17
-        foreach ($command->widgets as $key => $values) {
18
-            $widgetClass = Helper::buildClassName($key.'-widget', 'Widgets');
19
-            if (!class_exists($widgetClass)) {
20
-                glsr_log()->error(sprintf('Class missing (%s)', $widgetClass));
17
+        foreach( $command->widgets as $key => $values ) {
18
+            $widgetClass = Helper::buildClassName( $key.'-widget', 'Widgets' );
19
+            if( !class_exists( $widgetClass ) ) {
20
+                glsr_log()->error( sprintf( 'Class missing (%s)', $widgetClass ) );
21 21
                 continue;
22 22
             }
23 23
             // Here we bypass register_widget() in order to pass our custom values to the widget
24
-            $widget = new $widgetClass(Application::ID.'_'.$key, $values['title'], $values);
24
+            $widget = new $widgetClass( Application::ID.'_'.$key, $values['title'], $values );
25 25
             $wp_widget_factory->widgets[$widgetClass] = $widget;
26 26
         }
27 27
     }
Please login to merge, or discard this patch.
plugin/Database/DefaultsManager.php 2 patches
Indentation   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -6,60 +6,60 @@
 block discarded – undo
6 6
 
7 7
 class DefaultsManager
8 8
 {
9
-    /**
10
-     * @return array
11
-     */
12
-    public function defaults()
13
-    {
14
-        $settings = $this->settings();
15
-        $defaults = (array) array_combine(array_keys($settings), glsr_array_column($settings, 'default'));
16
-        return wp_parse_args($defaults, [
17
-            'version' => '',
18
-            'version_upgraded_from' => '',
19
-        ]);
20
-    }
9
+	/**
10
+	 * @return array
11
+	 */
12
+	public function defaults()
13
+	{
14
+		$settings = $this->settings();
15
+		$defaults = (array) array_combine(array_keys($settings), glsr_array_column($settings, 'default'));
16
+		return wp_parse_args($defaults, [
17
+			'version' => '',
18
+			'version_upgraded_from' => '',
19
+		]);
20
+	}
21 21
 
22
-    /**
23
-     * @return array
24
-     */
25
-    public function get()
26
-    {
27
-        return Arr::convertDotNotationArray($this->defaults());
28
-    }
22
+	/**
23
+	 * @return array
24
+	 */
25
+	public function get()
26
+	{
27
+		return Arr::convertDotNotationArray($this->defaults());
28
+	}
29 29
 
30
-    /**
31
-     * @return array
32
-     */
33
-    public function set()
34
-    {
35
-        $settings = glsr(OptionManager::class)->all();
36
-        $currentSettings = Arr::removeEmptyArrayValues($settings);
37
-        $defaultSettings = array_replace_recursive($this->get(), $currentSettings);
38
-        $updatedSettings = array_replace_recursive($settings, $defaultSettings);
39
-        update_option(OptionManager::databaseKey(), $updatedSettings);
40
-        return $defaultSettings;
41
-    }
30
+	/**
31
+	 * @return array
32
+	 */
33
+	public function set()
34
+	{
35
+		$settings = glsr(OptionManager::class)->all();
36
+		$currentSettings = Arr::removeEmptyArrayValues($settings);
37
+		$defaultSettings = array_replace_recursive($this->get(), $currentSettings);
38
+		$updatedSettings = array_replace_recursive($settings, $defaultSettings);
39
+		update_option(OptionManager::databaseKey(), $updatedSettings);
40
+		return $defaultSettings;
41
+	}
42 42
 
43
-    /**
44
-     * @return array
45
-     */
46
-    public function settings()
47
-    {
48
-        $settings = apply_filters('site-reviews/addon/settings', glsr()->config('settings'));
49
-        return $this->normalize($settings);
50
-    }
43
+	/**
44
+	 * @return array
45
+	 */
46
+	public function settings()
47
+	{
48
+		$settings = apply_filters('site-reviews/addon/settings', glsr()->config('settings'));
49
+		return $this->normalize($settings);
50
+	}
51 51
 
52
-    /**
53
-     * @return array
54
-     */
55
-    protected function normalize(array $settings)
56
-    {
57
-        array_walk($settings, function (&$setting) {
58
-            if (isset($setting['default'])) {
59
-                return;
60
-            }
61
-            $setting['default'] = '';
62
-        });
63
-        return $settings;
64
-    }
52
+	/**
53
+	 * @return array
54
+	 */
55
+	protected function normalize(array $settings)
56
+	{
57
+		array_walk($settings, function (&$setting) {
58
+			if (isset($setting['default'])) {
59
+				return;
60
+			}
61
+			$setting['default'] = '';
62
+		});
63
+		return $settings;
64
+	}
65 65
 }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -12,11 +12,11 @@  discard block
 block discarded – undo
12 12
     public function defaults()
13 13
     {
14 14
         $settings = $this->settings();
15
-        $defaults = (array) array_combine(array_keys($settings), glsr_array_column($settings, 'default'));
16
-        return wp_parse_args($defaults, [
15
+        $defaults = (array)array_combine( array_keys( $settings ), glsr_array_column( $settings, 'default' ) );
16
+        return wp_parse_args( $defaults, [
17 17
             'version' => '',
18 18
             'version_upgraded_from' => '',
19
-        ]);
19
+        ] );
20 20
     }
21 21
 
22 22
     /**
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
      */
25 25
     public function get()
26 26
     {
27
-        return Arr::convertDotNotationArray($this->defaults());
27
+        return Arr::convertDotNotationArray( $this->defaults() );
28 28
     }
29 29
 
30 30
     /**
@@ -32,11 +32,11 @@  discard block
 block discarded – undo
32 32
      */
33 33
     public function set()
34 34
     {
35
-        $settings = glsr(OptionManager::class)->all();
36
-        $currentSettings = Arr::removeEmptyArrayValues($settings);
37
-        $defaultSettings = array_replace_recursive($this->get(), $currentSettings);
38
-        $updatedSettings = array_replace_recursive($settings, $defaultSettings);
39
-        update_option(OptionManager::databaseKey(), $updatedSettings);
35
+        $settings = glsr( OptionManager::class )->all();
36
+        $currentSettings = Arr::removeEmptyArrayValues( $settings );
37
+        $defaultSettings = array_replace_recursive( $this->get(), $currentSettings );
38
+        $updatedSettings = array_replace_recursive( $settings, $defaultSettings );
39
+        update_option( OptionManager::databaseKey(), $updatedSettings );
40 40
         return $defaultSettings;
41 41
     }
42 42
 
@@ -45,17 +45,17 @@  discard block
 block discarded – undo
45 45
      */
46 46
     public function settings()
47 47
     {
48
-        $settings = apply_filters('site-reviews/addon/settings', glsr()->config('settings'));
49
-        return $this->normalize($settings);
48
+        $settings = apply_filters( 'site-reviews/addon/settings', glsr()->config( 'settings' ) );
49
+        return $this->normalize( $settings );
50 50
     }
51 51
 
52 52
     /**
53 53
      * @return array
54 54
      */
55
-    protected function normalize(array $settings)
55
+    protected function normalize( array $settings )
56 56
     {
57
-        array_walk($settings, function (&$setting) {
58
-            if (isset($setting['default'])) {
57
+        array_walk( $settings, function( &$setting ) {
58
+            if( isset($setting['default']) ) {
59 59
                 return;
60 60
             }
61 61
             $setting['default'] = '';
Please login to merge, or discard this patch.
plugin/Database/OptionManager.php 2 patches
Indentation   +138 added lines, -138 removed lines patch added patch discarded remove patch
@@ -9,153 +9,153 @@
 block discarded – undo
9 9
 
10 10
 class OptionManager
11 11
 {
12
-    /**
13
-     * @var array
14
-     */
15
-    protected $options;
12
+	/**
13
+	 * @var array
14
+	 */
15
+	protected $options;
16 16
 
17
-    /**
18
-     * @return string
19
-     */
20
-    public static function databaseKey($version = null)
21
-    {
22
-        if (null === $version) {
23
-            $version = explode('.', glsr()->version);
24
-            $version = array_shift($version);
25
-        }
26
-        return Str::snakeCase(
27
-            Application::ID.'-v'.intval($version)
28
-        );
29
-    }
17
+	/**
18
+	 * @return string
19
+	 */
20
+	public static function databaseKey($version = null)
21
+	{
22
+		if (null === $version) {
23
+			$version = explode('.', glsr()->version);
24
+			$version = array_shift($version);
25
+		}
26
+		return Str::snakeCase(
27
+			Application::ID.'-v'.intval($version)
28
+		);
29
+	}
30 30
 
31
-    /**
32
-     * @return array
33
-     */
34
-    public function all()
35
-    {
36
-        if (empty($this->options)) {
37
-            $this->reset();
38
-        }
39
-        return $this->options;
40
-    }
31
+	/**
32
+	 * @return array
33
+	 */
34
+	public function all()
35
+	{
36
+		if (empty($this->options)) {
37
+			$this->reset();
38
+		}
39
+		return $this->options;
40
+	}
41 41
 
42
-    /**
43
-     * @param string $path
44
-     * @return bool
45
-     */
46
-    public function delete($path)
47
-    {
48
-        $keys = explode('.', $path);
49
-        $last = array_pop($keys);
50
-        $options = $this->all();
51
-        $pointer = &$options;
52
-        foreach ($keys as $key) {
53
-            if (!isset($pointer[$key]) || !is_array($pointer[$key])) {
54
-                continue;
55
-            }
56
-            $pointer = &$pointer[$key];
57
-        }
58
-        unset($pointer[$last]);
59
-        return $this->set($options);
60
-    }
42
+	/**
43
+	 * @param string $path
44
+	 * @return bool
45
+	 */
46
+	public function delete($path)
47
+	{
48
+		$keys = explode('.', $path);
49
+		$last = array_pop($keys);
50
+		$options = $this->all();
51
+		$pointer = &$options;
52
+		foreach ($keys as $key) {
53
+			if (!isset($pointer[$key]) || !is_array($pointer[$key])) {
54
+				continue;
55
+			}
56
+			$pointer = &$pointer[$key];
57
+		}
58
+		unset($pointer[$last]);
59
+		return $this->set($options);
60
+	}
61 61
 
62
-    /**
63
-     * @param string $path
64
-     * @param mixed $fallback
65
-     * @param string $cast
66
-     * @return mixed
67
-     */
68
-    public function get($path = '', $fallback = '', $cast = '')
69
-    {
70
-        $result = Arr::get($this->all(), $path, $fallback);
71
-        return Helper::castTo($cast, $result);
72
-    }
62
+	/**
63
+	 * @param string $path
64
+	 * @param mixed $fallback
65
+	 * @param string $cast
66
+	 * @return mixed
67
+	 */
68
+	public function get($path = '', $fallback = '', $cast = '')
69
+	{
70
+		$result = Arr::get($this->all(), $path, $fallback);
71
+		return Helper::castTo($cast, $result);
72
+	}
73 73
 
74
-    /**
75
-     * @param string $path
76
-     * @return bool
77
-     */
78
-    public function getBool($path)
79
-    {
80
-        return Helper::castTo('bool', $this->get($path));
81
-    }
74
+	/**
75
+	 * @param string $path
76
+	 * @return bool
77
+	 */
78
+	public function getBool($path)
79
+	{
80
+		return Helper::castTo('bool', $this->get($path));
81
+	}
82 82
 
83
-    /**
84
-     * @param string $path
85
-     * @param mixed $fallback
86
-     * @param string $cast
87
-     * @return mixed
88
-     */
89
-    public function getWP($path, $fallback = '', $cast = '')
90
-    {
91
-        $option = get_option($path, $fallback);
92
-        if (empty($option)) {
93
-            $option = $fallback;
94
-        }
95
-        return Helper::castTo($cast, $option);
96
-    }
83
+	/**
84
+	 * @param string $path
85
+	 * @param mixed $fallback
86
+	 * @param string $cast
87
+	 * @return mixed
88
+	 */
89
+	public function getWP($path, $fallback = '', $cast = '')
90
+	{
91
+		$option = get_option($path, $fallback);
92
+		if (empty($option)) {
93
+			$option = $fallback;
94
+		}
95
+		return Helper::castTo($cast, $option);
96
+	}
97 97
 
98
-    /**
99
-     * @return string
100
-     */
101
-    public function json()
102
-    {
103
-        return json_encode($this->all());
104
-    }
98
+	/**
99
+	 * @return string
100
+	 */
101
+	public function json()
102
+	{
103
+		return json_encode($this->all());
104
+	}
105 105
 
106
-    /**
107
-     * @return array
108
-     */
109
-    public function normalize(array $options = [])
110
-    {
111
-        $options = wp_parse_args(
112
-            Arr::flattenArray($options),
113
-            glsr(DefaultsManager::class)->defaults()
114
-        );
115
-        array_walk($options, function (&$value) {
116
-            if (!is_string($value)) {
117
-                return;
118
-            }
119
-            $value = wp_kses($value, wp_kses_allowed_html('post'));
120
-        });
121
-        return Arr::convertDotNotationArray($options);
122
-    }
106
+	/**
107
+	 * @return array
108
+	 */
109
+	public function normalize(array $options = [])
110
+	{
111
+		$options = wp_parse_args(
112
+			Arr::flattenArray($options),
113
+			glsr(DefaultsManager::class)->defaults()
114
+		);
115
+		array_walk($options, function (&$value) {
116
+			if (!is_string($value)) {
117
+				return;
118
+			}
119
+			$value = wp_kses($value, wp_kses_allowed_html('post'));
120
+		});
121
+		return Arr::convertDotNotationArray($options);
122
+	}
123 123
 
124
-    /**
125
-     * @return bool
126
-     */
127
-    public function isRecaptchaEnabled()
128
-    {
129
-        $integration = $this->get('settings.submissions.recaptcha.integration');
130
-        return 'all' == $integration || ('guest' == $integration && !is_user_logged_in());
131
-    }
124
+	/**
125
+	 * @return bool
126
+	 */
127
+	public function isRecaptchaEnabled()
128
+	{
129
+		$integration = $this->get('settings.submissions.recaptcha.integration');
130
+		return 'all' == $integration || ('guest' == $integration && !is_user_logged_in());
131
+	}
132 132
 
133
-    /**
134
-     * @return array
135
-     */
136
-    public function reset()
137
-    {
138
-        $options = $this->getWP(static::databaseKey(), []);
139
-        if (!is_array($options) || empty($options)) {
140
-            delete_option(static::databaseKey());
141
-            $options = glsr()->defaults ?: [];
142
-        }
143
-        $this->options = $options;
144
-    }
133
+	/**
134
+	 * @return array
135
+	 */
136
+	public function reset()
137
+	{
138
+		$options = $this->getWP(static::databaseKey(), []);
139
+		if (!is_array($options) || empty($options)) {
140
+			delete_option(static::databaseKey());
141
+			$options = glsr()->defaults ?: [];
142
+		}
143
+		$this->options = $options;
144
+	}
145 145
 
146
-    /**
147
-     * @param string|array $pathOrOptions
148
-     * @param mixed $value
149
-     * @return bool
150
-     */
151
-    public function set($pathOrOptions, $value = '')
152
-    {
153
-        if (is_string($pathOrOptions)) {
154
-            $pathOrOptions = Arr::set($this->all(), $pathOrOptions, $value);
155
-        }
156
-        if ($result = update_option(static::databaseKey(), (array) $pathOrOptions)) {
157
-            $this->reset();
158
-        }
159
-        return $result;
160
-    }
146
+	/**
147
+	 * @param string|array $pathOrOptions
148
+	 * @param mixed $value
149
+	 * @return bool
150
+	 */
151
+	public function set($pathOrOptions, $value = '')
152
+	{
153
+		if (is_string($pathOrOptions)) {
154
+			$pathOrOptions = Arr::set($this->all(), $pathOrOptions, $value);
155
+		}
156
+		if ($result = update_option(static::databaseKey(), (array) $pathOrOptions)) {
157
+			$this->reset();
158
+		}
159
+		return $result;
160
+	}
161 161
 }
Please login to merge, or discard this patch.
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -17,14 +17,14 @@  discard block
 block discarded – undo
17 17
     /**
18 18
      * @return string
19 19
      */
20
-    public static function databaseKey($version = null)
20
+    public static function databaseKey( $version = null )
21 21
     {
22
-        if (null === $version) {
23
-            $version = explode('.', glsr()->version);
24
-            $version = array_shift($version);
22
+        if( null === $version ) {
23
+            $version = explode( '.', glsr()->version );
24
+            $version = array_shift( $version );
25 25
         }
26 26
         return Str::snakeCase(
27
-            Application::ID.'-v'.intval($version)
27
+            Application::ID.'-v'.intval( $version )
28 28
         );
29 29
     }
30 30
 
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
      */
34 34
     public function all()
35 35
     {
36
-        if (empty($this->options)) {
36
+        if( empty($this->options) ) {
37 37
             $this->reset();
38 38
         }
39 39
         return $this->options;
@@ -43,20 +43,20 @@  discard block
 block discarded – undo
43 43
      * @param string $path
44 44
      * @return bool
45 45
      */
46
-    public function delete($path)
46
+    public function delete( $path )
47 47
     {
48
-        $keys = explode('.', $path);
49
-        $last = array_pop($keys);
48
+        $keys = explode( '.', $path );
49
+        $last = array_pop( $keys );
50 50
         $options = $this->all();
51 51
         $pointer = &$options;
52
-        foreach ($keys as $key) {
53
-            if (!isset($pointer[$key]) || !is_array($pointer[$key])) {
52
+        foreach( $keys as $key ) {
53
+            if( !isset($pointer[$key]) || !is_array( $pointer[$key] ) ) {
54 54
                 continue;
55 55
             }
56 56
             $pointer = &$pointer[$key];
57 57
         }
58 58
         unset($pointer[$last]);
59
-        return $this->set($options);
59
+        return $this->set( $options );
60 60
     }
61 61
 
62 62
     /**
@@ -65,19 +65,19 @@  discard block
 block discarded – undo
65 65
      * @param string $cast
66 66
      * @return mixed
67 67
      */
68
-    public function get($path = '', $fallback = '', $cast = '')
68
+    public function get( $path = '', $fallback = '', $cast = '' )
69 69
     {
70
-        $result = Arr::get($this->all(), $path, $fallback);
71
-        return Helper::castTo($cast, $result);
70
+        $result = Arr::get( $this->all(), $path, $fallback );
71
+        return Helper::castTo( $cast, $result );
72 72
     }
73 73
 
74 74
     /**
75 75
      * @param string $path
76 76
      * @return bool
77 77
      */
78
-    public function getBool($path)
78
+    public function getBool( $path )
79 79
     {
80
-        return Helper::castTo('bool', $this->get($path));
80
+        return Helper::castTo( 'bool', $this->get( $path ) );
81 81
     }
82 82
 
83 83
     /**
@@ -86,13 +86,13 @@  discard block
 block discarded – undo
86 86
      * @param string $cast
87 87
      * @return mixed
88 88
      */
89
-    public function getWP($path, $fallback = '', $cast = '')
89
+    public function getWP( $path, $fallback = '', $cast = '' )
90 90
     {
91
-        $option = get_option($path, $fallback);
92
-        if (empty($option)) {
91
+        $option = get_option( $path, $fallback );
92
+        if( empty($option) ) {
93 93
             $option = $fallback;
94 94
         }
95
-        return Helper::castTo($cast, $option);
95
+        return Helper::castTo( $cast, $option );
96 96
     }
97 97
 
98 98
     /**
@@ -100,25 +100,25 @@  discard block
 block discarded – undo
100 100
      */
101 101
     public function json()
102 102
     {
103
-        return json_encode($this->all());
103
+        return json_encode( $this->all() );
104 104
     }
105 105
 
106 106
     /**
107 107
      * @return array
108 108
      */
109
-    public function normalize(array $options = [])
109
+    public function normalize( array $options = [] )
110 110
     {
111 111
         $options = wp_parse_args(
112
-            Arr::flattenArray($options),
113
-            glsr(DefaultsManager::class)->defaults()
112
+            Arr::flattenArray( $options ),
113
+            glsr( DefaultsManager::class )->defaults()
114 114
         );
115
-        array_walk($options, function (&$value) {
116
-            if (!is_string($value)) {
115
+        array_walk( $options, function( &$value ) {
116
+            if( !is_string( $value ) ) {
117 117
                 return;
118 118
             }
119
-            $value = wp_kses($value, wp_kses_allowed_html('post'));
119
+            $value = wp_kses( $value, wp_kses_allowed_html( 'post' ) );
120 120
         });
121
-        return Arr::convertDotNotationArray($options);
121
+        return Arr::convertDotNotationArray( $options );
122 122
     }
123 123
 
124 124
     /**
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
      */
127 127
     public function isRecaptchaEnabled()
128 128
     {
129
-        $integration = $this->get('settings.submissions.recaptcha.integration');
129
+        $integration = $this->get( 'settings.submissions.recaptcha.integration' );
130 130
         return 'all' == $integration || ('guest' == $integration && !is_user_logged_in());
131 131
     }
132 132
 
@@ -135,9 +135,9 @@  discard block
 block discarded – undo
135 135
      */
136 136
     public function reset()
137 137
     {
138
-        $options = $this->getWP(static::databaseKey(), []);
139
-        if (!is_array($options) || empty($options)) {
140
-            delete_option(static::databaseKey());
138
+        $options = $this->getWP( static::databaseKey(), [] );
139
+        if( !is_array( $options ) || empty($options) ) {
140
+            delete_option( static::databaseKey() );
141 141
             $options = glsr()->defaults ?: [];
142 142
         }
143 143
         $this->options = $options;
@@ -148,12 +148,12 @@  discard block
 block discarded – undo
148 148
      * @param mixed $value
149 149
      * @return bool
150 150
      */
151
-    public function set($pathOrOptions, $value = '')
151
+    public function set( $pathOrOptions, $value = '' )
152 152
     {
153
-        if (is_string($pathOrOptions)) {
154
-            $pathOrOptions = Arr::set($this->all(), $pathOrOptions, $value);
153
+        if( is_string( $pathOrOptions ) ) {
154
+            $pathOrOptions = Arr::set( $this->all(), $pathOrOptions, $value );
155 155
         }
156
-        if ($result = update_option(static::databaseKey(), (array) $pathOrOptions)) {
156
+        if( $result = update_option( static::databaseKey(), (array)$pathOrOptions ) ) {
157 157
             $this->reset();
158 158
         }
159 159
         return $result;
Please login to merge, or discard this patch.
plugin/Commands/RegisterPostType.php 2 patches
Indentation   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -9,77 +9,77 @@
 block discarded – undo
9 9
 
10 10
 class RegisterPostType
11 11
 {
12
-    public $args;
13
-    public $columns;
14
-    public $plural;
15
-    public $postType;
16
-    public $single;
12
+	public $args;
13
+	public $columns;
14
+	public $plural;
15
+	public $postType;
16
+	public $single;
17 17
 
18
-    public function __construct($input)
19
-    {
20
-        $args = glsr(PostTypeDefaults::class)->merge($input);
21
-        $this->normalize($args);
22
-        $this->normalizeColumns();
23
-        $this->normalizeLabels();
24
-    }
18
+	public function __construct($input)
19
+	{
20
+		$args = glsr(PostTypeDefaults::class)->merge($input);
21
+		$this->normalize($args);
22
+		$this->normalizeColumns();
23
+		$this->normalizeLabels();
24
+	}
25 25
 
26
-    /**
27
-     * @return void
28
-     */
29
-    protected function normalize(array $args)
30
-    {
31
-        foreach ($args as $key => $value) {
32
-            $property = Helper::buildPropertyName($key);
33
-            if (!property_exists($this, $property)) {
34
-                continue;
35
-            }
36
-            $this->$property = $value;
37
-            unset($args[$key]);
38
-        }
39
-        $this->args = wp_parse_args($args, [
40
-            'menu_name' => $this->plural,
41
-        ]);
42
-    }
26
+	/**
27
+	 * @return void
28
+	 */
29
+	protected function normalize(array $args)
30
+	{
31
+		foreach ($args as $key => $value) {
32
+			$property = Helper::buildPropertyName($key);
33
+			if (!property_exists($this, $property)) {
34
+				continue;
35
+			}
36
+			$this->$property = $value;
37
+			unset($args[$key]);
38
+		}
39
+		$this->args = wp_parse_args($args, [
40
+			'menu_name' => $this->plural,
41
+		]);
42
+	}
43 43
 
44
-    /**
45
-     * @return void
46
-     */
47
-    protected function normalizeLabels()
48
-    {
49
-        $this->args['labels'] = wp_parse_args($this->args['labels'], [
50
-            'add_new_item' => sprintf(_x('Add New %s', 'Add New Post', 'site-reviews'), $this->plural),
51
-            'all_items' => sprintf(_x('All %s', 'All Posts', 'site-reviews'), $this->plural),
52
-            'archives' => sprintf(_x('%s Archives', 'Post Archives', 'site-reviews'), $this->single),
53
-            'edit_item' => sprintf(_x('Edit %s', 'Edit Post', 'site-reviews'), $this->single),
54
-            'insert_into_item' => sprintf(_x('Insert into %s', 'Insert into Post', 'site-reviews'), $this->single),
55
-            'menu_name' => $this->args['menu_name'],
56
-            'name' => $this->plural,
57
-            'new_item' => sprintf(_x('New %s', 'New Post', 'site-reviews'), $this->single),
58
-            'not_found' => sprintf(_x('No %s found', 'No Posts found', 'site-reviews'), $this->plural),
59
-            'not_found_in_trash' => sprintf(_x('No %s found in Trash', 'No Posts found in Trash', 'site-reviews'), $this->plural),
60
-            'search_items' => sprintf(_x('Search %s', 'Search Posts', 'site-reviews'), $this->plural),
61
-            'singular_name' => $this->single,
62
-            'uploaded_to_this_item' => sprintf(_x('Uploaded to this %s', 'Uploaded to this Post', 'site-reviews'), $this->single),
63
-            'view_item' => sprintf(_x('View %s', 'View Post', 'site-reviews'), $this->single),
64
-        ]);
65
-        unset($this->args['menu_name']);
66
-    }
44
+	/**
45
+	 * @return void
46
+	 */
47
+	protected function normalizeLabels()
48
+	{
49
+		$this->args['labels'] = wp_parse_args($this->args['labels'], [
50
+			'add_new_item' => sprintf(_x('Add New %s', 'Add New Post', 'site-reviews'), $this->plural),
51
+			'all_items' => sprintf(_x('All %s', 'All Posts', 'site-reviews'), $this->plural),
52
+			'archives' => sprintf(_x('%s Archives', 'Post Archives', 'site-reviews'), $this->single),
53
+			'edit_item' => sprintf(_x('Edit %s', 'Edit Post', 'site-reviews'), $this->single),
54
+			'insert_into_item' => sprintf(_x('Insert into %s', 'Insert into Post', 'site-reviews'), $this->single),
55
+			'menu_name' => $this->args['menu_name'],
56
+			'name' => $this->plural,
57
+			'new_item' => sprintf(_x('New %s', 'New Post', 'site-reviews'), $this->single),
58
+			'not_found' => sprintf(_x('No %s found', 'No Posts found', 'site-reviews'), $this->plural),
59
+			'not_found_in_trash' => sprintf(_x('No %s found in Trash', 'No Posts found in Trash', 'site-reviews'), $this->plural),
60
+			'search_items' => sprintf(_x('Search %s', 'Search Posts', 'site-reviews'), $this->plural),
61
+			'singular_name' => $this->single,
62
+			'uploaded_to_this_item' => sprintf(_x('Uploaded to this %s', 'Uploaded to this Post', 'site-reviews'), $this->single),
63
+			'view_item' => sprintf(_x('View %s', 'View Post', 'site-reviews'), $this->single),
64
+		]);
65
+		unset($this->args['menu_name']);
66
+	}
67 67
 
68
-    /**
69
-     * @return void
70
-     */
71
-    protected function normalizeColumns()
72
-    {
73
-        $this->columns = ['cb' => ''] + $this->columns;
74
-        if (array_key_exists('category', $this->columns)) {
75
-            $keys = array_keys($this->columns);
76
-            $keys[array_search('category', $keys)] = 'taxonomy-'.Application::TAXONOMY;
77
-            $this->columns = array_combine($keys, $this->columns);
78
-        }
79
-        if (array_key_exists('pinned', $this->columns)) {
80
-            $this->columns['pinned'] = glsr(Builder::class)->span('<span>'.$this->columns['pinned'].'</span>',
81
-                ['class' => 'pinned-icon']
82
-            );
83
-        }
84
-    }
68
+	/**
69
+	 * @return void
70
+	 */
71
+	protected function normalizeColumns()
72
+	{
73
+		$this->columns = ['cb' => ''] + $this->columns;
74
+		if (array_key_exists('category', $this->columns)) {
75
+			$keys = array_keys($this->columns);
76
+			$keys[array_search('category', $keys)] = 'taxonomy-'.Application::TAXONOMY;
77
+			$this->columns = array_combine($keys, $this->columns);
78
+		}
79
+		if (array_key_exists('pinned', $this->columns)) {
80
+			$this->columns['pinned'] = glsr(Builder::class)->span('<span>'.$this->columns['pinned'].'</span>',
81
+				['class' => 'pinned-icon']
82
+			);
83
+		}
84
+	}
85 85
 }
Please login to merge, or discard this patch.
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -15,10 +15,10 @@  discard block
 block discarded – undo
15 15
     public $postType;
16 16
     public $single;
17 17
 
18
-    public function __construct($input)
18
+    public function __construct( $input )
19 19
     {
20
-        $args = glsr(PostTypeDefaults::class)->merge($input);
21
-        $this->normalize($args);
20
+        $args = glsr( PostTypeDefaults::class )->merge( $input );
21
+        $this->normalize( $args );
22 22
         $this->normalizeColumns();
23 23
         $this->normalizeLabels();
24 24
     }
@@ -26,19 +26,19 @@  discard block
 block discarded – undo
26 26
     /**
27 27
      * @return void
28 28
      */
29
-    protected function normalize(array $args)
29
+    protected function normalize( array $args )
30 30
     {
31
-        foreach ($args as $key => $value) {
32
-            $property = Helper::buildPropertyName($key);
33
-            if (!property_exists($this, $property)) {
31
+        foreach( $args as $key => $value ) {
32
+            $property = Helper::buildPropertyName( $key );
33
+            if( !property_exists( $this, $property ) ) {
34 34
                 continue;
35 35
             }
36 36
             $this->$property = $value;
37 37
             unset($args[$key]);
38 38
         }
39
-        $this->args = wp_parse_args($args, [
39
+        $this->args = wp_parse_args( $args, [
40 40
             'menu_name' => $this->plural,
41
-        ]);
41
+        ] );
42 42
     }
43 43
 
44 44
     /**
@@ -46,22 +46,22 @@  discard block
 block discarded – undo
46 46
      */
47 47
     protected function normalizeLabels()
48 48
     {
49
-        $this->args['labels'] = wp_parse_args($this->args['labels'], [
50
-            'add_new_item' => sprintf(_x('Add New %s', 'Add New Post', 'site-reviews'), $this->plural),
51
-            'all_items' => sprintf(_x('All %s', 'All Posts', 'site-reviews'), $this->plural),
52
-            'archives' => sprintf(_x('%s Archives', 'Post Archives', 'site-reviews'), $this->single),
53
-            'edit_item' => sprintf(_x('Edit %s', 'Edit Post', 'site-reviews'), $this->single),
54
-            'insert_into_item' => sprintf(_x('Insert into %s', 'Insert into Post', 'site-reviews'), $this->single),
49
+        $this->args['labels'] = wp_parse_args( $this->args['labels'], [
50
+            'add_new_item' => sprintf( _x( 'Add New %s', 'Add New Post', 'site-reviews' ), $this->plural ),
51
+            'all_items' => sprintf( _x( 'All %s', 'All Posts', 'site-reviews' ), $this->plural ),
52
+            'archives' => sprintf( _x( '%s Archives', 'Post Archives', 'site-reviews' ), $this->single ),
53
+            'edit_item' => sprintf( _x( 'Edit %s', 'Edit Post', 'site-reviews' ), $this->single ),
54
+            'insert_into_item' => sprintf( _x( 'Insert into %s', 'Insert into Post', 'site-reviews' ), $this->single ),
55 55
             'menu_name' => $this->args['menu_name'],
56 56
             'name' => $this->plural,
57
-            'new_item' => sprintf(_x('New %s', 'New Post', 'site-reviews'), $this->single),
58
-            'not_found' => sprintf(_x('No %s found', 'No Posts found', 'site-reviews'), $this->plural),
59
-            'not_found_in_trash' => sprintf(_x('No %s found in Trash', 'No Posts found in Trash', 'site-reviews'), $this->plural),
60
-            'search_items' => sprintf(_x('Search %s', 'Search Posts', 'site-reviews'), $this->plural),
57
+            'new_item' => sprintf( _x( 'New %s', 'New Post', 'site-reviews' ), $this->single ),
58
+            'not_found' => sprintf( _x( 'No %s found', 'No Posts found', 'site-reviews' ), $this->plural ),
59
+            'not_found_in_trash' => sprintf( _x( 'No %s found in Trash', 'No Posts found in Trash', 'site-reviews' ), $this->plural ),
60
+            'search_items' => sprintf( _x( 'Search %s', 'Search Posts', 'site-reviews' ), $this->plural ),
61 61
             'singular_name' => $this->single,
62
-            'uploaded_to_this_item' => sprintf(_x('Uploaded to this %s', 'Uploaded to this Post', 'site-reviews'), $this->single),
63
-            'view_item' => sprintf(_x('View %s', 'View Post', 'site-reviews'), $this->single),
64
-        ]);
62
+            'uploaded_to_this_item' => sprintf( _x( 'Uploaded to this %s', 'Uploaded to this Post', 'site-reviews' ), $this->single ),
63
+            'view_item' => sprintf( _x( 'View %s', 'View Post', 'site-reviews' ), $this->single ),
64
+        ] );
65 65
         unset($this->args['menu_name']);
66 66
     }
67 67
 
@@ -71,13 +71,13 @@  discard block
 block discarded – undo
71 71
     protected function normalizeColumns()
72 72
     {
73 73
         $this->columns = ['cb' => ''] + $this->columns;
74
-        if (array_key_exists('category', $this->columns)) {
75
-            $keys = array_keys($this->columns);
76
-            $keys[array_search('category', $keys)] = 'taxonomy-'.Application::TAXONOMY;
77
-            $this->columns = array_combine($keys, $this->columns);
74
+        if( array_key_exists( 'category', $this->columns ) ) {
75
+            $keys = array_keys( $this->columns );
76
+            $keys[array_search( 'category', $keys )] = 'taxonomy-'.Application::TAXONOMY;
77
+            $this->columns = array_combine( $keys, $this->columns );
78 78
         }
79
-        if (array_key_exists('pinned', $this->columns)) {
80
-            $this->columns['pinned'] = glsr(Builder::class)->span('<span>'.$this->columns['pinned'].'</span>',
79
+        if( array_key_exists( 'pinned', $this->columns ) ) {
80
+            $this->columns['pinned'] = glsr( Builder::class )->span( '<span>'.$this->columns['pinned'].'</span>',
81 81
                 ['class' => 'pinned-icon']
82 82
             );
83 83
         }
Please login to merge, or discard this patch.