Passed
Push — feature/rebusify ( 0fe5b2...103190 )
by Paul
08:37 queued 03:55
created
plugin/Modules/Html/Attributes.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -82,15 +82,15 @@  discard block
 block discarded – undo
82 82
      * @param array $args
83 83
      * @return static
84 84
      */
85
-    public function __call($method, $args)
85
+    public function __call( $method, $args )
86 86
     {
87 87
         $args += [[], false];
88
-        $constant = 'static::ATTRIBUTES_'.strtoupper($method);
89
-        $allowedAttributeKeys = defined($constant)
90
-            ? constant($constant)
88
+        $constant = 'static::ATTRIBUTES_'.strtoupper( $method );
89
+        $allowedAttributeKeys = defined( $constant )
90
+            ? constant( $constant )
91 91
             : [];
92
-        $this->normalize((array) $args[0], $allowedAttributeKeys);
93
-        $this->normalizeInputType($method);
92
+        $this->normalize( (array)$args[0], $allowedAttributeKeys );
93
+        $this->normalizeInputType( $method );
94 94
         return $this;
95 95
     }
96 96
 
@@ -108,21 +108,21 @@  discard block
 block discarded – undo
108 108
     public function toString()
109 109
     {
110 110
         $attributes = [];
111
-        foreach ($this->attributes as $attribute => $value) {
112
-            $quote = $this->getQuoteChar($attribute);
113
-            $attributes[] = in_array($attribute, static::BOOLEAN_ATTRIBUTES)
111
+        foreach( $this->attributes as $attribute => $value ) {
112
+            $quote = $this->getQuoteChar( $attribute );
113
+            $attributes[] = in_array( $attribute, static::BOOLEAN_ATTRIBUTES )
114 114
                 ? $attribute
115
-                : $attribute.'='.$quote.implode(',', (array) $value).$quote;
115
+                : $attribute.'='.$quote.implode( ',', (array)$value ).$quote;
116 116
         }
117
-        return implode(' ', $attributes);
117
+        return implode( ' ', $attributes );
118 118
     }
119 119
 
120 120
     /**
121 121
      * @return array
122 122
      */
123
-    protected function filterAttributes(array $allowedAttributeKeys)
123
+    protected function filterAttributes( array $allowedAttributeKeys )
124 124
     {
125
-        return array_intersect_key($this->attributes, array_flip($allowedAttributeKeys));
125
+        return array_intersect_key( $this->attributes, array_flip( $allowedAttributeKeys ) );
126 126
     }
127 127
 
128 128
     /**
@@ -130,15 +130,15 @@  discard block
 block discarded – undo
130 130
      */
131 131
     protected function filterGlobalAttributes()
132 132
     {
133
-        $globalAttributes = $this->filterAttributes(static::GLOBAL_ATTRIBUTES);
133
+        $globalAttributes = $this->filterAttributes( static::GLOBAL_ATTRIBUTES );
134 134
         $wildcards = [];
135
-        foreach (static::GLOBAL_WILDCARD_ATTRIBUTES as $wildcard) {
136
-            $newWildcards = array_filter($this->attributes, function ($key) use ($wildcard) {
137
-                return glsr(Helper::class)->startsWith($wildcard, $key);
138
-            }, ARRAY_FILTER_USE_KEY);
139
-            $wildcards = array_merge($wildcards, $newWildcards);
135
+        foreach( static::GLOBAL_WILDCARD_ATTRIBUTES as $wildcard ) {
136
+            $newWildcards = array_filter( $this->attributes, function( $key ) use ($wildcard) {
137
+                return glsr( Helper::class )->startsWith( $wildcard, $key );
138
+            }, ARRAY_FILTER_USE_KEY );
139
+            $wildcards = array_merge( $wildcards, $newWildcards );
140 140
         }
141
-        return array_merge($globalAttributes, $wildcards);
141
+        return array_merge( $globalAttributes, $wildcards );
142 142
     }
143 143
 
144 144
     /**
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
     protected function getPermanentAttributes()
148 148
     {
149 149
         $permanentAttributes = [];
150
-        if (array_key_exists('value', $this->attributes)) {
150
+        if( array_key_exists( 'value', $this->attributes ) ) {
151 151
             $permanentAttributes['value'] = $this->attributes['value'];
152 152
         }
153 153
         return $permanentAttributes;
@@ -157,9 +157,9 @@  discard block
 block discarded – undo
157 157
      * @param string $attribute
158 158
      * @return string
159 159
      */
160
-    protected function getQuoteChar($attribute)
160
+    protected function getQuoteChar( $attribute )
161 161
     {
162
-        return glsr(Helper::class)->startsWith('data-', $attribute)
162
+        return glsr( Helper::class )->startsWith( 'data-', $attribute )
163 163
             ? '\''
164 164
             : '"';
165 165
     }
@@ -169,19 +169,19 @@  discard block
 block discarded – undo
169 169
      * @param mixed $value
170 170
      * @return bool
171 171
      */
172
-    protected function isAttributeKeyNumeric($key, $value)
172
+    protected function isAttributeKeyNumeric( $key, $value )
173 173
     {
174
-        return is_string($value)
175
-            && is_numeric($key)
176
-            && !array_key_exists($value, $this->attributes);
174
+        return is_string( $value )
175
+            && is_numeric( $key )
176
+            && !array_key_exists( $value, $this->attributes );
177 177
     }
178 178
 
179 179
     /**
180 180
      * @return void
181 181
      */
182
-    protected function normalize(array $args, array $allowedAttributeKeys)
182
+    protected function normalize( array $args, array $allowedAttributeKeys )
183 183
     {
184
-        $this->attributes = array_change_key_case($args, CASE_LOWER);
184
+        $this->attributes = array_change_key_case( $args, CASE_LOWER );
185 185
         $this->normalizeBooleanAttributes();
186 186
         $this->normalizeDataAttributes();
187 187
         $this->normalizeStringAttributes();
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
         $this->removeIndexedAttributes();
190 190
         $this->attributes = array_merge(
191 191
             $this->filterGlobalAttributes(),
192
-            $this->filterAttributes($allowedAttributeKeys)
192
+            $this->filterAttributes( $allowedAttributeKeys )
193 193
         );
194 194
     }
195 195
 
@@ -198,15 +198,15 @@  discard block
 block discarded – undo
198 198
      */
199 199
     protected function normalizeBooleanAttributes()
200 200
     {
201
-        foreach ($this->attributes as $key => $value) {
202
-            if ($this->isAttributeKeyNumeric($key, $value)) {
201
+        foreach( $this->attributes as $key => $value ) {
202
+            if( $this->isAttributeKeyNumeric( $key, $value ) ) {
203 203
                 $key = $value;
204 204
                 $value = true;
205 205
             }
206
-            if (!in_array($key, static::BOOLEAN_ATTRIBUTES)) {
206
+            if( !in_array( $key, static::BOOLEAN_ATTRIBUTES ) ) {
207 207
                 continue;
208 208
             }
209
-            $this->attributes[$key] = wp_validate_boolean($value);
209
+            $this->attributes[$key] = wp_validate_boolean( $value );
210 210
         }
211 211
     }
212 212
 
@@ -215,16 +215,16 @@  discard block
 block discarded – undo
215 215
      */
216 216
     protected function normalizeDataAttributes()
217 217
     {
218
-        foreach ($this->attributes as $key => $value) {
219
-            if ($this->isAttributeKeyNumeric($key, $value)) {
218
+        foreach( $this->attributes as $key => $value ) {
219
+            if( $this->isAttributeKeyNumeric( $key, $value ) ) {
220 220
                 $key = $value;
221 221
                 $value = '';
222 222
             }
223
-            if (!glsr(Helper::class)->startsWith('data-', $key)) {
223
+            if( !glsr( Helper::class )->startsWith( 'data-', $key ) ) {
224 224
                 continue;
225 225
             }
226
-            if (is_array($value)) {
227
-                $value = json_encode($value, JSON_HEX_APOS | JSON_NUMERIC_CHECK | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
226
+            if( is_array( $value ) ) {
227
+                $value = json_encode( $value, JSON_HEX_APOS | JSON_NUMERIC_CHECK | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE );
228 228
             }
229 229
             $this->attributes[$key] = $value;
230 230
         }
@@ -235,11 +235,11 @@  discard block
 block discarded – undo
235 235
      */
236 236
     protected function normalizeStringAttributes()
237 237
     {
238
-        foreach ($this->attributes as $key => $value) {
239
-            if (!is_string($value)) {
238
+        foreach( $this->attributes as $key => $value ) {
239
+            if( !is_string( $value ) ) {
240 240
                 continue;
241 241
             }
242
-            $this->attributes[$key] = trim($value);
242
+            $this->attributes[$key] = trim( $value );
243 243
         }
244 244
     }
245 245
 
@@ -247,13 +247,13 @@  discard block
 block discarded – undo
247 247
      * @param string $method
248 248
      * @return void
249 249
      */
250
-    protected function normalizeInputType($method)
250
+    protected function normalizeInputType( $method )
251 251
     {
252
-        if ('input' != $method) {
252
+        if( 'input' != $method ) {
253 253
             return;
254 254
         }
255
-        $attributes = wp_parse_args($this->attributes, ['type' => '']);
256
-        if (!in_array($attributes['type'], static::INPUT_TYPES)) {
255
+        $attributes = wp_parse_args( $this->attributes, ['type' => ''] );
256
+        if( !in_array( $attributes['type'], static::INPUT_TYPES ) ) {
257 257
             $this->attributes['type'] = 'text';
258 258
         }
259 259
     }
@@ -265,16 +265,16 @@  discard block
 block discarded – undo
265 265
     {
266 266
         $attributes = $this->attributes;
267 267
         $permanentAttributes = $this->getPermanentAttributes();
268
-        foreach ($this->attributes as $key => $value) {
269
-            if (in_array($key, static::BOOLEAN_ATTRIBUTES) && !$value) {
268
+        foreach( $this->attributes as $key => $value ) {
269
+            if( in_array( $key, static::BOOLEAN_ATTRIBUTES ) && !$value ) {
270 270
                 unset($attributes[$key]);
271 271
             }
272
-            if (glsr(Helper::class)->startsWith('data-', $key)) {
272
+            if( glsr( Helper::class )->startsWith( 'data-', $key ) ) {
273 273
                 $permanentAttributes[$key] = $value;
274 274
                 unset($attributes[$key]);
275 275
             }
276 276
         }
277
-        $this->attributes = array_merge(array_filter($attributes), $permanentAttributes);
277
+        $this->attributes = array_merge( array_filter( $attributes ), $permanentAttributes );
278 278
     }
279 279
 
280 280
     /**
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
     {
285 285
         $this->attributes = array_diff_key(
286 286
             $this->attributes,
287
-            array_filter($this->attributes, 'is_numeric', ARRAY_FILTER_USE_KEY)
287
+            array_filter( $this->attributes, 'is_numeric', ARRAY_FILTER_USE_KEY )
288 288
         );
289 289
     }
290 290
 }
Please login to merge, or discard this patch.
plugin/Modules/Html/Fields/Honeypot.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,9 +9,9 @@
 block discarded – undo
9 9
      */
10 10
     public function build()
11 11
     {
12
-        $this->builder->args = wp_parse_args($this->builder->args, [
12
+        $this->builder->args = wp_parse_args( $this->builder->args, [
13 13
             'name' => $this->builder->args['text'],
14
-        ]);
14
+        ] );
15 15
         $this->builder->tag = 'input';
16 16
         $this->mergeFieldArgs();
17 17
         return $this->builder->getOpeningTag();
Please login to merge, or discard this patch.
plugin/Modules/Html/Fields/YesNo.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,8 +32,8 @@
 block discarded – undo
32 32
         return [
33 33
             'is_multi' => true,
34 34
             'options' => [
35
-                'no' => __('No', 'site-reviews'),
36
-                'yes' => __('Yes', 'site-reviews'),
35
+                'no' => __( 'No', 'site-reviews' ),
36
+                'yes' => __( 'Yes', 'site-reviews' ),
37 37
             ],
38 38
             'type' => 'radio',
39 39
         ];
Please login to merge, or discard this patch.
plugin/Modules/Html/Fields/Field.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
      */
12 12
     protected $builder;
13 13
 
14
-    public function __construct(Builder $builder)
14
+    public function __construct( Builder $builder )
15 15
     {
16 16
         $this->builder = $builder;
17 17
     }
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
      */
22 22
     public function build()
23 23
     {
24
-        glsr_log()->error('Build method is not implemented for '.get_class($this));
24
+        glsr_log()->error( 'Build method is not implemented for '.get_class( $this ) );
25 25
     }
26 26
 
27 27
     /**
@@ -35,14 +35,14 @@  discard block
 block discarded – undo
35 35
     /**
36 36
      * @return array
37 37
      */
38
-    public static function merge(array $args)
38
+    public static function merge( array $args )
39 39
     {
40 40
         $merged = array_merge(
41
-            wp_parse_args($args, static::defaults()),
41
+            wp_parse_args( $args, static::defaults() ),
42 42
             static::required()
43 43
         );
44
-        $merged['class'] = implode(' ', static::mergedAttribute('class', ' ', $args));
45
-        $merged['style'] = implode(';', static::mergedAttribute('style', ';', $args));
44
+        $merged['class'] = implode( ' ', static::mergedAttribute( 'class', ' ', $args ) );
45
+        $merged['style'] = implode( ';', static::mergedAttribute( 'style', ';', $args ) );
46 46
         return $merged;
47 47
     }
48 48
 
@@ -51,13 +51,13 @@  discard block
 block discarded – undo
51 51
      * @param string $key
52 52
      * @return array
53 53
      */
54
-    public static function mergedAttribute($key, $delimiter, array $args)
54
+    public static function mergedAttribute( $key, $delimiter, array $args )
55 55
     {
56
-        return array_filter(array_merge(
57
-            explode($delimiter, glsr_get($args, $key)),
58
-            explode($delimiter, glsr_get(static::defaults(), $key)),
59
-            explode($delimiter, glsr_get(static::required(), $key))
60
-        ));
56
+        return array_filter( array_merge(
57
+            explode( $delimiter, glsr_get( $args, $key ) ),
58
+            explode( $delimiter, glsr_get( static::defaults(), $key ) ),
59
+            explode( $delimiter, glsr_get( static::required(), $key ) )
60
+        ) );
61 61
     }
62 62
 
63 63
     /**
@@ -73,6 +73,6 @@  discard block
 block discarded – undo
73 73
      */
74 74
     protected function mergeFieldArgs()
75 75
     {
76
-        $this->builder->args = static::merge($this->builder->args);
76
+        $this->builder->args = static::merge( $this->builder->args );
77 77
     }
78 78
 }
Please login to merge, or discard this patch.
plugin/Modules/Html/Fields/Rating.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,9 +21,9 @@
 block discarded – undo
21 21
      */
22 22
     public static function required()
23 23
     {
24
-        $options = ['' => __('Select a Rating', 'site-reviews')];
25
-        foreach (range(glsr()->constant('MAX_RATING', RatingModule::class), 1) as $rating) {
26
-            $options[$rating] = sprintf(_n('%s Star', '%s Stars', $rating, 'site-reviews'), $rating);
24
+        $options = ['' => __( 'Select a Rating', 'site-reviews' )];
25
+        foreach( range( glsr()->constant( 'MAX_RATING', RatingModule::class ), 1 ) as $rating ) {
26
+            $options[$rating] = sprintf( _n( '%s Star', '%s Stars', $rating, 'site-reviews' ), $rating );
27 27
         }
28 28
         return [
29 29
             'class' => 'glsr-star-rating',
Please login to merge, or discard this patch.
plugin/Modules/Html/Partial.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -10,17 +10,17 @@  discard block
 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
-        $args = apply_filters('site-reviews/partial/args/'.$partialPath, $args);
21
-        $partial = glsr($className)->build($args);
22
-        $partial = apply_filters('site-reviews/rendered/partial', $partial, $partialPath, $args);
23
-        $partial = apply_filters('site-reviews/rendered/partial/'.$partialPath, $partial, $args);
20
+        $args = apply_filters( 'site-reviews/partial/args/'.$partialPath, $args );
21
+        $partial = glsr( $className )->build( $args );
22
+        $partial = apply_filters( 'site-reviews/rendered/partial', $partial, $partialPath, $args );
23
+        $partial = apply_filters( 'site-reviews/rendered/partial/'.$partialPath, $partial, $args );
24 24
         return $partial;
25 25
     }
26 26
 
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
28 28
      * @param string $partialPath
29 29
      * @return void
30 30
      */
31
-    public function render($partialPath, array $args = [])
31
+    public function render( $partialPath, array $args = [] )
32 32
     {
33
-        echo $this->build($partialPath, $args);
33
+        echo $this->build( $partialPath, $args );
34 34
     }
35 35
 }
Please login to merge, or discard this patch.
plugin/Modules/Html/Form.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -8,9 +8,9 @@  discard block
 block discarded – undo
8 8
      * @param string $id
9 9
      * @return string
10 10
      */
11
-    public function buildFields($id)
11
+    public function buildFields( $id )
12 12
     {
13
-        return array_reduce($this->getFields($id), function ($carry, $field) {
13
+        return array_reduce( $this->getFields( $id ), function( $carry, $field ) {
14 14
             return $carry.$field;
15 15
         });
16 16
     }
@@ -19,11 +19,11 @@  discard block
 block discarded – undo
19 19
      * @param string $id
20 20
      * @return array
21 21
      */
22
-    public function getFields($id)
22
+    public function getFields( $id )
23 23
     {
24 24
         $fields = [];
25
-        foreach (glsr()->config('forms/'.$id) as $name => $field) {
26
-            $fields[] = new Field(wp_parse_args($field, ['name' => $name]));
25
+        foreach( glsr()->config( 'forms/'.$id ) as $name => $field ) {
26
+            $fields[] = new Field( wp_parse_args( $field, ['name' => $name] ) );
27 27
         }
28 28
         return $fields;
29 29
     }
@@ -32,8 +32,8 @@  discard block
 block discarded – undo
32 32
      * @param string $id
33 33
      * @return void
34 34
      */
35
-    public function renderFields($id)
35
+    public function renderFields( $id )
36 36
     {
37
-        echo $this->buildFields($id);
37
+        echo $this->buildFields( $id );
38 38
     }
39 39
 }
Please login to merge, or discard this patch.
plugin/Modules/Html/Partials/StarRating.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -9,14 +9,14 @@
 block discarded – undo
9 9
     /**
10 10
      * @return void|string
11 11
      */
12
-    public function build(array $args = [])
12
+    public function build( array $args = [] )
13 13
     {
14 14
         require_once ABSPATH.'wp-admin/includes/template.php';
15 15
         ob_start();
16
-        wp_star_rating($args);
16
+        wp_star_rating( $args );
17 17
         $stars = ob_get_clean();
18 18
         return !glsr()->isAdmin()
19
-            ? str_replace(['star-rating', 'star star'], ['glsr-stars', 'glsr-star glsr-star'], $stars)
19
+            ? str_replace( ['star-rating', 'star star'], ['glsr-stars', 'glsr-star glsr-star'], $stars )
20 20
             : $stars;
21 21
     }
22 22
 }
Please login to merge, or discard this patch.
plugin/Modules/Html/Partials/SiteReviewsSummary.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -28,16 +28,16 @@  discard block
 block discarded – undo
28 28
     /**
29 29
      * @return void|string
30 30
      */
31
-    public function build(array $args = [])
31
+    public function build( array $args = [] )
32 32
     {
33 33
         $this->args = $args;
34
-        $this->ratingCounts = glsr(ReviewManager::class)->getRatingCounts($args);
35
-        if (!array_sum($this->ratingCounts) && $this->isHidden('if_empty')) {
34
+        $this->ratingCounts = glsr( ReviewManager::class )->getRatingCounts( $args );
35
+        if( !array_sum( $this->ratingCounts ) && $this->isHidden( 'if_empty' ) ) {
36 36
             return;
37 37
         }
38
-        $this->averageRating = glsr(Rating::class)->getAverage($this->ratingCounts);
38
+        $this->averageRating = glsr( Rating::class )->getAverage( $this->ratingCounts );
39 39
         $this->generateSchema();
40
-        return glsr(Template::class)->build('templates/reviews-summary', [
40
+        return glsr( Template::class )->build( 'templates/reviews-summary', [
41 41
             'context' => [
42 42
                 'assigned_to' => $this->args['assigned_to'],
43 43
                 'category' => $this->args['category'],
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
                 'stars' => $this->buildStars(),
49 49
                 'text' => $this->buildText(),
50 50
             ],
51
-        ]);
51
+        ] );
52 52
     }
53 53
 
54 54
     /**
@@ -56,35 +56,35 @@  discard block
 block discarded – undo
56 56
      */
57 57
     protected function buildPercentage()
58 58
     {
59
-        if ($this->isHidden('bars')) {
59
+        if( $this->isHidden( 'bars' ) ) {
60 60
             return;
61 61
         }
62
-        $percentages = preg_filter('/$/', '%', glsr(Rating::class)->getPercentages($this->ratingCounts));
63
-        $bars = array_reduce(range(glsr()->constant('MAX_RATING', Rating::class), 1), function ($carry, $level) use ($percentages) {
64
-            $label = $this->buildPercentageLabel($this->args['labels'][$level]);
65
-            $background = $this->buildPercentageBackground($percentages[$level]);
66
-            $count = apply_filters('site-reviews/summary/counts',
62
+        $percentages = preg_filter( '/$/', '%', glsr( Rating::class )->getPercentages( $this->ratingCounts ) );
63
+        $bars = array_reduce( range( glsr()->constant( 'MAX_RATING', Rating::class ), 1 ), function( $carry, $level ) use ($percentages) {
64
+            $label = $this->buildPercentageLabel( $this->args['labels'][$level] );
65
+            $background = $this->buildPercentageBackground( $percentages[$level] );
66
+            $count = apply_filters( 'site-reviews/summary/counts',
67 67
                 $percentages[$level],
68 68
                 $this->ratingCounts[$level]
69 69
             );
70
-            $percent = $this->buildPercentageCount($count);
71
-            return $carry.glsr(Builder::class)->div($label.$background.$percent, [
70
+            $percent = $this->buildPercentageCount( $count );
71
+            return $carry.glsr( Builder::class )->div( $label.$background.$percent, [
72 72
                 'class' => 'glsr-bar',
73
-            ]);
73
+            ] );
74 74
         });
75
-        return $this->wrap('percentage', $bars);
75
+        return $this->wrap( 'percentage', $bars );
76 76
     }
77 77
 
78 78
     /**
79 79
      * @param string $percent
80 80
      * @return string
81 81
      */
82
-    protected function buildPercentageBackground($percent)
82
+    protected function buildPercentageBackground( $percent )
83 83
     {
84
-        $backgroundPercent = glsr(Builder::class)->span([
84
+        $backgroundPercent = glsr( Builder::class )->span( [
85 85
             'class' => 'glsr-bar-background-percent',
86 86
             'style' => 'width:'.$percent,
87
-        ]);
87
+        ] );
88 88
         return '<span class="glsr-bar-background">'.$backgroundPercent.'</span>';
89 89
     }
90 90
 
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
      * @param string $count
93 93
      * @return string
94 94
      */
95
-    protected function buildPercentageCount($count)
95
+    protected function buildPercentageCount( $count )
96 96
     {
97 97
         return '<span class="glsr-bar-percent">'.$count.'</span>';
98 98
     }
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
      * @param string $label
102 102
      * @return string
103 103
      */
104
-    protected function buildPercentageLabel($label)
104
+    protected function buildPercentageLabel( $label )
105 105
     {
106 106
         return '<span class="glsr-bar-label">'.$label.'</span>';
107 107
     }
@@ -111,10 +111,10 @@  discard block
 block discarded – undo
111 111
      */
112 112
     protected function buildRating()
113 113
     {
114
-        if ($this->isHidden('rating')) {
114
+        if( $this->isHidden( 'rating' ) ) {
115 115
             return;
116 116
         }
117
-        return $this->wrap('rating', '<span>'.$this->averageRating.'</span>');
117
+        return $this->wrap( 'rating', '<span>'.$this->averageRating.'</span>' );
118 118
     }
119 119
 
120 120
     /**
@@ -122,11 +122,11 @@  discard block
 block discarded – undo
122 122
      */
123 123
     protected function buildStars()
124 124
     {
125
-        if ($this->isHidden('stars')) {
125
+        if( $this->isHidden( 'stars' ) ) {
126 126
             return;
127 127
         }
128
-        $stars = glsr_star_rating($this->averageRating);
129
-        return $this->wrap('stars', $stars);
128
+        $stars = glsr_star_rating( $this->averageRating );
129
+        return $this->wrap( 'stars', $stars );
130 130
     }
131 131
 
132 132
     /**
@@ -134,11 +134,11 @@  discard block
 block discarded – undo
134 134
      */
135 135
     protected function buildText()
136 136
     {
137
-        if ($this->isHidden('summary')) {
137
+        if( $this->isHidden( 'summary' ) ) {
138 138
             return;
139 139
         }
140
-        $count = intval(array_sum($this->ratingCounts));
141
-        if (empty($this->args['text'])) {
140
+        $count = intval( array_sum( $this->ratingCounts ) );
141
+        if( empty($this->args['text']) ) {
142 142
             // @todo document this change
143 143
             $this->args['text'] = _nx(
144 144
                 '{rating} out of {max} stars (based on {num} review)',
@@ -150,10 +150,10 @@  discard block
 block discarded – undo
150 150
         }
151 151
         $summary = str_replace(
152 152
             ['{rating}', '{max}', '{num}'],
153
-            [$this->averageRating, glsr()->constant('MAX_RATING', Rating::class), $count],
153
+            [$this->averageRating, glsr()->constant( 'MAX_RATING', Rating::class ), $count],
154 154
             $this->args['text']
155 155
         );
156
-        return $this->wrap('text', '<span>'.$summary.'</span>');
156
+        return $this->wrap( 'text', '<span>'.$summary.'</span>' );
157 157
     }
158 158
 
159 159
     /**
@@ -161,11 +161,11 @@  discard block
 block discarded – undo
161 161
      */
162 162
     protected function generateSchema()
163 163
     {
164
-        if (!wp_validate_boolean($this->args['schema'])) {
164
+        if( !wp_validate_boolean( $this->args['schema'] ) ) {
165 165
             return;
166 166
         }
167
-        glsr(Schema::class)->store(
168
-            glsr(Schema::class)->buildSummary($this->args)
167
+        glsr( Schema::class )->store(
168
+            glsr( Schema::class )->buildSummary( $this->args )
169 169
         );
170 170
     }
171 171
 
@@ -174,16 +174,16 @@  discard block
 block discarded – undo
174 174
      */
175 175
     protected function getClass()
176 176
     {
177
-        return trim('glsr-summary glsr-default '.$this->args['class']);
177
+        return trim( 'glsr-summary glsr-default '.$this->args['class'] );
178 178
     }
179 179
 
180 180
     /**
181 181
      * @param string $key
182 182
      * @return bool
183 183
      */
184
-    protected function isHidden($key)
184
+    protected function isHidden( $key )
185 185
     {
186
-        return in_array($key, $this->args['hide']);
186
+        return in_array( $key, $this->args['hide'] );
187 187
     }
188 188
 
189 189
     /**
@@ -191,10 +191,10 @@  discard block
 block discarded – undo
191 191
      * @param string $value
192 192
      * @return string
193 193
      */
194
-    protected function wrap($key, $value)
194
+    protected function wrap( $key, $value )
195 195
     {
196
-        return glsr(Builder::class)->div($value, [
196
+        return glsr( Builder::class )->div( $value, [
197 197
             'class' => 'glsr-summary-'.$key,
198
-        ]);
198
+        ] );
199 199
     }
200 200
 }
Please login to merge, or discard this patch.