Passed
Branch master (51607c)
by Paul
05:13
created
plugin/Modules/Html/Attributes.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -72,15 +72,15 @@  discard block
 block discarded – undo
72 72
 	 * @param array $args
73 73
 	 * @return static
74 74
 	 */
75
-	public function __call( $method, $args )
75
+	public function __call($method, $args)
76 76
 	{
77 77
 		$args += [[], false];
78
-		$constant = 'static::ATTRIBUTES_'.strtoupper( $method );
79
-		$allowedAttributeKeys = defined( $constant )
80
-			? constant( $constant )
78
+		$constant = 'static::ATTRIBUTES_'.strtoupper($method);
79
+		$allowedAttributeKeys = defined($constant)
80
+			? constant($constant)
81 81
 			: [];
82
-		$this->normalize( (array)$args[0], $allowedAttributeKeys );
83
-		$this->normalizeInputType( $method );
82
+		$this->normalize((array)$args[0], $allowedAttributeKeys);
83
+		$this->normalizeInputType($method);
84 84
 		return $this;
85 85
 	}
86 86
 
@@ -98,21 +98,21 @@  discard block
 block discarded – undo
98 98
 	public function toString()
99 99
 	{
100 100
 		$attributes = [];
101
-		foreach( $this->attributes as $attribute => $value ) {
102
-			$quote = $this->getQuoteChar( $attribute );
103
-			$attributes[] = in_array( $attribute, static::BOOLEAN_ATTRIBUTES )
101
+		foreach ($this->attributes as $attribute => $value) {
102
+			$quote = $this->getQuoteChar($attribute);
103
+			$attributes[] = in_array($attribute, static::BOOLEAN_ATTRIBUTES)
104 104
 				? $attribute
105
-				: $attribute.'='.$quote.implode( ',', (array)$value ).$quote;
105
+				: $attribute.'='.$quote.implode(',', (array)$value).$quote;
106 106
 		}
107
-		return implode( ' ', $attributes );
107
+		return implode(' ', $attributes);
108 108
 	}
109 109
 
110 110
 	/**
111 111
 	 * @return array
112 112
 	 */
113
-	protected function filterAttributes( array $allowedAttributeKeys )
113
+	protected function filterAttributes(array $allowedAttributeKeys)
114 114
 	{
115
-		return array_intersect_key( $this->attributes, array_flip( $allowedAttributeKeys ));
115
+		return array_intersect_key($this->attributes, array_flip($allowedAttributeKeys));
116 116
 	}
117 117
 
118 118
 	/**
@@ -120,24 +120,24 @@  discard block
 block discarded – undo
120 120
 	 */
121 121
 	protected function filterGlobalAttributes()
122 122
 	{
123
-		$globalAttributes = $this->filterAttributes( static::GLOBAL_ATTRIBUTES );
123
+		$globalAttributes = $this->filterAttributes(static::GLOBAL_ATTRIBUTES);
124 124
 		$wildcards = [];
125
-		foreach( static::GLOBAL_WILDCARD_ATTRIBUTES as $wildcard ) {
126
-			$newWildcards = array_filter( $this->attributes, function( $key ) use( $wildcard ) {
127
-				return glsr( Helper::class )->startsWith( $wildcard, $key );
128
-			}, ARRAY_FILTER_USE_KEY );
129
-			$wildcards = array_merge( $wildcards, $newWildcards );
125
+		foreach (static::GLOBAL_WILDCARD_ATTRIBUTES as $wildcard) {
126
+			$newWildcards = array_filter($this->attributes, function($key) use($wildcard) {
127
+				return glsr(Helper::class)->startsWith($wildcard, $key);
128
+			}, ARRAY_FILTER_USE_KEY);
129
+			$wildcards = array_merge($wildcards, $newWildcards);
130 130
 		}
131
-		return array_merge( $globalAttributes, $wildcards );
131
+		return array_merge($globalAttributes, $wildcards);
132 132
 	}
133 133
 
134 134
 	/**
135 135
 	 * @param strong $attribute
136 136
 	 * @return string
137 137
 	 */
138
-	protected function getQuoteChar( $attribute )
138
+	protected function getQuoteChar($attribute)
139 139
 	{
140
-		return glsr( Helper::class )->startsWith( 'data-', $attribute )
140
+		return glsr(Helper::class)->startsWith('data-', $attribute)
141 141
 			? '\''
142 142
 			: '"';
143 143
 	}
@@ -147,19 +147,19 @@  discard block
 block discarded – undo
147 147
 	 * @param mixed $value
148 148
 	 * @return bool
149 149
 	 */
150
-	protected function isAttributeKeyNumeric( $key, $value )
150
+	protected function isAttributeKeyNumeric($key, $value)
151 151
 	{
152
-		return is_string( $value )
153
-			&& is_numeric( $key )
154
-			&& !array_key_exists( $value, $this->attributes );
152
+		return is_string($value)
153
+			&& is_numeric($key)
154
+			&& !array_key_exists($value, $this->attributes);
155 155
 	}
156 156
 
157 157
 	/**
158 158
 	 * @return void
159 159
 	 */
160
-	protected function normalize( array $args, array $allowedAttributeKeys )
160
+	protected function normalize(array $args, array $allowedAttributeKeys)
161 161
 	{
162
-		$this->attributes = array_change_key_case( $args, CASE_LOWER );
162
+		$this->attributes = array_change_key_case($args, CASE_LOWER);
163 163
 		$this->normalizeBooleanAttributes();
164 164
 		$this->normalizeDataAttributes();
165 165
 		$this->normalizeStringAttributes();
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 		$this->removeIndexedAttributes();
168 168
 		$this->attributes = array_merge(
169 169
 			$this->filterGlobalAttributes(),
170
-			$this->filterAttributes( $allowedAttributeKeys )
170
+			$this->filterAttributes($allowedAttributeKeys)
171 171
 		);
172 172
 	}
173 173
 
@@ -176,13 +176,13 @@  discard block
 block discarded – undo
176 176
 	 */
177 177
 	protected function normalizeBooleanAttributes()
178 178
 	{
179
-		foreach( $this->attributes as $key => $value ) {
180
-			if( $this->isAttributeKeyNumeric( $key, $value )) {
179
+		foreach ($this->attributes as $key => $value) {
180
+			if ($this->isAttributeKeyNumeric($key, $value)) {
181 181
 				$key = $value;
182 182
 				$value = true;
183 183
 			}
184
-			if( !in_array( $key, static::BOOLEAN_ATTRIBUTES ))continue;
185
-			$this->attributes[$key] = wp_validate_boolean( $value );
184
+			if (!in_array($key, static::BOOLEAN_ATTRIBUTES))continue;
185
+			$this->attributes[$key] = wp_validate_boolean($value);
186 186
 		}
187 187
 	}
188 188
 
@@ -191,14 +191,14 @@  discard block
 block discarded – undo
191 191
 	 */
192 192
 	protected function normalizeDataAttributes()
193 193
 	{
194
-		foreach( $this->attributes as $key => $value ) {
195
-			if( $this->isAttributeKeyNumeric( $key, $value )) {
194
+		foreach ($this->attributes as $key => $value) {
195
+			if ($this->isAttributeKeyNumeric($key, $value)) {
196 196
 				$key = $value;
197 197
 				$value = '';
198 198
 			}
199
-			if( !glsr( Helper::class )->startsWith( 'data-', $key ))continue;
200
-			if( is_array( $value )) {
201
-				$value = json_encode( $value, JSON_HEX_APOS | JSON_NUMERIC_CHECK | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES );
199
+			if (!glsr(Helper::class)->startsWith('data-', $key))continue;
200
+			if (is_array($value)) {
201
+				$value = json_encode($value, JSON_HEX_APOS | JSON_NUMERIC_CHECK | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
202 202
 			}
203 203
 			$this->attributes[$key] = $value;
204 204
 		}
@@ -209,9 +209,9 @@  discard block
 block discarded – undo
209 209
 	 */
210 210
 	protected function normalizeStringAttributes()
211 211
 	{
212
-		foreach( $this->attributes as $key => $value ) {
213
-			if( !is_string( $value ))continue;
214
-			$this->attributes[$key] = trim( $value );
212
+		foreach ($this->attributes as $key => $value) {
213
+			if (!is_string($value))continue;
214
+			$this->attributes[$key] = trim($value);
215 215
 		}
216 216
 	}
217 217
 
@@ -219,11 +219,11 @@  discard block
 block discarded – undo
219 219
 	 * @param string $method
220 220
 	 * @return void
221 221
 	 */
222
-	protected function normalizeInputType( $method )
222
+	protected function normalizeInputType($method)
223 223
 	{
224
-		if( $method != 'input' )return;
225
-		$attributes = wp_parse_args( $this->attributes, ['type' => ''] );
226
-		if( !in_array( $attributes['type'], static::INPUT_TYPES )) {
224
+		if ($method != 'input')return;
225
+		$attributes = wp_parse_args($this->attributes, ['type' => '']);
226
+		if (!in_array($attributes['type'], static::INPUT_TYPES)) {
227 227
 			$this->attributes['type'] = 'text';
228 228
 		}
229 229
 	}
@@ -235,16 +235,16 @@  discard block
 block discarded – undo
235 235
 	{
236 236
 		$attributes = $this->attributes;
237 237
 		$dataAttributes = [];
238
-		foreach( $this->attributes as $key => $value ) {
239
-			if( in_array( $key, static::BOOLEAN_ATTRIBUTES ) && !$value ) {
240
-				unset( $attributes[$key] );
238
+		foreach ($this->attributes as $key => $value) {
239
+			if (in_array($key, static::BOOLEAN_ATTRIBUTES) && !$value) {
240
+				unset($attributes[$key]);
241 241
 			}
242
-			if( glsr( Helper::class )->startsWith( 'data-', $key )) {
242
+			if (glsr(Helper::class)->startsWith('data-', $key)) {
243 243
 				$dataAttributes[$key] = $value;
244
-				unset( $attributes[$key] );
244
+				unset($attributes[$key]);
245 245
 			}
246 246
 		}
247
-		$this->attributes = array_merge( array_filter( $attributes ), $dataAttributes );
247
+		$this->attributes = array_merge(array_filter($attributes), $dataAttributes);
248 248
 	}
249 249
 
250 250
 	/**
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 	{
255 255
 		$this->attributes = array_diff_key(
256 256
 			$this->attributes,
257
-			array_filter( $this->attributes, 'is_numeric', ARRAY_FILTER_USE_KEY )
257
+			array_filter($this->attributes, 'is_numeric', ARRAY_FILTER_USE_KEY)
258 258
 		);
259 259
 	}
260 260
 }
Please login to merge, or discard this patch.
plugin/Modules/Html/Partial.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -10,23 +10,23 @@
 block discarded – undo
10 10
 	 * @param string $partialPath
11 11
 	 * @return string
12 12
 	 */
13
-	public function build( $partialPath, array $args = [] )
13
+	public function build($partialPath, array $args = [])
14 14
 	{
15
-		$className = glsr( Helper::class )->buildClassName( $partialPath, 'Modules\Html\Partials' );
16
-		if( !class_exists( $className )) {
17
-			glsr_log()->error( 'Partial missing: '.$className );
15
+		$className = glsr(Helper::class)->buildClassName($partialPath, 'Modules\Html\Partials');
16
+		if (!class_exists($className)) {
17
+			glsr_log()->error('Partial missing: '.$className);
18 18
 			return;
19 19
 		}
20
-		$partial = glsr( $className )->build( $partialPath, $args );
21
-		return apply_filters( 'site-reviews/rendered/partial', $partial, $partialPath, $args );
20
+		$partial = glsr($className)->build($partialPath, $args);
21
+		return apply_filters('site-reviews/rendered/partial', $partial, $partialPath, $args);
22 22
 	}
23 23
 
24 24
 	/**
25 25
 	 * @param string $partialPath
26 26
 	 * @return void
27 27
 	 */
28
-	public function render( $partialPath, array $args = [] )
28
+	public function render($partialPath, array $args = [])
29 29
 	{
30
-		echo $this->build( $partialPath, $args );
30
+		echo $this->build($partialPath, $args);
31 31
 	}
32 32
 }
Please login to merge, or discard this patch.
plugin/Modules/Html/Form.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@
 block discarded – undo
12 12
 	 * @param string $path
13 13
 	 * @return string
14 14
 	 */
15
-	public function build( $path )
15
+	public function build($path)
16 16
 	{
17
-		$settingsKey = rtrim( $path, '.' );
18
-		glsr_debug( $settingsKey );
17
+		$settingsKey = rtrim($path, '.');
18
+		glsr_debug($settingsKey);
19 19
 		// glsr( Form::class )->buildSettingsForm( $settingsKey );
20 20
 
21 21
 	}
Please login to merge, or discard this patch.
plugin/Modules/Html/Partials/StarRating.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -12,13 +12,13 @@
 block discarded – undo
12 12
 	 * @return void|string
13 13
 	 * @todo wp_star_rating()
14 14
 	 */
15
-	public function build( $name, array $args = [] )
15
+	public function build($name, array $args = [])
16 16
 	{
17
-		$roundedRating = floor( round( $args['rating'], 1 ) * 2 ) / 2;
18
-		$percentage = glsr( Builder::class )->span([
19
-			'style' => 'width:'.( $roundedRating / Rating::MAX_RATING * 100 ).'%;',
17
+		$roundedRating = floor(round($args['rating'], 1) * 2) / 2;
18
+		$percentage = glsr(Builder::class)->span([
19
+			'style' => 'width:'.($roundedRating / Rating::MAX_RATING * 100).'%;',
20 20
 		]);
21
-		return glsr( Builder::class )->span( $percentage, [
21
+		return glsr(Builder::class)->span($percentage, [
22 22
 			'class' => 'glsr-star-rating',
23 23
 		]);
24 24
 	}
Please login to merge, or discard this patch.
plugin/Modules/Html/Partials/SiteReviewsForm.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -10,17 +10,17 @@
 block discarded – undo
10 10
 	/**
11 11
 	 * @return void|string
12 12
 	 */
13
-	public function build( $name, array $args = [] )
13
+	public function build($name, array $args = [])
14 14
 	{
15
-		$partial = glsr( Html::class )->buildTemplate( 'templates/reviews-form', [
15
+		$partial = glsr(Html::class)->buildTemplate('templates/reviews-form', [
16 16
 			'globals' => $args,
17 17
 		]);
18
-		$form = glsr( Builder::class )->form( $partial, [
18
+		$form = glsr(Builder::class)->form($partial, [
19 19
 			'class' => 'glsr-form',
20 20
 			'id' => $args['id'],
21 21
 			'method' => 'post',
22 22
 		]);
23
-		return glsr( Builder::class )->div( $form, [
23
+		return glsr(Builder::class)->div($form, [
24 24
 			'class' => 'glsr-form-wrap '.$args['class'],
25 25
 		]);
26 26
 	}
Please login to merge, or discard this patch.
plugin/Modules/Html/Partials/Sections.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -21,22 +21,22 @@  discard block
 block discarded – undo
21 21
 	/**
22 22
 	 * @return void|string
23 23
 	 */
24
-	public function build( $name, array $args = [] )
24
+	public function build($name, array $args = [])
25 25
 	{
26
-		$this->normalize( $args );
27
-		if( count( $this->sections ) < 2 )return;
28
-		$links = array_reduce( array_keys( $this->sections ), function( $result, $section ) {
29
-			return $result.glsr( Builder::class )->li( $this->buildLink( $section ));
26
+		$this->normalize($args);
27
+		if (count($this->sections) < 2)return;
28
+		$links = array_reduce(array_keys($this->sections), function($result, $section) {
29
+			return $result.glsr(Builder::class)->li($this->buildLink($section));
30 30
 		});
31
-		return glsr( Builder::class )->ul( $links, ['class' => 'subsubsub glsr-subsubsub'] );
31
+		return glsr(Builder::class)->ul($links, ['class' => 'subsubsub glsr-subsubsub']);
32 32
 	}
33 33
 
34 34
 	/**
35 35
 	 * @return void
36 36
 	 */
37
-	public function normalize( array $args )
37
+	public function normalize(array $args)
38 38
 	{
39
-		$this->args = wp_parse_args( $args, [
39
+		$this->args = wp_parse_args($args, [
40 40
 			'page' => '',
41 41
 			'section' => '',
42 42
 			'tab' => '',
@@ -49,16 +49,16 @@  discard block
 block discarded – undo
49 49
 	 * @param string $section
50 50
 	 * @return string
51 51
 	 */
52
-	protected function buildLink( $section )
52
+	protected function buildLink($section)
53 53
 	{
54 54
 		$class = $separator = '';
55
-		if( strpos( $this->args['section'], $section ) === 0 ) {
55
+		if (strpos($this->args['section'], $section) === 0) {
56 56
 			$class = 'current';
57 57
 		}
58
-		if( end( $this->sections ) !== $this->sections[$section] ) {
58
+		if (end($this->sections) !== $this->sections[$section]) {
59 59
 			$separator = ' | ';
60 60
 		}
61
-		return glsr( Builder::class )->a( $this->sections[$section], [
61
+		return glsr(Builder::class)->a($this->sections[$section], [
62 62
 			'class' => $class,
63 63
 			'href' => '?post_type='.Application::POST_TYPE.'&page='.$this->args['page'].'&tab='.$this->args['tab'].'&section='.$section,
64 64
 		]).$separator;
Please login to merge, or discard this patch.
plugin/Modules/Html/Partials/SiteReviewsSummary.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -28,14 +28,14 @@  discard block
 block discarded – undo
28 28
 	/**
29 29
 	 * @return void|string
30 30
 	 */
31
-	public function build( $name, array $args = [] )
31
+	public function build($name, array $args = [])
32 32
 	{
33 33
 		$this->args = $args;
34
-		$this->reviews = glsr( Database::class )->getReviews( $args );
35
-		if( $this->isHidden() )return;
36
-		$this->rating = glsr( Rating::class )->getAverage( $this->reviews->results );
34
+		$this->reviews = glsr(Database::class)->getReviews($args);
35
+		if ($this->isHidden())return;
36
+		$this->rating = glsr(Rating::class)->getAverage($this->reviews->results);
37 37
 		$this->buildSchema();
38
-		return glsr( Builder::class )->div( $this->buildSummary().$this->buildPercentageBars(), [
38
+		return glsr(Builder::class)->div($this->buildSummary().$this->buildPercentageBars(), [
39 39
 			'class' => 'glsr-summary-wrap '.$args['class'],
40 40
 			'id' => $args['id'],
41 41
 		]);
@@ -46,23 +46,23 @@  discard block
 block discarded – undo
46 46
 	 * @param string $percent
47 47
 	 * @return string
48 48
 	 */
49
-	protected function buildPercentageBar( $index, $percent )
49
+	protected function buildPercentageBar($index, $percent)
50 50
 	{
51
-		$build = glsr( Builder::class );
52
-		$label = $build->span( $this->args['labels'][$index], [
51
+		$build = glsr(Builder::class);
52
+		$label = $build->span($this->args['labels'][$index], [
53 53
 			'class' => 'glsr-bar-label',
54 54
 		]);
55 55
 		$barBackground = $build->span([
56 56
 			'class' => 'glsr-bar-percent',
57 57
 			'style' => 'width:'.$percent,
58 58
 		]);
59
-		$barPercent = $build->span( $barBackground, [
59
+		$barPercent = $build->span($barBackground, [
60 60
 			'class' => 'glsr-bar-background',
61 61
 		]);
62
-		$percent = $build->span( $percent, [
62
+		$percent = $build->span($percent, [
63 63
 			'class' => 'glsr-bar-count',
64 64
 		]);
65
-		return $build->div( $label.$barPercent.$percent, [
65
+		return $build->div($label.$barPercent.$percent, [
66 66
 			'class' => 'glsr-percentage-bar',
67 67
 		]);
68 68
 	}
@@ -72,13 +72,13 @@  discard block
 block discarded – undo
72 72
 	 */
73 73
 	protected function buildPercentageBars()
74 74
 	{
75
-		if( in_array( 'bars', $this->args['hide'] ))return;
76
-		$percentages = preg_filter( '/$/', '%', glsr( Rating::class )->getPercentages( $this->reviews->results ));
77
-		$range = range( Rating::MAX_RATING, 1 );
78
-		$bars = array_reduce( $range, function( $carry, $index ) use( $percentages ) {
79
-			return $carry.$this->buildPercentageBar( intval( $index ), $percentages[$index] );
75
+		if (in_array('bars', $this->args['hide']))return;
76
+		$percentages = preg_filter('/$/', '%', glsr(Rating::class)->getPercentages($this->reviews->results));
77
+		$range = range(Rating::MAX_RATING, 1);
78
+		$bars = array_reduce($range, function($carry, $index) use($percentages) {
79
+			return $carry.$this->buildPercentageBar(intval($index), $percentages[$index]);
80 80
 		});
81
-		return glsr( Builder::class )->div( $bars, [
81
+		return glsr(Builder::class)->div($bars, [
82 82
 			'class' => 'glsr-percentage-bars',
83 83
 		]);
84 84
 	}
@@ -88,9 +88,9 @@  discard block
 block discarded – undo
88 88
 	 */
89 89
 	protected function buildSchema()
90 90
 	{
91
-		if( !$this->args['schema'] )return;
92
-		$schema = glsr( Schema::class );
93
-		$schema->store( $schema->buildSummary( $this->args ));
91
+		if (!$this->args['schema'])return;
92
+		$schema = glsr(Schema::class);
93
+		$schema->store($schema->buildSummary($this->args));
94 94
 	}
95 95
 
96 96
 	/**
@@ -99,8 +99,8 @@  discard block
 block discarded – undo
99 99
 	protected function buildSummary()
100 100
 	{
101 101
 		$summary = $this->buildSummaryRating().$this->buildSummaryStars().$this->buildSummaryText();
102
-		if( empty( $summary ))return;
103
-		return glsr( Builder::class )->div( $summary, [
102
+		if (empty($summary))return;
103
+		return glsr(Builder::class)->div($summary, [
104 104
 			'class' => 'glsr-summary',
105 105
 		]);
106 106
 	}
@@ -110,8 +110,8 @@  discard block
 block discarded – undo
110 110
 	 */
111 111
 	protected function buildSummaryRating()
112 112
 	{
113
-		if( in_array( 'rating', $this->args['hide'] ))return;
114
-		return glsr( Builder::class )->span( $this->rating, [
113
+		if (in_array('rating', $this->args['hide']))return;
114
+		return glsr(Builder::class)->span($this->rating, [
115 115
 			'class' => 'glsr-summary-rating',
116 116
 		]);
117 117
 	}
@@ -121,11 +121,11 @@  discard block
 block discarded – undo
121 121
 	 */
122 122
 	protected function buildSummaryStars()
123 123
 	{
124
-		if( in_array( 'stars', $this->args['hide'] ))return;
125
-		$stars = glsr( Html::class )->buildPartial( 'star-rating', [
124
+		if (in_array('stars', $this->args['hide']))return;
125
+		$stars = glsr(Html::class)->buildPartial('star-rating', [
126 126
 			'rating' => $this->rating,
127 127
 		]);
128
-		return glsr( Builder::class )->span( $stars, [
128
+		return glsr(Builder::class)->span($stars, [
129 129
 			'class' => 'glsr-summary-stars',
130 130
 		]);
131 131
 	}
@@ -135,9 +135,9 @@  discard block
 block discarded – undo
135 135
 	 */
136 136
 	protected function buildSummaryText()
137 137
 	{
138
-		if( in_array( 'summary', $this->args['hide'] ))return;
139
-		$count = count( $this->reviews->results );
140
-		if( empty( $this->args['text'] )) {
138
+		if (in_array('summary', $this->args['hide']))return;
139
+		$count = count($this->reviews->results);
140
+		if (empty($this->args['text'])) {
141 141
 			 $this->args['text'] = _nx(
142 142
 				'{rating} out of {max} stars (based on %d review)',
143 143
 				'{rating} out of {max} stars (based on %d reviews)',
@@ -147,9 +147,9 @@  discard block
 block discarded – undo
147 147
 			);
148 148
 		}
149 149
 		$summary = str_replace(
150
-			['{rating}','{max}'], [$this->rating, Rating::MAX_RATING], $this->args['text']
150
+			['{rating}', '{max}'], [$this->rating, Rating::MAX_RATING], $this->args['text']
151 151
 		);
152
-		return str_replace( ['%s','%d'], $count, $summary );
152
+		return str_replace(['%s', '%d'], $count, $summary);
153 153
 	}
154 154
 
155 155
 	/**
@@ -157,6 +157,6 @@  discard block
 block discarded – undo
157 157
 	 */
158 158
 	protected function isHidden()
159 159
 	{
160
-		return empty( $this->reviews->results ) && in_array( 'if_empty', $this->args['hide'] );
160
+		return empty($this->reviews->results) && in_array('if_empty', $this->args['hide']);
161 161
 	}
162 162
 }
Please login to merge, or discard this patch.
plugin/Modules/Html/Partials/SiteReviews.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -27,10 +27,10 @@
 block discarded – undo
27 27
 	/**
28 28
 	 * @return void|string
29 29
 	 */
30
-	public function build( $name, array $args = [] )
30
+	public function build($name, array $args = [])
31 31
 	{
32 32
 		$this->args = $args;
33
-		$this->reviews = glsr( Database::class )->getReviews( $args );
34
-		$this->rating = glsr( Rating::class )->getAverage( $this->reviews->results );
33
+		$this->reviews = glsr(Database::class)->getReviews($args);
34
+		$this->rating = glsr(Rating::class)->getAverage($this->reviews->results);
35 35
 	}
36 36
 }
Please login to merge, or discard this patch.
plugin/Modules/Html/Partials/Tabs.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -16,22 +16,22 @@  discard block
 block discarded – undo
16 16
 	/**
17 17
 	 * @return void|string
18 18
 	 */
19
-	public function build( $name, array $args = [] )
19
+	public function build($name, array $args = [])
20 20
 	{
21
-		$this->normalize( $args );
22
-		if( count( $this->args['tabs'] ) < 2 )return;
23
-		$links = array_reduce( array_keys( $this->args['tabs'] ), function( $result, $tab ) {
24
-			return $result.$this->buildLink( $tab );
21
+		$this->normalize($args);
22
+		if (count($this->args['tabs']) < 2)return;
23
+		$links = array_reduce(array_keys($this->args['tabs']), function($result, $tab) {
24
+			return $result.$this->buildLink($tab);
25 25
 		});
26
-		return glsr( Builder::class )->h2( $links, ['class' => 'nav-tab-wrapper'] );
26
+		return glsr(Builder::class)->h2($links, ['class' => 'nav-tab-wrapper']);
27 27
 	}
28 28
 
29 29
 	/**
30 30
 	 * @return void
31 31
 	 */
32
-	public function normalize( array $args )
32
+	public function normalize(array $args)
33 33
 	{
34
-		$this->args = wp_parse_args( $args, [
34
+		$this->args = wp_parse_args($args, [
35 35
 			'page' => '',
36 36
 			'tab' => '',
37 37
 			'tabs' => [],
@@ -42,12 +42,12 @@  discard block
 block discarded – undo
42 42
 	 * @param string $tab
43 43
 	 * @return string
44 44
 	 */
45
-	protected function buildLink( $tab )
45
+	protected function buildLink($tab)
46 46
 	{
47
-		$class = strpos( $this->args['tab'], $tab ) === 0
47
+		$class = strpos($this->args['tab'], $tab) === 0
48 48
 			? ' nav-tab-active'
49 49
 			: '';
50
-		return glsr( Builder::class )->a( $this->args['tabs'][$tab]['title'], [
50
+		return glsr(Builder::class)->a($this->args['tabs'][$tab]['title'], [
51 51
 			'class' => 'nav-tab'.$class,
52 52
 			'href' => '?post_type='.Application::POST_TYPE.'&page='.$this->args['page'].'&tab='.$tab,
53 53
 		]);
Please login to merge, or discard this patch.