Test Failed
Push — tmp ( 15f615...89cc97 )
by Paul
10:31 queued 04:40
created
plugin/Contracts/MultilingualContract.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,12 +8,12 @@
 block discarded – undo
8 8
      * @param int|string $postId
9 9
      * @return int
10 10
      */
11
-    public function getPostId($postId);
11
+    public function getPostId( $postId );
12 12
 
13 13
     /**
14 14
      * @return array
15 15
      */
16
-    public function getPostIds(array $postIds);
16
+    public function getPostIds( array $postIds );
17 17
 
18 18
     /**
19 19
      * @return bool
Please login to merge, or discard this patch.
views/pages/welcome/index.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,23 +1,23 @@
 block discarded – undo
1
-<?php defined('WPINC') || die; ?>
1
+<?php defined( 'WPINC' ) || die; ?>
2 2
 
3 3
 <div class="glsr-welcome wrap about-wrap about-wrap-content">
4 4
     <h1>Welcome to <?= glsr()->name; ?></h1>
5 5
     <div class="about-text">Site Reviews is a free WordPress review plugin with advanced features that makes it easy to manage reviews on your website. Follow the instructions below to get started!</div>
6 6
     <div class="wp-badge">Version <?= glsr()->version; ?></div>
7 7
     <p class="about-buttons">
8
-        <a class="button" href="<?= admin_url('edit.php?post_type='.glsr()->post_type.'&page=documentation'); ?>">Documentation</a>
8
+        <a class="button" href="<?= admin_url( 'edit.php?post_type='.glsr()->post_type.'&page=documentation' ); ?>">Documentation</a>
9 9
         <a class="button" href="https://wordpress.org/support/plugin/site-reviews/">Support</a>
10 10
         <a target="_blank" class="button" href="https://www.facebook.com/sharer/sharer.php?u=https%3A//geminilabs.io/site-reviews"><span class="dashicons dashicons-facebook-alt"></span> Share</a>
11 11
         <a target="_blank" class="button" href="https://twitter.com/intent/tweet?text=Site Reviews is a fantastic WordPress review plugin with advanced features that makes it easy to manage reviews on your website.&url=https://geminilabs.io/site-reviews&hashtags=WordPress,reviewplugins,"><span class="dashicons dashicons-twitter"></span> Tweet</a>
12 12
     </p>
13 13
     <nav class="glsr-nav-tab-wrapper nav-tab-wrapper">
14
-        <?php foreach ($tabs as $id => $title) : ?>
14
+        <?php foreach( $tabs as $id => $title ) : ?>
15 15
         <a class="glsr-nav-tab nav-tab" href="#<?= $id; ?>"><?= $title; ?></a>
16 16
         <?php endforeach; ?>
17 17
     </nav>
18
-    <?php foreach ($tabs as $id => $title) : ?>
18
+    <?php foreach( $tabs as $id => $title ) : ?>
19 19
     <div class="glsr-nav-view ui-tabs-hide" id="<?= $id; ?>">
20
-        <?php $template->render('pages/welcome/'.$id, $data); ?>
20
+        <?php $template->render( 'pages/welcome/'.$id, $data ); ?>
21 21
     </div>
22 22
     <?php endforeach; ?>
23 23
     <input type="hidden" name="_active_tab">
Please login to merge, or discard this patch.
plugin/Contracts/PartialContract.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,5 +7,5 @@
 block discarded – undo
7 7
     /**
8 8
      * @return string
9 9
      */
10
-    public function build(array $args = []);
10
+    public function build( array $args = [] );
11 11
 }
Please login to merge, or discard this patch.
views/pages/welcome/whatsnew.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1
-<?php defined('WPINC') || die; ?>
1
+<?php defined( 'WPINC' ) || die; ?>
2 2
 
3 3
 <p class="about-description">We hope you love the changes in this new release!</p>
4 4
 <div class="is-fullwidth">
Please login to merge, or discard this patch.
plugin/Database/GlobalCountsManager.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
     public function __construct()
16 16
     {
17
-        $this->manager = glsr(CountsManager::class);
17
+        $this->manager = glsr( CountsManager::class );
18 18
     }
19 19
 
20 20
     /**
@@ -28,13 +28,13 @@  discard block
 block discarded – undo
28 28
     /**
29 29
      * @return void
30 30
      */
31
-    public function decrease(Review $review)
31
+    public function decrease( Review $review )
32 32
     {
33
-        $this->update($this->manager->decreaseRating(
33
+        $this->update( $this->manager->decreaseRating(
34 34
             $this->get(),
35 35
             $review->review_type,
36 36
             $review->rating
37
-        ));
37
+        ) );
38 38
     }
39 39
 
40 40
     /**
@@ -42,9 +42,9 @@  discard block
 block discarded – undo
42 42
      */
43 43
     public function get()
44 44
     {
45
-        $counts = glsr(OptionManager::class)->get('counts', []);
46
-        if (!is_array($counts)) {
47
-            glsr_log()->error('Review counts is not an array; possibly due to incorrectly imported reviews.')->debug($counts);
45
+        $counts = glsr( OptionManager::class )->get( 'counts', [] );
46
+        if( !is_array( $counts ) ) {
47
+            glsr_log()->error( 'Review counts is not an array; possibly due to incorrectly imported reviews.' )->debug( $counts );
48 48
             return [];
49 49
         }
50 50
         return $counts;
@@ -53,20 +53,20 @@  discard block
 block discarded – undo
53 53
     /**
54 54
      * @return void
55 55
      */
56
-    public function increase(Review $review)
56
+    public function increase( Review $review )
57 57
     {
58
-        if (empty($counts = $this->get())) {
58
+        if( empty($counts = $this->get()) ) {
59 59
             $counts = $this->build();
60 60
         }
61
-        $this->update($this->manager->increaseRating($counts, $review->review_type, $review->rating));
61
+        $this->update( $this->manager->increaseRating( $counts, $review->review_type, $review->rating ) );
62 62
     }
63 63
 
64 64
     /**
65 65
      * @return void
66 66
      */
67
-    public function update(array $reviewCounts)
67
+    public function update( array $reviewCounts )
68 68
     {
69
-        glsr(OptionManager::class)->set('counts', $reviewCounts);
69
+        glsr( OptionManager::class )->set( 'counts', $reviewCounts );
70 70
     }
71 71
 
72 72
     /**
@@ -74,6 +74,6 @@  discard block
 block discarded – undo
74 74
      */
75 75
     public function updateAll()
76 76
     {
77
-        $this->update($this->build());
77
+        $this->update( $this->build() );
78 78
     }
79 79
 }
Please login to merge, or discard this patch.
plugin/Modules/Date.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -31,19 +31,19 @@  discard block
 block discarded – undo
31 31
      * @param string $format
32 32
      * @return bool
33 33
      */
34
-    public function isDate($date, $format = 'Y-m-d H:i:s')
34
+    public function isDate( $date, $format = 'Y-m-d H:i:s' )
35 35
     {
36
-        $datetime = DateTime::createFromFormat($format, $date);
37
-        return $datetime && $date == $datetime->format($format);
36
+        $datetime = DateTime::createFromFormat( $format, $date );
37
+        return $datetime && $date == $datetime->format( $format );
38 38
     }
39 39
 
40 40
     /**
41 41
      * @param mixed $date
42 42
      * @return bool
43 43
      */
44
-    public function isTimestamp($date)
44
+    public function isTimestamp( $date )
45 45
     {
46
-        return ctype_digit($date)
46
+        return ctype_digit( $date )
47 47
             ? true
48 48
             : false;
49 49
     }
@@ -53,10 +53,10 @@  discard block
 block discarded – undo
53 53
      * @param string $fallback
54 54
      * @return string
55 55
      */
56
-    public function localized($date, $fallback = '')
56
+    public function localized( $date, $fallback = '' )
57 57
     {
58
-        return $this->isDate($date) || $this->isTimestamp($date)
59
-            ? date_i18n('Y-m-d H:i', $date)
58
+        return $this->isDate( $date ) || $this->isTimestamp( $date )
59
+            ? date_i18n( 'Y-m-d H:i', $date )
60 60
             : $fallback;
61 61
     }
62 62
 
@@ -64,29 +64,29 @@  discard block
 block discarded – undo
64 64
      * @param mixed $date
65 65
      * @return string
66 66
      */
67
-    public function relative($date)
67
+    public function relative( $date )
68 68
     {
69
-        if (!$this->isDate($date)) {
69
+        if( !$this->isDate( $date ) ) {
70 70
             return '';
71 71
         }
72
-        $diff = time() - strtotime($date);
73
-        foreach (static::$TIME_PERIODS as $i => $timePeriod) {
74
-            if ($diff > $timePeriod[0]) {
72
+        $diff = time() - strtotime( $date );
73
+        foreach( static::$TIME_PERIODS as $i => $timePeriod ) {
74
+            if( $diff > $timePeriod[0] ) {
75 75
                 continue;
76 76
             }
77
-            $unit = intval(floor($diff / $timePeriod[1]));
77
+            $unit = intval( floor( $diff / $timePeriod[1] ) );
78 78
             $relativeDates = [
79
-                _n('%s second ago', '%s seconds ago', $unit, 'site-reviews'),
80
-                _n('%s minute ago', '%s minutes ago', $unit, 'site-reviews'),
81
-                _n('an hour ago', '%s hours ago', $unit, 'site-reviews'),
82
-                _n('yesterday', '%s days ago', $unit, 'site-reviews'),
83
-                _n('a week ago', '%s weeks ago', $unit, 'site-reviews'),
84
-                _n('%s month ago', '%s months ago', $unit, 'site-reviews'),
85
-                _n('%s year ago', '%s years ago', $unit, 'site-reviews'),
79
+                _n( '%s second ago', '%s seconds ago', $unit, 'site-reviews' ),
80
+                _n( '%s minute ago', '%s minutes ago', $unit, 'site-reviews' ),
81
+                _n( 'an hour ago', '%s hours ago', $unit, 'site-reviews' ),
82
+                _n( 'yesterday', '%s days ago', $unit, 'site-reviews' ),
83
+                _n( 'a week ago', '%s weeks ago', $unit, 'site-reviews' ),
84
+                _n( '%s month ago', '%s months ago', $unit, 'site-reviews' ),
85
+                _n( '%s year ago', '%s years ago', $unit, 'site-reviews' ),
86 86
             ];
87 87
             $relativeDate = $relativeDates[$i];
88
-            return Str::contains($relativeDate, '%s')
89
-                ? sprintf($relativeDate, $unit)
88
+            return Str::contains( $relativeDate, '%s' )
89
+                ? sprintf( $relativeDate, $unit )
90 90
                 : $relativeDate;
91 91
         }
92 92
     }
Please login to merge, or discard this patch.
plugin/Modules/Migrations/Migrate_4_0_2.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -15,11 +15,11 @@  discard block
 block discarded – undo
15 15
     public function deleteSessions()
16 16
     {
17 17
         global $wpdb;
18
-        $wpdb->query("
18
+        $wpdb->query( "
19 19
             DELETE
20 20
             FROM {$wpdb->options}
21 21
             WHERE option_name LIKE '_glsr_session%'
22
-        ");
22
+        " );
23 23
     }
24 24
 
25 25
     /**
@@ -27,23 +27,23 @@  discard block
 block discarded – undo
27 27
      */
28 28
     public function migrateSettings()
29 29
     {
30
-        if ($settings = get_option(OptionManager::databaseKey(3))) {
31
-            $multilingual = 'yes' == Arr::get($settings, 'settings.general.support.polylang')
30
+        if( $settings = get_option( OptionManager::databaseKey( 3 ) ) ) {
31
+            $multilingual = 'yes' == Arr::get( $settings, 'settings.general.support.polylang' )
32 32
                 ? 'polylang'
33 33
                 : '';
34
-            $settings = Arr::set($settings, 'settings.general.multilingual', $multilingual);
35
-            $settings = Arr::set($settings, 'settings.general.rebusify', 'no');
36
-            $settings = Arr::set($settings, 'settings.general.rebusify_email', '');
37
-            $settings = Arr::set($settings, 'settings.general.rebusify_serial', '');
38
-            $settings = Arr::set($settings, 'settings.reviews.name.format', '');
39
-            $settings = Arr::set($settings, 'settings.reviews.name.initial', '');
40
-            $settings = Arr::set($settings, 'settings.submissions.blacklist.integration', '');
41
-            $settings = Arr::set($settings, 'settings.submissions.limit', '');
42
-            $settings = Arr::set($settings, 'settings.submissions.limit_whitelist.email', '');
43
-            $settings = Arr::set($settings, 'settings.submissions.limit_whitelist.ip_address', '');
44
-            $settings = Arr::set($settings, 'settings.submissions.limit_whitelist.username', '');
34
+            $settings = Arr::set( $settings, 'settings.general.multilingual', $multilingual );
35
+            $settings = Arr::set( $settings, 'settings.general.rebusify', 'no' );
36
+            $settings = Arr::set( $settings, 'settings.general.rebusify_email', '' );
37
+            $settings = Arr::set( $settings, 'settings.general.rebusify_serial', '' );
38
+            $settings = Arr::set( $settings, 'settings.reviews.name.format', '' );
39
+            $settings = Arr::set( $settings, 'settings.reviews.name.initial', '' );
40
+            $settings = Arr::set( $settings, 'settings.submissions.blacklist.integration', '' );
41
+            $settings = Arr::set( $settings, 'settings.submissions.limit', '' );
42
+            $settings = Arr::set( $settings, 'settings.submissions.limit_whitelist.email', '' );
43
+            $settings = Arr::set( $settings, 'settings.submissions.limit_whitelist.ip_address', '' );
44
+            $settings = Arr::set( $settings, 'settings.submissions.limit_whitelist.username', '' );
45 45
             unset($settings['settings']['general']['support']);
46
-            update_option(OptionManager::databaseKey(4), $settings);
46
+            update_option( OptionManager::databaseKey( 4 ), $settings );
47 47
         }
48 48
     }
49 49
 
@@ -53,16 +53,16 @@  discard block
 block discarded – undo
53 53
     public function protectMetaKeys()
54 54
     {
55 55
         global $wpdb;
56
-        $keys = array_keys(glsr(CreateReviewDefaults::class)->defaults());
57
-        $keys = implode("','", $keys);
56
+        $keys = array_keys( glsr( CreateReviewDefaults::class )->defaults() );
57
+        $keys = implode( "','", $keys );
58 58
         $postType = Application::POST_TYPE;
59
-        $wpdb->query("
59
+        $wpdb->query( "
60 60
             UPDATE {$wpdb->postmeta} pm
61 61
             INNER JOIN {$wpdb->posts} p ON p.id = pm.post_id
62 62
             SET pm.meta_key = CONCAT('_', pm.meta_key)
63 63
             WHERE pm.meta_key IN ('{$keys}')
64 64
             AND p.post_type = '{$postType}'
65
-        ");
65
+        " );
66 66
     }
67 67
 
68 68
     /**
@@ -73,6 +73,6 @@  discard block
 block discarded – undo
73 73
         $this->migrateSettings();
74 74
         $this->protectMetaKeys();
75 75
         $this->deleteSessions();
76
-        delete_transient(Application::ID.'_cloudflare_ips');
76
+        delete_transient( Application::ID.'_cloudflare_ips' );
77 77
     }
78 78
 }
Please login to merge, or discard this patch.
plugin/Database/CountsManager.php 1 patch
Spacing   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -22,16 +22,16 @@  discard block
 block discarded – undo
22 22
     /**
23 23
      * @return array
24 24
      */
25
-    public function buildCounts(array $args = [])
25
+    public function buildCounts( array $args = [] )
26 26
     {
27 27
         $counts = [
28 28
             'local' => $this->generateEmptyCountsArray(),
29 29
         ];
30
-        $query = $this->queryReviews($args);
31
-        while ($query) {
32
-            $counts = $this->populateCountsFromQuery($query, $counts);
30
+        $query = $this->queryReviews( $args );
31
+        while( $query ) {
32
+            $counts = $this->populateCountsFromQuery( $query, $counts );
33 33
             $query = $query->has_more
34
-                ? $this->queryReviews($args, end($query->reviews)->ID)
34
+                ? $this->queryReviews( $args, end( $query->reviews )->ID )
35 35
                 : false;
36 36
         }
37 37
         return $counts;
@@ -40,11 +40,11 @@  discard block
 block discarded – undo
40 40
     /**
41 41
      * @return void
42 42
      */
43
-    public function decreaseAll(Review $review)
43
+    public function decreaseAll( Review $review )
44 44
     {
45
-        glsr(GlobalCountsManager::class)->decrease($review);
46
-        glsr(PostCountsManager::class)->decrease($review);
47
-        glsr(TermCountsManager::class)->decrease($review);
45
+        glsr( GlobalCountsManager::class )->decrease( $review );
46
+        glsr( PostCountsManager::class )->decrease( $review );
47
+        glsr( TermCountsManager::class )->decrease( $review );
48 48
     }
49 49
 
50 50
     /**
@@ -52,10 +52,10 @@  discard block
 block discarded – undo
52 52
      * @param int $rating
53 53
      * @return array
54 54
      */
55
-    public function decreaseRating(array $reviewCounts, $type, $rating)
55
+    public function decreaseRating( array $reviewCounts, $type, $rating )
56 56
     {
57
-        if (isset($reviewCounts[$type][$rating])) {
58
-            $reviewCounts[$type][$rating] = max(0, $reviewCounts[$type][$rating] - 1);
57
+        if( isset($reviewCounts[$type][$rating]) ) {
58
+            $reviewCounts[$type][$rating] = max( 0, $reviewCounts[$type][$rating] - 1 );
59 59
         }
60 60
         return $reviewCounts;
61 61
     }
@@ -63,16 +63,16 @@  discard block
 block discarded – undo
63 63
     /**
64 64
      * @return array
65 65
      */
66
-    public function flatten(array $reviewCounts, array $args = [])
66
+    public function flatten( array $reviewCounts, array $args = [] )
67 67
     {
68 68
         $counts = [];
69
-        array_walk_recursive($reviewCounts, function ($num, $index) use (&$counts) {
70
-            $counts[$index] = $num + intval(Arr::get($counts, $index, 0));
69
+        array_walk_recursive( $reviewCounts, function( $num, $index ) use (&$counts) {
70
+            $counts[$index] = $num + intval( Arr::get( $counts, $index, 0 ) );
71 71
         });
72
-        $min = Arr::get($args, 'min', glsr()->constant('MIN_RATING', Rating::class));
73
-        $max = Arr::get($args, 'max', glsr()->constant('MAX_RATING', Rating::class));
74
-        foreach ($counts as $index => &$num) {
75
-            if (!Helper::inRange($index, $min, $max)) {
72
+        $min = Arr::get( $args, 'min', glsr()->constant( 'MIN_RATING', Rating::class ) );
73
+        $max = Arr::get( $args, 'max', glsr()->constant( 'MAX_RATING', Rating::class ) );
74
+        foreach( $counts as $index => &$num ) {
75
+            if( !Helper::inRange( $index, $min, $max ) ) {
76 76
                 $num = 0;
77 77
             }
78 78
         }
@@ -82,23 +82,23 @@  discard block
 block discarded – undo
82 82
     /**
83 83
      * @return array
84 84
      */
85
-    public function getCounts(array $args = [])
85
+    public function getCounts( array $args = [] )
86 86
     {
87
-        $args = $this->normalizeArgs($args);
88
-        $counts = $this->hasMixedAssignment($args)
89
-            ? $this->buildCounts($args) // force query the database
90
-            : $this->get($args);
91
-        return $this->normalize($counts);
87
+        $args = $this->normalizeArgs( $args );
88
+        $counts = $this->hasMixedAssignment( $args )
89
+            ? $this->buildCounts( $args ) // force query the database
90
+            : $this->get( $args );
91
+        return $this->normalize( $counts );
92 92
     }
93 93
 
94 94
     /**
95 95
      * @return void
96 96
      */
97
-    public function increaseAll(Review $review)
97
+    public function increaseAll( Review $review )
98 98
     {
99
-        glsr(GlobalCountsManager::class)->increase($review);
100
-        glsr(PostCountsManager::class)->increase($review);
101
-        glsr(TermCountsManager::class)->increase($review);
99
+        glsr( GlobalCountsManager::class )->increase( $review );
100
+        glsr( PostCountsManager::class )->increase( $review );
101
+        glsr( TermCountsManager::class )->increase( $review );
102 102
     }
103 103
 
104 104
     /**
@@ -106,16 +106,16 @@  discard block
 block discarded – undo
106 106
      * @param int $rating
107 107
      * @return array
108 108
      */
109
-    public function increaseRating(array $reviewCounts, $type, $rating)
109
+    public function increaseRating( array $reviewCounts, $type, $rating )
110 110
     {
111
-        if (!array_key_exists($type, glsr()->reviewTypes)) {
111
+        if( !array_key_exists( $type, glsr()->reviewTypes ) ) {
112 112
             return $reviewCounts;
113 113
         }
114
-        if (!array_key_exists($type, $reviewCounts)) {
114
+        if( !array_key_exists( $type, $reviewCounts ) ) {
115 115
             $reviewCounts[$type] = [];
116 116
         }
117
-        $reviewCounts = $this->normalize($reviewCounts);
118
-        $reviewCounts[$type][$rating] = intval($reviewCounts[$type][$rating]) + 1;
117
+        $reviewCounts = $this->normalize( $reviewCounts );
118
+        $reviewCounts[$type][$rating] = intval( $reviewCounts[$type][$rating] ) + 1;
119 119
         return $reviewCounts;
120 120
     }
121 121
 
@@ -124,26 +124,26 @@  discard block
 block discarded – undo
124 124
      */
125 125
     public function updateAll()
126 126
     {
127
-        glsr(GlobalCountsManager::class)->updateAll();
128
-        glsr(PostCountsManager::class)->updateAll();
129
-        glsr(TermCountsManager::class)->updateAll();
130
-        glsr(OptionManager::class)->set('last_review_count', current_time('timestamp'));
127
+        glsr( GlobalCountsManager::class )->updateAll();
128
+        glsr( PostCountsManager::class )->updateAll();
129
+        glsr( TermCountsManager::class )->updateAll();
130
+        glsr( OptionManager::class )->set( 'last_review_count', current_time( 'timestamp' ) );
131 131
     }
132 132
 
133 133
     /**
134 134
      * @return array
135 135
      */
136
-    protected function combine(array $results)
136
+    protected function combine( array $results )
137 137
     {
138
-        if (!wp_is_numeric_array($results)) {
138
+        if( !wp_is_numeric_array( $results ) ) {
139 139
             return $results;
140 140
         }
141
-        $mergedKeys = array_keys(array_merge(...$results));
142
-        $counts = array_fill_keys($mergedKeys, $this->generateEmptyCountsArray());
143
-        foreach ($results as $typeRatings) {
144
-            foreach ($typeRatings as $type => $ratings) {
145
-                foreach ($ratings as $index => $rating) {
146
-                    $counts[$type][$index] = intval($rating) + $counts[$type][$index];
141
+        $mergedKeys = array_keys( array_merge( ...$results ) );
142
+        $counts = array_fill_keys( $mergedKeys, $this->generateEmptyCountsArray() );
143
+        foreach( $results as $typeRatings ) {
144
+            foreach( $typeRatings as $type => $ratings ) {
145
+                foreach( $ratings as $index => $rating ) {
146
+                    $counts[$type][$index] = intval( $rating ) + $counts[$type][$index];
147 147
                 }
148 148
             }
149 149
         }
@@ -155,32 +155,32 @@  discard block
 block discarded – undo
155 155
      */
156 156
     protected function generateEmptyCountsArray()
157 157
     {
158
-        return array_fill_keys(range(0, glsr()->constant('MAX_RATING', Rating::class)), 0);
158
+        return array_fill_keys( range( 0, glsr()->constant( 'MAX_RATING', Rating::class ) ), 0 );
159 159
     }
160 160
 
161 161
     /**
162 162
      * @return array
163 163
      */
164
-    protected function get($args)
164
+    protected function get( $args )
165 165
     {
166 166
         $results = [];
167
-        foreach ($args['post_ids'] as $postId) {
168
-            $results[] = glsr(PostCountsManager::class)->get($postId);
167
+        foreach( $args['post_ids'] as $postId ) {
168
+            $results[] = glsr( PostCountsManager::class )->get( $postId );
169 169
         }
170
-        foreach ($args['term_ids'] as $termId) {
171
-            $results[] = glsr(TermCountsManager::class)->get($termId);
170
+        foreach( $args['term_ids'] as $termId ) {
171
+            $results[] = glsr( TermCountsManager::class )->get( $termId );
172 172
         }
173
-        if (empty($results)) {
174
-            $results[] = glsr(GlobalCountsManager::class)->get();
173
+        if( empty($results) ) {
174
+            $results[] = glsr( GlobalCountsManager::class )->get();
175 175
         }
176 176
         $results[] = ['local' => $this->generateEmptyCountsArray()]; // make sure there is a fallback
177
-        return $this->combine($results);
177
+        return $this->combine( $results );
178 178
     }
179 179
 
180 180
     /**
181 181
      * @return bool
182 182
      */
183
-    protected function hasMixedAssignment(array $args)
183
+    protected function hasMixedAssignment( array $args )
184 184
     {
185 185
         return !empty($args['post_ids']) && !empty($args['term_ids']);
186 186
     }
@@ -188,15 +188,15 @@  discard block
 block discarded – undo
188 188
     /**
189 189
      * @return array
190 190
      */
191
-    protected function normalize(array $reviewCounts)
191
+    protected function normalize( array $reviewCounts )
192 192
     {
193
-        foreach ($reviewCounts as &$counts) {
194
-            foreach (array_keys($this->generateEmptyCountsArray()) as $index) {
195
-                if (!isset($counts[$index])) {
193
+        foreach( $reviewCounts as &$counts ) {
194
+            foreach( array_keys( $this->generateEmptyCountsArray() ) as $index ) {
195
+                if( !isset($counts[$index]) ) {
196 196
                     $counts[$index] = 0;
197 197
                 }
198 198
             }
199
-            ksort($counts);
199
+            ksort( $counts );
200 200
         }
201 201
         return $reviewCounts;
202 202
     }
@@ -204,15 +204,15 @@  discard block
 block discarded – undo
204 204
     /**
205 205
      * @return array
206 206
      */
207
-    protected function normalizeArgs(array $args)
207
+    protected function normalizeArgs( array $args )
208 208
     {
209
-        $args = wp_parse_args(array_filter($args), [
209
+        $args = wp_parse_args( array_filter( $args ), [
210 210
             'post_ids' => [],
211 211
             'term_ids' => [],
212 212
             'type' => 'local',
213
-        ]);
214
-        $args['post_ids'] = glsr(Multilingual::class)->getPostIds($args['post_ids']);
215
-        $args['type'] = $this->normalizeType($args['type']);
213
+        ] );
214
+        $args['post_ids'] = glsr( Multilingual::class )->getPostIds( $args['post_ids'] );
215
+        $args['type'] = $this->normalizeType( $args['type'] );
216 216
         return $args;
217 217
     }
218 218
 
@@ -220,9 +220,9 @@  discard block
 block discarded – undo
220 220
      * @param string $type
221 221
      * @return string
222 222
      */
223
-    protected function normalizeType($type)
223
+    protected function normalizeType( $type )
224 224
     {
225
-        return empty($type) || !is_string($type)
225
+        return empty($type) || !is_string( $type )
226 226
             ? 'local'
227 227
             : $type;
228 228
     }
@@ -231,11 +231,11 @@  discard block
 block discarded – undo
231 231
      * @param object $query
232 232
      * @return array
233 233
      */
234
-    protected function populateCountsFromQuery($query, array $counts)
234
+    protected function populateCountsFromQuery( $query, array $counts )
235 235
     {
236
-        foreach ($query->reviews as $review) {
237
-            $type = $this->normalizeType($review->type);
238
-            if (!array_key_exists($type, $counts)) {
236
+        foreach( $query->reviews as $review ) {
237
+            $type = $this->normalizeType( $review->type );
238
+            if( !array_key_exists( $type, $counts ) ) {
239 239
                 $counts[$type] = $this->generateEmptyCountsArray();
240 240
             }
241 241
             ++$counts[$type][$review->rating];
@@ -247,13 +247,13 @@  discard block
 block discarded – undo
247 247
      * @param int $lastPostId
248 248
      * @return object
249 249
      */
250
-    protected function queryReviews(array $args = [], $lastPostId = 0)
250
+    protected function queryReviews( array $args = [], $lastPostId = 0 )
251 251
     {
252
-        $reviews = glsr(SqlQueries::class)->getReviewCounts($args, $lastPostId, static::LIMIT);
253
-        $hasMore = is_array($reviews)
254
-            ? count($reviews) == static::LIMIT
252
+        $reviews = glsr( SqlQueries::class )->getReviewCounts( $args, $lastPostId, static::LIMIT );
253
+        $hasMore = is_array( $reviews )
254
+            ? count( $reviews ) == static::LIMIT
255 255
             : false;
256
-        return (object) [
256
+        return (object)[
257 257
             'has_more' => $hasMore,
258 258
             'reviews' => $reviews,
259 259
         ];
Please login to merge, or discard this patch.
plugin/Modules/Migrations/Migrate_4_4_0.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,6 +11,6 @@
 block discarded – undo
11 11
      */
12 12
     public function run()
13 13
     {
14
-        glsr(Role::class)->resetAll();
14
+        glsr( Role::class )->resetAll();
15 15
     }
16 16
 }
Please login to merge, or discard this patch.