Passed
Push — master ( ccb079...7f3bcc )
by Paul
07:26
created
plugin/Reviews.php 2 patches
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -9,65 +9,65 @@
 block discarded – undo
9 9
 
10 10
 class Reviews extends ArrayObject
11 11
 {
12
-    /**
13
-     * @var array
14
-     */
15
-    public $args;
12
+	/**
13
+	 * @var array
14
+	 */
15
+	public $args;
16 16
 
17
-    /**
18
-     * @var int
19
-     */
20
-    public $max_num_pages;
17
+	/**
18
+	 * @var int
19
+	 */
20
+	public $max_num_pages;
21 21
 
22
-    /**
23
-     * @var array
24
-     */
25
-    public $reviews;
22
+	/**
23
+	 * @var array
24
+	 */
25
+	public $reviews;
26 26
 
27
-    public function __construct(array $reviews, $maxPageCount, array $args)
28
-    {
29
-        $this->args = $args;
30
-        $this->max_num_pages = $maxPageCount;
31
-        $this->reviews = $reviews;
32
-        parent::__construct($reviews, ArrayObject::STD_PROP_LIST | ArrayObject::ARRAY_AS_PROPS);
33
-    }
27
+	public function __construct(array $reviews, $maxPageCount, array $args)
28
+	{
29
+		$this->args = $args;
30
+		$this->max_num_pages = $maxPageCount;
31
+		$this->reviews = $reviews;
32
+		parent::__construct($reviews, ArrayObject::STD_PROP_LIST | ArrayObject::ARRAY_AS_PROPS);
33
+	}
34 34
 
35
-    /**
36
-     * @return string
37
-     */
38
-    public function __toString()
39
-    {
40
-        return (string) $this->build();
41
-    }
35
+	/**
36
+	 * @return string
37
+	 */
38
+	public function __toString()
39
+	{
40
+		return (string) $this->build();
41
+	}
42 42
 
43
-    /**
44
-     * @return ReviewsHtml
45
-     */
46
-    public function build()
47
-    {
48
-        $args = glsr(SiteReviewsDefaults::class)->merge($this->args);
49
-        return glsr(SiteReviewsPartial::class)->build($args, $this);
50
-    }
43
+	/**
44
+	 * @return ReviewsHtml
45
+	 */
46
+	public function build()
47
+	{
48
+		$args = glsr(SiteReviewsDefaults::class)->merge($this->args);
49
+		return glsr(SiteReviewsPartial::class)->build($args, $this);
50
+	}
51 51
 
52
-    /**
53
-     * @param mixed $key
54
-     * @return mixed
55
-     */
56
-    public function offsetGet($key)
57
-    {
58
-        if (array_key_exists($key, $this->reviews)) {
59
-            return $this->reviews[$key];
60
-        }
61
-        return property_exists($this, $key)
62
-            ? $this->$key
63
-            : null;
64
-    }
52
+	/**
53
+	 * @param mixed $key
54
+	 * @return mixed
55
+	 */
56
+	public function offsetGet($key)
57
+	{
58
+		if (array_key_exists($key, $this->reviews)) {
59
+			return $this->reviews[$key];
60
+		}
61
+		return property_exists($this, $key)
62
+			? $this->$key
63
+			: null;
64
+	}
65 65
 
66
-    /**
67
-     * @return void
68
-     */
69
-    public function render()
70
-    {
71
-        echo $this->build();
72
-    }
66
+	/**
67
+	 * @return void
68
+	 */
69
+	public function render()
70
+	{
71
+		echo $this->build();
72
+	}
73 73
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -24,12 +24,12 @@  discard block
 block discarded – undo
24 24
      */
25 25
     public $reviews;
26 26
 
27
-    public function __construct(array $reviews, $maxPageCount, array $args)
27
+    public function __construct( array $reviews, $maxPageCount, array $args )
28 28
     {
29 29
         $this->args = $args;
30 30
         $this->max_num_pages = $maxPageCount;
31 31
         $this->reviews = $reviews;
32
-        parent::__construct($reviews, ArrayObject::STD_PROP_LIST | ArrayObject::ARRAY_AS_PROPS);
32
+        parent::__construct( $reviews, ArrayObject::STD_PROP_LIST | ArrayObject::ARRAY_AS_PROPS );
33 33
     }
34 34
 
35 35
     /**
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
      */
38 38
     public function __toString()
39 39
     {
40
-        return (string) $this->build();
40
+        return (string)$this->build();
41 41
     }
42 42
 
43 43
     /**
@@ -45,20 +45,20 @@  discard block
 block discarded – undo
45 45
      */
46 46
     public function build()
47 47
     {
48
-        $args = glsr(SiteReviewsDefaults::class)->merge($this->args);
49
-        return glsr(SiteReviewsPartial::class)->build($args, $this);
48
+        $args = glsr( SiteReviewsDefaults::class )->merge( $this->args );
49
+        return glsr( SiteReviewsPartial::class )->build( $args, $this );
50 50
     }
51 51
 
52 52
     /**
53 53
      * @param mixed $key
54 54
      * @return mixed
55 55
      */
56
-    public function offsetGet($key)
56
+    public function offsetGet( $key )
57 57
     {
58
-        if (array_key_exists($key, $this->reviews)) {
58
+        if( array_key_exists( $key, $this->reviews ) ) {
59 59
             return $this->reviews[$key];
60 60
         }
61
-        return property_exists($this, $key)
61
+        return property_exists( $this, $key )
62 62
             ? $this->$key
63 63
             : null;
64 64
     }
Please login to merge, or discard this patch.
plugin/Application.php 3 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -207,7 +207,8 @@
 block discarded – undo
207 207
                 $this->bind($id, $addon);
208 208
                 $addon->init();
209 209
             }
210
-        } catch(\ReflectionException $e) {
210
+        }
211
+        catch(\ReflectionException $e) {
211 212
             glsr_log()->error('Attempted to register an invalid addon.');
212 213
         }
213 214
     }
Please login to merge, or discard this patch.
Indentation   +325 added lines, -325 removed lines patch added patch discarded remove patch
@@ -17,356 +17,356 @@
 block discarded – undo
17 17
  */
18 18
 final class Application extends Container
19 19
 {
20
-    const CAPABILITY = 'edit_others_posts';
21
-    const CRON_EVENT = 'site-reviews/schedule/session/purge';
22
-    const ID = 'site-reviews';
23
-    const PAGED_QUERY_VAR = 'reviews-page';
24
-    const POST_TYPE = 'site-review';
25
-    const PREFIX = 'glsr_';
26
-    const TAXONOMY = 'site-review-category';
20
+	const CAPABILITY = 'edit_others_posts';
21
+	const CRON_EVENT = 'site-reviews/schedule/session/purge';
22
+	const ID = 'site-reviews';
23
+	const PAGED_QUERY_VAR = 'reviews-page';
24
+	const POST_TYPE = 'site-review';
25
+	const PREFIX = 'glsr_';
26
+	const TAXONOMY = 'site-review-category';
27 27
 
28
-    public $addons = [];
29
-    public $defaults;
30
-    public $deprecated = [];
31
-    public $file;
32
-    public $languages;
33
-    public $mceShortcodes = []; //defined elsewhere
34
-    public $name;
35
-    public $postTypeColumns = []; // defined elsewhere
36
-    public $reviewTypes;
37
-    public $schemas = []; //defined elsewhere
38
-    public $version;
28
+	public $addons = [];
29
+	public $defaults;
30
+	public $deprecated = [];
31
+	public $file;
32
+	public $languages;
33
+	public $mceShortcodes = []; //defined elsewhere
34
+	public $name;
35
+	public $postTypeColumns = []; // defined elsewhere
36
+	public $reviewTypes;
37
+	public $schemas = []; //defined elsewhere
38
+	public $version;
39 39
 
40
-    public function __construct()
41
-    {
42
-        static::$instance = $this;
43
-        $this->file = realpath(trailingslashit(dirname(__DIR__)).static::ID.'.php');
44
-        $plugin = get_file_data($this->file, [
45
-            'languages' => 'Domain Path',
46
-            'name' => 'Plugin Name',
47
-            'version' => 'Version',
48
-        ], 'plugin');
49
-        array_walk($plugin, function ($value, $key) {
50
-            $this->$key = $value;
51
-        });
52
-    }
40
+	public function __construct()
41
+	{
42
+		static::$instance = $this;
43
+		$this->file = realpath(trailingslashit(dirname(__DIR__)).static::ID.'.php');
44
+		$plugin = get_file_data($this->file, [
45
+			'languages' => 'Domain Path',
46
+			'name' => 'Plugin Name',
47
+			'version' => 'Version',
48
+		], 'plugin');
49
+		array_walk($plugin, function ($value, $key) {
50
+			$this->$key = $value;
51
+		});
52
+	}
53 53
 
54
-    /**
55
-     * @return void
56
-     */
57
-    public function activate()
58
-    {
59
-        $this->scheduleCronJob();
60
-        add_option(static::PREFIX.'activated', true);
61
-    }
54
+	/**
55
+	 * @return void
56
+	 */
57
+	public function activate()
58
+	{
59
+		$this->scheduleCronJob();
60
+		add_option(static::PREFIX.'activated', true);
61
+	}
62 62
 
63
-    /**
64
-     * @param string $view
65
-     * @return string
66
-     */
67
-    public function build($view, array $data = [])
68
-    {
69
-        ob_start();
70
-        $this->render($view, $data);
71
-        return ob_get_clean();
72
-    }
63
+	/**
64
+	 * @param string $view
65
+	 * @return string
66
+	 */
67
+	public function build($view, array $data = [])
68
+	{
69
+		ob_start();
70
+		$this->render($view, $data);
71
+		return ob_get_clean();
72
+	}
73 73
 
74
-    /**
75
-     * @param string $capability
76
-     * @return bool
77
-     */
78
-    public function can($capability)
79
-    {
80
-        return $this->make(Role::class)->can($capability);
81
-    }
74
+	/**
75
+	 * @param string $capability
76
+	 * @return bool
77
+	 */
78
+	public function can($capability)
79
+	{
80
+		return $this->make(Role::class)->can($capability);
81
+	}
82 82
 
83
-    /**
84
-     * @return void
85
-     */
86
-    public function catchFatalError()
87
-    {
88
-        $error = error_get_last();
89
-        if (E_ERROR !== $error['type'] || !Str::contains($error['message'], $this->path())) {
90
-            return;
91
-        }
92
-        glsr_log()->error($error['message']);
93
-    }
83
+	/**
84
+	 * @return void
85
+	 */
86
+	public function catchFatalError()
87
+	{
88
+		$error = error_get_last();
89
+		if (E_ERROR !== $error['type'] || !Str::contains($error['message'], $this->path())) {
90
+			return;
91
+		}
92
+		glsr_log()->error($error['message']);
93
+	}
94 94
 
95
-    /**
96
-     * @param string $name
97
-     * @return array
98
-     */
99
-    public function config($name)
100
-    {
101
-        $configFile = $this->path('config/'.$name.'.php');
102
-        $config = file_exists($configFile)
103
-            ? include $configFile
104
-            : [];
105
-        return apply_filters('site-reviews/config/'.$name, $config);
106
-    }
95
+	/**
96
+	 * @param string $name
97
+	 * @return array
98
+	 */
99
+	public function config($name)
100
+	{
101
+		$configFile = $this->path('config/'.$name.'.php');
102
+		$config = file_exists($configFile)
103
+			? include $configFile
104
+			: [];
105
+		return apply_filters('site-reviews/config/'.$name, $config);
106
+	}
107 107
 
108
-    /**
109
-     * @param string $property
110
-     * @return string
111
-     */
112
-    public function constant($property, $className = 'static')
113
-    {
114
-        $constant = $className.'::'.$property;
115
-        return defined($constant)
116
-            ? apply_filters('site-reviews/const/'.$property, constant($constant))
117
-            : '';
118
-    }
108
+	/**
109
+	 * @param string $property
110
+	 * @return string
111
+	 */
112
+	public function constant($property, $className = 'static')
113
+	{
114
+		$constant = $className.'::'.$property;
115
+		return defined($constant)
116
+			? apply_filters('site-reviews/const/'.$property, constant($constant))
117
+			: '';
118
+	}
119 119
 
120
-    /**
121
-     * @return void
122
-     */
123
-    public function deactivate()
124
-    {
125
-        $this->unscheduleCronJob();
126
-    }
120
+	/**
121
+	 * @return void
122
+	 */
123
+	public function deactivate()
124
+	{
125
+		$this->unscheduleCronJob();
126
+	}
127 127
 
128
-    /**
129
-     * @param string $view
130
-     * @return void|string
131
-     */
132
-    public function file($view)
133
-    {
134
-        $view.= '.php';
135
-        $filePaths = [];
136
-        if (Str::startsWith('templates/', $view)) {
137
-            $filePaths[] = $this->themePath(Str::removePrefix('templates/', $view));
138
-        }
139
-        $filePaths[] = $this->path($view);
140
-        $filePaths[] = $this->path('views/'.$view);
141
-        foreach ($filePaths as $file) {
142
-            if (!file_exists($file)) {
143
-                continue;
144
-            }
145
-            return $file;
146
-        }
147
-    }
128
+	/**
129
+	 * @param string $view
130
+	 * @return void|string
131
+	 */
132
+	public function file($view)
133
+	{
134
+		$view.= '.php';
135
+		$filePaths = [];
136
+		if (Str::startsWith('templates/', $view)) {
137
+			$filePaths[] = $this->themePath(Str::removePrefix('templates/', $view));
138
+		}
139
+		$filePaths[] = $this->path($view);
140
+		$filePaths[] = $this->path('views/'.$view);
141
+		foreach ($filePaths as $file) {
142
+			if (!file_exists($file)) {
143
+				continue;
144
+			}
145
+			return $file;
146
+		}
147
+	}
148 148
 
149
-    /**
150
-     * @return array
151
-     */
152
-    public function getDefaults()
153
-    {
154
-        if (empty($this->defaults)) {
155
-            $this->defaults = $this->make(DefaultsManager::class)->get();
156
-        }
157
-        return apply_filters('site-reviews/get/defaults', $this->defaults);
158
-    }
149
+	/**
150
+	 * @return array
151
+	 */
152
+	public function getDefaults()
153
+	{
154
+		if (empty($this->defaults)) {
155
+			$this->defaults = $this->make(DefaultsManager::class)->get();
156
+		}
157
+		return apply_filters('site-reviews/get/defaults', $this->defaults);
158
+	}
159 159
 
160
-    /**
161
-     * @param string $page
162
-     * @param string $tab
163
-     * @return string
164
-     */
165
-    public function getPermission($page = '', $tab = 'index')
166
-    {
167
-        $fallback = 'edit_posts';
168
-        $permissions = [
169
-            'addons' => 'install_plugins',
170
-            'documentation' => [
171
-                'faq' => 'edit_others_posts',
172
-                'functions' => 'manage_options',
173
-                'hooks' => 'edit_others_posts',
174
-                'index' => 'edit_posts',
175
-                'support' => 'edit_others_posts',
176
-            ],
177
-            'settings' => 'manage_options',
178
-            'tools' => [
179
-                'console' => 'edit_others_posts',
180
-                'general' => 'edit_others_posts',
181
-                'index' => 'edit_others_posts',
182
-                'sync' => 'manage_options',
183
-                'system-info' => 'edit_others_posts',
184
-            ]
185
-        ];
186
-        $permission = Arr::get($permissions, $page, $fallback);
187
-        if (is_array($permission)) {
188
-            $permission = Arr::get($permission, $tab, $fallback);
189
-        }
190
-        return empty($permission) || !is_string($permission)
191
-            ? $fallback
192
-            : $permission;
193
-    }
160
+	/**
161
+	 * @param string $page
162
+	 * @param string $tab
163
+	 * @return string
164
+	 */
165
+	public function getPermission($page = '', $tab = 'index')
166
+	{
167
+		$fallback = 'edit_posts';
168
+		$permissions = [
169
+			'addons' => 'install_plugins',
170
+			'documentation' => [
171
+				'faq' => 'edit_others_posts',
172
+				'functions' => 'manage_options',
173
+				'hooks' => 'edit_others_posts',
174
+				'index' => 'edit_posts',
175
+				'support' => 'edit_others_posts',
176
+			],
177
+			'settings' => 'manage_options',
178
+			'tools' => [
179
+				'console' => 'edit_others_posts',
180
+				'general' => 'edit_others_posts',
181
+				'index' => 'edit_others_posts',
182
+				'sync' => 'manage_options',
183
+				'system-info' => 'edit_others_posts',
184
+			]
185
+		];
186
+		$permission = Arr::get($permissions, $page, $fallback);
187
+		if (is_array($permission)) {
188
+			$permission = Arr::get($permission, $tab, $fallback);
189
+		}
190
+		return empty($permission) || !is_string($permission)
191
+			? $fallback
192
+			: $permission;
193
+	}
194 194
 
195
-    /**
196
-     * @param string $page
197
-     * @param string $tab
198
-     * @return bool
199
-     */
200
-    public function hasPermission($page = '', $tab = 'index')
201
-    {
202
-        $isAdmin = $this->isAdmin();
203
-        return !$isAdmin || ($isAdmin && $this->can($this->getPermission($page, $tab)));
204
-    }
195
+	/**
196
+	 * @param string $page
197
+	 * @param string $tab
198
+	 * @return bool
199
+	 */
200
+	public function hasPermission($page = '', $tab = 'index')
201
+	{
202
+		$isAdmin = $this->isAdmin();
203
+		return !$isAdmin || ($isAdmin && $this->can($this->getPermission($page, $tab)));
204
+	}
205 205
 
206
-    /**
207
-     * @return void
208
-     */
209
-    public function init()
210
-    {
211
-        $this->make(Actions::class)->run();
212
-        $this->make(Filters::class)->run();
213
-    }
206
+	/**
207
+	 * @return void
208
+	 */
209
+	public function init()
210
+	{
211
+		$this->make(Actions::class)->run();
212
+		$this->make(Filters::class)->run();
213
+	}
214 214
 
215
-    /**
216
-     * @return bool
217
-     */
218
-    public function isAdmin()
219
-    {
220
-        return is_admin() && !wp_doing_ajax();
221
-    }
215
+	/**
216
+	 * @return bool
217
+	 */
218
+	public function isAdmin()
219
+	{
220
+		return is_admin() && !wp_doing_ajax();
221
+	}
222 222
 
223
-    /**
224
-     * @param string $file
225
-     * @return string
226
-     */
227
-    public function path($file = '', $realpath = true)
228
-    {
229
-        $path = plugin_dir_path($this->file);
230
-        if (!$realpath) {
231
-            $path = trailingslashit(WP_PLUGIN_DIR).basename(dirname($this->file));
232
-        }
233
-        $path = trailingslashit($path).ltrim(trim($file), '/');
234
-        return apply_filters('site-reviews/path', $path, $file);
235
-    }
223
+	/**
224
+	 * @param string $file
225
+	 * @return string
226
+	 */
227
+	public function path($file = '', $realpath = true)
228
+	{
229
+		$path = plugin_dir_path($this->file);
230
+		if (!$realpath) {
231
+			$path = trailingslashit(WP_PLUGIN_DIR).basename(dirname($this->file));
232
+		}
233
+		$path = trailingslashit($path).ltrim(trim($file), '/');
234
+		return apply_filters('site-reviews/path', $path, $file);
235
+	}
236 236
 
237
-    /**
238
-     * @param object $addon
239
-     * @return void
240
-     */
241
-    public function register($addon)
242
-    {
243
-        try {
244
-            $reflection = new \ReflectionClass($addon);
245
-            if ($id = $reflection->getConstant('ID')) {
246
-                $this->addons[] = $id;
247
-                $this->bind($id, $addon);
248
-                $addon->init();
249
-            }
250
-        } catch(\ReflectionException $e) {
251
-            glsr_log()->error('Attempted to register an invalid addon.');
252
-        }
253
-    }
237
+	/**
238
+	 * @param object $addon
239
+	 * @return void
240
+	 */
241
+	public function register($addon)
242
+	{
243
+		try {
244
+			$reflection = new \ReflectionClass($addon);
245
+			if ($id = $reflection->getConstant('ID')) {
246
+				$this->addons[] = $id;
247
+				$this->bind($id, $addon);
248
+				$addon->init();
249
+			}
250
+		} catch(\ReflectionException $e) {
251
+			glsr_log()->error('Attempted to register an invalid addon.');
252
+		}
253
+	}
254 254
 
255
-    /**
256
-     * @return void
257
-     */
258
-    public function registerAddons()
259
-    {
260
-        do_action('site-reviews/addon/register', $this);
261
-    }
255
+	/**
256
+	 * @return void
257
+	 */
258
+	public function registerAddons()
259
+	{
260
+		do_action('site-reviews/addon/register', $this);
261
+	}
262 262
 
263
-    /**
264
-     * @return void
265
-     */
266
-    public function registerLanguages()
267
-    {
268
-        load_plugin_textdomain(static::ID, false,
269
-            trailingslashit(plugin_basename($this->path()).'/'.$this->languages)
270
-        );
271
-    }
263
+	/**
264
+	 * @return void
265
+	 */
266
+	public function registerLanguages()
267
+	{
268
+		load_plugin_textdomain(static::ID, false,
269
+			trailingslashit(plugin_basename($this->path()).'/'.$this->languages)
270
+		);
271
+	}
272 272
 
273
-    /**
274
-     * @return void
275
-     */
276
-    public function registerReviewTypes()
277
-    {
278
-        $types = apply_filters('site-reviews/addon/types', []);
279
-        $this->reviewTypes = wp_parse_args($types, [
280
-            'local' => __('Local', 'site-reviews'),
281
-        ]);
282
-    }
273
+	/**
274
+	 * @return void
275
+	 */
276
+	public function registerReviewTypes()
277
+	{
278
+		$types = apply_filters('site-reviews/addon/types', []);
279
+		$this->reviewTypes = wp_parse_args($types, [
280
+			'local' => __('Local', 'site-reviews'),
281
+		]);
282
+	}
283 283
 
284
-    /**
285
-     * @param string $view
286
-     * @return void
287
-     */
288
-    public function render($view, array $data = [])
289
-    {
290
-        $view = apply_filters('site-reviews/render/view', $view, $data);
291
-        $file = apply_filters('site-reviews/views/file', $this->file($view), $view, $data);
292
-        if (!file_exists($file)) {
293
-            glsr_log()->error('File not found: '.$file);
294
-            return;
295
-        }
296
-        $data = apply_filters('site-reviews/views/data', $data, $view);
297
-        extract($data);
298
-        include $file;
299
-    }
284
+	/**
285
+	 * @param string $view
286
+	 * @return void
287
+	 */
288
+	public function render($view, array $data = [])
289
+	{
290
+		$view = apply_filters('site-reviews/render/view', $view, $data);
291
+		$file = apply_filters('site-reviews/views/file', $this->file($view), $view, $data);
292
+		if (!file_exists($file)) {
293
+			glsr_log()->error('File not found: '.$file);
294
+			return;
295
+		}
296
+		$data = apply_filters('site-reviews/views/data', $data, $view);
297
+		extract($data);
298
+		include $file;
299
+	}
300 300
 
301
-    /**
302
-     * @return void
303
-     */
304
-    public function scheduleCronJob()
305
-    {
306
-        if (false === wp_next_scheduled(static::CRON_EVENT)) {
307
-            wp_schedule_event(time(), 'twicedaily', static::CRON_EVENT);
308
-        }
309
-    }
301
+	/**
302
+	 * @return void
303
+	 */
304
+	public function scheduleCronJob()
305
+	{
306
+		if (false === wp_next_scheduled(static::CRON_EVENT)) {
307
+			wp_schedule_event(time(), 'twicedaily', static::CRON_EVENT);
308
+		}
309
+	}
310 310
 
311
-    /**
312
-     * @return void
313
-     */
314
-    public function setDefaults()
315
-    {
316
-        if (get_option(static::PREFIX.'activated')) {
317
-            $this->make(DefaultsManager::class)->set();
318
-            delete_option(static::PREFIX.'activated');
319
-        }
320
-    }
311
+	/**
312
+	 * @return void
313
+	 */
314
+	public function setDefaults()
315
+	{
316
+		if (get_option(static::PREFIX.'activated')) {
317
+			$this->make(DefaultsManager::class)->set();
318
+			delete_option(static::PREFIX.'activated');
319
+		}
320
+	}
321 321
 
322
-    /**
323
-     * @param string $file
324
-     * @return string
325
-     */
326
-    public function themePath($file = '')
327
-    {
328
-        return get_stylesheet_directory().'/'.static::ID.'/'.ltrim(trim($file), '/');
329
-    }
322
+	/**
323
+	 * @param string $file
324
+	 * @return string
325
+	 */
326
+	public function themePath($file = '')
327
+	{
328
+		return get_stylesheet_directory().'/'.static::ID.'/'.ltrim(trim($file), '/');
329
+	}
330 330
 
331
-    /**
332
-     * @return void
333
-     */
334
-    public function unscheduleCronJob()
335
-    {
336
-        wp_unschedule_event(intval(wp_next_scheduled(static::CRON_EVENT)), static::CRON_EVENT);
337
-    }
331
+	/**
332
+	 * @return void
333
+	 */
334
+	public function unscheduleCronJob()
335
+	{
336
+		wp_unschedule_event(intval(wp_next_scheduled(static::CRON_EVENT)), static::CRON_EVENT);
337
+	}
338 338
 
339
-    /**
340
-     * @param string $path
341
-     * @return string
342
-     */
343
-    public function url($path = '')
344
-    {
345
-        $url = esc_url(plugin_dir_url($this->file).ltrim(trim($path), '/'));
346
-        return apply_filters('site-reviews/url', $url, $path);
347
-    }
339
+	/**
340
+	 * @param string $path
341
+	 * @return string
342
+	 */
343
+	public function url($path = '')
344
+	{
345
+		$url = esc_url(plugin_dir_url($this->file).ltrim(trim($path), '/'));
346
+		return apply_filters('site-reviews/url', $url, $path);
347
+	}
348 348
 
349
-    /**
350
-     * @param string $versionLevel
351
-     * @return string
352
-     */
353
-    public function version($versionLevel = '')
354
-    {
355
-        $pattern = '/^v?(\d{1,5})(\.\d++)?(\.\d++)?(.+)?$/i';
356
-        preg_match($pattern, $this->version, $matches);
357
-        switch ($versionLevel) {
358
-            case 'major':
359
-                $version = Arr::get($matches, 1);
360
-                break;
361
-            case 'minor':
362
-                $version = Arr::get($matches, 1).Arr::get($matches, 2);
363
-                break;
364
-            case 'patch':
365
-                $version = Arr::get($matches, 1).Arr::get($matches, 2).Arr::get($matches, 3);
366
-                break;
367
-        }
368
-        return empty($version)
369
-            ? $this->version
370
-            : $version;
371
-    }
349
+	/**
350
+	 * @param string $versionLevel
351
+	 * @return string
352
+	 */
353
+	public function version($versionLevel = '')
354
+	{
355
+		$pattern = '/^v?(\d{1,5})(\.\d++)?(\.\d++)?(.+)?$/i';
356
+		preg_match($pattern, $this->version, $matches);
357
+		switch ($versionLevel) {
358
+			case 'major':
359
+				$version = Arr::get($matches, 1);
360
+				break;
361
+			case 'minor':
362
+				$version = Arr::get($matches, 1).Arr::get($matches, 2);
363
+				break;
364
+			case 'patch':
365
+				$version = Arr::get($matches, 1).Arr::get($matches, 2).Arr::get($matches, 3);
366
+				break;
367
+		}
368
+		return empty($version)
369
+			? $this->version
370
+			: $version;
371
+	}
372 372
 }
Please login to merge, or discard this patch.
Spacing   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -40,13 +40,13 @@  discard block
 block discarded – undo
40 40
     public function __construct()
41 41
     {
42 42
         static::$instance = $this;
43
-        $this->file = realpath(trailingslashit(dirname(__DIR__)).static::ID.'.php');
44
-        $plugin = get_file_data($this->file, [
43
+        $this->file = realpath( trailingslashit( dirname( __DIR__ ) ).static::ID.'.php' );
44
+        $plugin = get_file_data( $this->file, [
45 45
             'languages' => 'Domain Path',
46 46
             'name' => 'Plugin Name',
47 47
             'version' => 'Version',
48
-        ], 'plugin');
49
-        array_walk($plugin, function ($value, $key) {
48
+        ], 'plugin' );
49
+        array_walk( $plugin, function( $value, $key ) {
50 50
             $this->$key = $value;
51 51
         });
52 52
     }
@@ -57,17 +57,17 @@  discard block
 block discarded – undo
57 57
     public function activate()
58 58
     {
59 59
         $this->scheduleCronJob();
60
-        add_option(static::PREFIX.'activated', true);
60
+        add_option( static::PREFIX.'activated', true );
61 61
     }
62 62
 
63 63
     /**
64 64
      * @param string $view
65 65
      * @return string
66 66
      */
67
-    public function build($view, array $data = [])
67
+    public function build( $view, array $data = [] )
68 68
     {
69 69
         ob_start();
70
-        $this->render($view, $data);
70
+        $this->render( $view, $data );
71 71
         return ob_get_clean();
72 72
     }
73 73
 
@@ -75,9 +75,9 @@  discard block
 block discarded – undo
75 75
      * @param string $capability
76 76
      * @return bool
77 77
      */
78
-    public function can($capability)
78
+    public function can( $capability )
79 79
     {
80
-        return $this->make(Role::class)->can($capability);
80
+        return $this->make( Role::class )->can( $capability );
81 81
     }
82 82
 
83 83
     /**
@@ -86,34 +86,34 @@  discard block
 block discarded – undo
86 86
     public function catchFatalError()
87 87
     {
88 88
         $error = error_get_last();
89
-        if (E_ERROR !== $error['type'] || !Str::contains($error['message'], $this->path())) {
89
+        if( E_ERROR !== $error['type'] || !Str::contains( $error['message'], $this->path() ) ) {
90 90
             return;
91 91
         }
92
-        glsr_log()->error($error['message']);
92
+        glsr_log()->error( $error['message'] );
93 93
     }
94 94
 
95 95
     /**
96 96
      * @param string $name
97 97
      * @return array
98 98
      */
99
-    public function config($name)
99
+    public function config( $name )
100 100
     {
101
-        $configFile = $this->path('config/'.$name.'.php');
102
-        $config = file_exists($configFile)
101
+        $configFile = $this->path( 'config/'.$name.'.php' );
102
+        $config = file_exists( $configFile )
103 103
             ? include $configFile
104 104
             : [];
105
-        return apply_filters('site-reviews/config/'.$name, $config);
105
+        return apply_filters( 'site-reviews/config/'.$name, $config );
106 106
     }
107 107
 
108 108
     /**
109 109
      * @param string $property
110 110
      * @return string
111 111
      */
112
-    public function constant($property, $className = 'static')
112
+    public function constant( $property, $className = 'static' )
113 113
     {
114 114
         $constant = $className.'::'.$property;
115
-        return defined($constant)
116
-            ? apply_filters('site-reviews/const/'.$property, constant($constant))
115
+        return defined( $constant )
116
+            ? apply_filters( 'site-reviews/const/'.$property, constant( $constant ) )
117 117
             : '';
118 118
     }
119 119
 
@@ -129,17 +129,17 @@  discard block
 block discarded – undo
129 129
      * @param string $view
130 130
      * @return void|string
131 131
      */
132
-    public function file($view)
132
+    public function file( $view )
133 133
     {
134
-        $view.= '.php';
134
+        $view .= '.php';
135 135
         $filePaths = [];
136
-        if (Str::startsWith('templates/', $view)) {
137
-            $filePaths[] = $this->themePath(Str::removePrefix('templates/', $view));
136
+        if( Str::startsWith( 'templates/', $view ) ) {
137
+            $filePaths[] = $this->themePath( Str::removePrefix( 'templates/', $view ) );
138 138
         }
139
-        $filePaths[] = $this->path($view);
140
-        $filePaths[] = $this->path('views/'.$view);
141
-        foreach ($filePaths as $file) {
142
-            if (!file_exists($file)) {
139
+        $filePaths[] = $this->path( $view );
140
+        $filePaths[] = $this->path( 'views/'.$view );
141
+        foreach( $filePaths as $file ) {
142
+            if( !file_exists( $file ) ) {
143 143
                 continue;
144 144
             }
145 145
             return $file;
@@ -151,10 +151,10 @@  discard block
 block discarded – undo
151 151
      */
152 152
     public function getDefaults()
153 153
     {
154
-        if (empty($this->defaults)) {
155
-            $this->defaults = $this->make(DefaultsManager::class)->get();
154
+        if( empty($this->defaults) ) {
155
+            $this->defaults = $this->make( DefaultsManager::class )->get();
156 156
         }
157
-        return apply_filters('site-reviews/get/defaults', $this->defaults);
157
+        return apply_filters( 'site-reviews/get/defaults', $this->defaults );
158 158
     }
159 159
 
160 160
     /**
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
      * @param string $tab
163 163
      * @return string
164 164
      */
165
-    public function getPermission($page = '', $tab = 'index')
165
+    public function getPermission( $page = '', $tab = 'index' )
166 166
     {
167 167
         $fallback = 'edit_posts';
168 168
         $permissions = [
@@ -183,11 +183,11 @@  discard block
 block discarded – undo
183 183
                 'system-info' => 'edit_others_posts',
184 184
             ]
185 185
         ];
186
-        $permission = Arr::get($permissions, $page, $fallback);
187
-        if (is_array($permission)) {
188
-            $permission = Arr::get($permission, $tab, $fallback);
186
+        $permission = Arr::get( $permissions, $page, $fallback );
187
+        if( is_array( $permission ) ) {
188
+            $permission = Arr::get( $permission, $tab, $fallback );
189 189
         }
190
-        return empty($permission) || !is_string($permission)
190
+        return empty($permission) || !is_string( $permission )
191 191
             ? $fallback
192 192
             : $permission;
193 193
     }
@@ -197,10 +197,10 @@  discard block
 block discarded – undo
197 197
      * @param string $tab
198 198
      * @return bool
199 199
      */
200
-    public function hasPermission($page = '', $tab = 'index')
200
+    public function hasPermission( $page = '', $tab = 'index' )
201 201
     {
202 202
         $isAdmin = $this->isAdmin();
203
-        return !$isAdmin || ($isAdmin && $this->can($this->getPermission($page, $tab)));
203
+        return !$isAdmin || ($isAdmin && $this->can( $this->getPermission( $page, $tab ) ));
204 204
     }
205 205
 
206 206
     /**
@@ -208,8 +208,8 @@  discard block
 block discarded – undo
208 208
      */
209 209
     public function init()
210 210
     {
211
-        $this->make(Actions::class)->run();
212
-        $this->make(Filters::class)->run();
211
+        $this->make( Actions::class )->run();
212
+        $this->make( Filters::class )->run();
213 213
     }
214 214
 
215 215
     /**
@@ -224,31 +224,31 @@  discard block
 block discarded – undo
224 224
      * @param string $file
225 225
      * @return string
226 226
      */
227
-    public function path($file = '', $realpath = true)
227
+    public function path( $file = '', $realpath = true )
228 228
     {
229
-        $path = plugin_dir_path($this->file);
230
-        if (!$realpath) {
231
-            $path = trailingslashit(WP_PLUGIN_DIR).basename(dirname($this->file));
229
+        $path = plugin_dir_path( $this->file );
230
+        if( !$realpath ) {
231
+            $path = trailingslashit( WP_PLUGIN_DIR ).basename( dirname( $this->file ) );
232 232
         }
233
-        $path = trailingslashit($path).ltrim(trim($file), '/');
234
-        return apply_filters('site-reviews/path', $path, $file);
233
+        $path = trailingslashit( $path ).ltrim( trim( $file ), '/' );
234
+        return apply_filters( 'site-reviews/path', $path, $file );
235 235
     }
236 236
 
237 237
     /**
238 238
      * @param object $addon
239 239
      * @return void
240 240
      */
241
-    public function register($addon)
241
+    public function register( $addon )
242 242
     {
243 243
         try {
244
-            $reflection = new \ReflectionClass($addon);
245
-            if ($id = $reflection->getConstant('ID')) {
244
+            $reflection = new \ReflectionClass( $addon );
245
+            if( $id = $reflection->getConstant( 'ID' ) ) {
246 246
                 $this->addons[] = $id;
247
-                $this->bind($id, $addon);
247
+                $this->bind( $id, $addon );
248 248
                 $addon->init();
249 249
             }
250
-        } catch(\ReflectionException $e) {
251
-            glsr_log()->error('Attempted to register an invalid addon.');
250
+        } catch( \ReflectionException $e ) {
251
+            glsr_log()->error( 'Attempted to register an invalid addon.' );
252 252
         }
253 253
     }
254 254
 
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
      */
258 258
     public function registerAddons()
259 259
     {
260
-        do_action('site-reviews/addon/register', $this);
260
+        do_action( 'site-reviews/addon/register', $this );
261 261
     }
262 262
 
263 263
     /**
@@ -265,8 +265,8 @@  discard block
 block discarded – undo
265 265
      */
266 266
     public function registerLanguages()
267 267
     {
268
-        load_plugin_textdomain(static::ID, false,
269
-            trailingslashit(plugin_basename($this->path()).'/'.$this->languages)
268
+        load_plugin_textdomain( static::ID, false,
269
+            trailingslashit( plugin_basename( $this->path() ).'/'.$this->languages )
270 270
         );
271 271
     }
272 272
 
@@ -275,26 +275,26 @@  discard block
 block discarded – undo
275 275
      */
276 276
     public function registerReviewTypes()
277 277
     {
278
-        $types = apply_filters('site-reviews/addon/types', []);
279
-        $this->reviewTypes = wp_parse_args($types, [
280
-            'local' => __('Local', 'site-reviews'),
281
-        ]);
278
+        $types = apply_filters( 'site-reviews/addon/types', [] );
279
+        $this->reviewTypes = wp_parse_args( $types, [
280
+            'local' => __( 'Local', 'site-reviews' ),
281
+        ] );
282 282
     }
283 283
 
284 284
     /**
285 285
      * @param string $view
286 286
      * @return void
287 287
      */
288
-    public function render($view, array $data = [])
288
+    public function render( $view, array $data = [] )
289 289
     {
290
-        $view = apply_filters('site-reviews/render/view', $view, $data);
291
-        $file = apply_filters('site-reviews/views/file', $this->file($view), $view, $data);
292
-        if (!file_exists($file)) {
293
-            glsr_log()->error('File not found: '.$file);
290
+        $view = apply_filters( 'site-reviews/render/view', $view, $data );
291
+        $file = apply_filters( 'site-reviews/views/file', $this->file( $view ), $view, $data );
292
+        if( !file_exists( $file ) ) {
293
+            glsr_log()->error( 'File not found: '.$file );
294 294
             return;
295 295
         }
296
-        $data = apply_filters('site-reviews/views/data', $data, $view);
297
-        extract($data);
296
+        $data = apply_filters( 'site-reviews/views/data', $data, $view );
297
+        extract( $data );
298 298
         include $file;
299 299
     }
300 300
 
@@ -303,8 +303,8 @@  discard block
 block discarded – undo
303 303
      */
304 304
     public function scheduleCronJob()
305 305
     {
306
-        if (false === wp_next_scheduled(static::CRON_EVENT)) {
307
-            wp_schedule_event(time(), 'twicedaily', static::CRON_EVENT);
306
+        if( false === wp_next_scheduled( static::CRON_EVENT ) ) {
307
+            wp_schedule_event( time(), 'twicedaily', static::CRON_EVENT );
308 308
         }
309 309
     }
310 310
 
@@ -313,9 +313,9 @@  discard block
 block discarded – undo
313 313
      */
314 314
     public function setDefaults()
315 315
     {
316
-        if (get_option(static::PREFIX.'activated')) {
317
-            $this->make(DefaultsManager::class)->set();
318
-            delete_option(static::PREFIX.'activated');
316
+        if( get_option( static::PREFIX.'activated' ) ) {
317
+            $this->make( DefaultsManager::class )->set();
318
+            delete_option( static::PREFIX.'activated' );
319 319
         }
320 320
     }
321 321
 
@@ -323,9 +323,9 @@  discard block
 block discarded – undo
323 323
      * @param string $file
324 324
      * @return string
325 325
      */
326
-    public function themePath($file = '')
326
+    public function themePath( $file = '' )
327 327
     {
328
-        return get_stylesheet_directory().'/'.static::ID.'/'.ltrim(trim($file), '/');
328
+        return get_stylesheet_directory().'/'.static::ID.'/'.ltrim( trim( $file ), '/' );
329 329
     }
330 330
 
331 331
     /**
@@ -333,36 +333,36 @@  discard block
 block discarded – undo
333 333
      */
334 334
     public function unscheduleCronJob()
335 335
     {
336
-        wp_unschedule_event(intval(wp_next_scheduled(static::CRON_EVENT)), static::CRON_EVENT);
336
+        wp_unschedule_event( intval( wp_next_scheduled( static::CRON_EVENT ) ), static::CRON_EVENT );
337 337
     }
338 338
 
339 339
     /**
340 340
      * @param string $path
341 341
      * @return string
342 342
      */
343
-    public function url($path = '')
343
+    public function url( $path = '' )
344 344
     {
345
-        $url = esc_url(plugin_dir_url($this->file).ltrim(trim($path), '/'));
346
-        return apply_filters('site-reviews/url', $url, $path);
345
+        $url = esc_url( plugin_dir_url( $this->file ).ltrim( trim( $path ), '/' ) );
346
+        return apply_filters( 'site-reviews/url', $url, $path );
347 347
     }
348 348
 
349 349
     /**
350 350
      * @param string $versionLevel
351 351
      * @return string
352 352
      */
353
-    public function version($versionLevel = '')
353
+    public function version( $versionLevel = '' )
354 354
     {
355 355
         $pattern = '/^v?(\d{1,5})(\.\d++)?(\.\d++)?(.+)?$/i';
356
-        preg_match($pattern, $this->version, $matches);
357
-        switch ($versionLevel) {
356
+        preg_match( $pattern, $this->version, $matches );
357
+        switch( $versionLevel ) {
358 358
             case 'major':
359
-                $version = Arr::get($matches, 1);
359
+                $version = Arr::get( $matches, 1 );
360 360
                 break;
361 361
             case 'minor':
362
-                $version = Arr::get($matches, 1).Arr::get($matches, 2);
362
+                $version = Arr::get( $matches, 1 ).Arr::get( $matches, 2 );
363 363
                 break;
364 364
             case 'patch':
365
-                $version = Arr::get($matches, 1).Arr::get($matches, 2).Arr::get($matches, 3);
365
+                $version = Arr::get( $matches, 1 ).Arr::get( $matches, 2 ).Arr::get( $matches, 3 );
366 366
                 break;
367 367
         }
368 368
         return empty($version)
Please login to merge, or discard this patch.
plugin/Modules/Html/Partials/Pagination.php 2 patches
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -10,52 +10,52 @@
 block discarded – undo
10 10
 
11 11
 class Pagination implements PartialContract
12 12
 {
13
-    /**
14
-     * @var array
15
-     */
16
-    protected $args;
13
+	/**
14
+	 * @var array
15
+	 */
16
+	protected $args;
17 17
 
18
-    /**
19
-     * @return string
20
-     */
21
-    public function build(array $args = [])
22
-    {
23
-        $this->args = $this->normalize($args);
24
-        if ($this->args['total'] < 2) {
25
-            return '';
26
-        }
27
-        return glsr(Template::class)->build('templates/pagination', [
28
-            'context' => [
29
-                'links' => apply_filters('site-reviews/paginate_links', $this->buildLinks(), $this->args),
30
-                'loader' => '<div class="glsr-loader"></div>',
31
-                'screen_reader_text' => __('Site Reviews navigation', 'site-reviews'),
32
-            ],
33
-        ]);
34
-    }
18
+	/**
19
+	 * @return string
20
+	 */
21
+	public function build(array $args = [])
22
+	{
23
+		$this->args = $this->normalize($args);
24
+		if ($this->args['total'] < 2) {
25
+			return '';
26
+		}
27
+		return glsr(Template::class)->build('templates/pagination', [
28
+			'context' => [
29
+				'links' => apply_filters('site-reviews/paginate_links', $this->buildLinks(), $this->args),
30
+				'loader' => '<div class="glsr-loader"></div>',
31
+				'screen_reader_text' => __('Site Reviews navigation', 'site-reviews'),
32
+			],
33
+		]);
34
+	}
35 35
 
36
-    /**
37
-     * @return string
38
-     */
39
-    protected function buildLinks()
40
-    {
41
-        $args = glsr(Style::class)->paginationArgs($this->args);
42
-        if ('array' == $args['type']) {
43
-            $args['type'] = 'plain';
44
-        }
45
-        return paginate_links($args);
46
-    }
36
+	/**
37
+	 * @return string
38
+	 */
39
+	protected function buildLinks()
40
+	{
41
+		$args = glsr(Style::class)->paginationArgs($this->args);
42
+		if ('array' == $args['type']) {
43
+			$args['type'] = 'plain';
44
+		}
45
+		return paginate_links($args);
46
+	}
47 47
 
48
-    /**
49
-     * @return array
50
-     */
51
-    protected function normalize(array $args)
52
-    {
53
-        if ($baseUrl = Arr::get($args, 'baseUrl')) {
54
-            $args['base'] = $baseUrl.'%_%';
55
-        }
56
-        return wp_parse_args(array_filter($args), [
57
-            'current' => glsr(QueryBuilder::class)->getPaged(),
58
-            'total' => 1,
59
-        ]);
60
-    }
48
+	/**
49
+	 * @return array
50
+	 */
51
+	protected function normalize(array $args)
52
+	{
53
+		if ($baseUrl = Arr::get($args, 'baseUrl')) {
54
+			$args['base'] = $baseUrl.'%_%';
55
+		}
56
+		return wp_parse_args(array_filter($args), [
57
+			'current' => glsr(QueryBuilder::class)->getPaged(),
58
+			'total' => 1,
59
+		]);
60
+	}
61 61
 }
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -18,19 +18,19 @@  discard block
 block discarded – undo
18 18
     /**
19 19
      * @return string
20 20
      */
21
-    public function build(array $args = [])
21
+    public function build( array $args = [] )
22 22
     {
23
-        $this->args = $this->normalize($args);
24
-        if ($this->args['total'] < 2) {
23
+        $this->args = $this->normalize( $args );
24
+        if( $this->args['total'] < 2 ) {
25 25
             return '';
26 26
         }
27
-        return glsr(Template::class)->build('templates/pagination', [
27
+        return glsr( Template::class )->build( 'templates/pagination', [
28 28
             'context' => [
29
-                'links' => apply_filters('site-reviews/paginate_links', $this->buildLinks(), $this->args),
29
+                'links' => apply_filters( 'site-reviews/paginate_links', $this->buildLinks(), $this->args ),
30 30
                 'loader' => '<div class="glsr-loader"></div>',
31
-                'screen_reader_text' => __('Site Reviews navigation', 'site-reviews'),
31
+                'screen_reader_text' => __( 'Site Reviews navigation', 'site-reviews' ),
32 32
             ],
33
-        ]);
33
+        ] );
34 34
     }
35 35
 
36 36
     /**
@@ -38,24 +38,24 @@  discard block
 block discarded – undo
38 38
      */
39 39
     protected function buildLinks()
40 40
     {
41
-        $args = glsr(Style::class)->paginationArgs($this->args);
42
-        if ('array' == $args['type']) {
41
+        $args = glsr( Style::class )->paginationArgs( $this->args );
42
+        if( 'array' == $args['type'] ) {
43 43
             $args['type'] = 'plain';
44 44
         }
45
-        return paginate_links($args);
45
+        return paginate_links( $args );
46 46
     }
47 47
 
48 48
     /**
49 49
      * @return array
50 50
      */
51
-    protected function normalize(array $args)
51
+    protected function normalize( array $args )
52 52
     {
53
-        if ($baseUrl = Arr::get($args, 'baseUrl')) {
53
+        if( $baseUrl = Arr::get( $args, 'baseUrl' ) ) {
54 54
             $args['base'] = $baseUrl.'%_%';
55 55
         }
56
-        return wp_parse_args(array_filter($args), [
57
-            'current' => glsr(QueryBuilder::class)->getPaged(),
56
+        return wp_parse_args( array_filter( $args ), [
57
+            'current' => glsr( QueryBuilder::class )->getPaged(),
58 58
             'total' => 1,
59
-        ]);
59
+        ] );
60 60
     }
61 61
 }
Please login to merge, or discard this patch.
plugin/Modules/Html/ReviewHtml.php 2 patches
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -7,48 +7,48 @@
 block discarded – undo
7 7
 
8 8
 class ReviewHtml extends ArrayObject
9 9
 {
10
-    /**
11
-     * @var Review
12
-     */
13
-    public $review;
10
+	/**
11
+	 * @var Review
12
+	 */
13
+	public $review;
14 14
 
15
-    /**
16
-     * @var array
17
-     */
18
-    public $values;
15
+	/**
16
+	 * @var array
17
+	 */
18
+	public $values;
19 19
 
20
-    public function __construct(Review $review, array $values = [])
21
-    {
22
-        $this->review = $review;
23
-        $this->values = $values;
24
-        parent::__construct($values, ArrayObject::STD_PROP_LIST | ArrayObject::ARRAY_AS_PROPS);
25
-    }
20
+	public function __construct(Review $review, array $values = [])
21
+	{
22
+		$this->review = $review;
23
+		$this->values = $values;
24
+		parent::__construct($values, ArrayObject::STD_PROP_LIST | ArrayObject::ARRAY_AS_PROPS);
25
+	}
26 26
 
27
-    /**
28
-     * @return string|void
29
-     */
30
-    public function __toString()
31
-    {
32
-        if (empty($this->values)) {
33
-            return;
34
-        }
35
-        return glsr(Template::class)->build('templates/review', [
36
-            'context' => $this->values,
37
-            'review' => $this->review,
38
-        ]);
39
-    }
27
+	/**
28
+	 * @return string|void
29
+	 */
30
+	public function __toString()
31
+	{
32
+		if (empty($this->values)) {
33
+			return;
34
+		}
35
+		return glsr(Template::class)->build('templates/review', [
36
+			'context' => $this->values,
37
+			'review' => $this->review,
38
+		]);
39
+	}
40 40
 
41
-    /**
42
-     * @param mixed $key
43
-     * @return mixed
44
-     */
45
-    public function offsetGet($key)
46
-    {
47
-        if (array_key_exists($key, $this->values)) {
48
-            return $this->values[$key];
49
-        }
50
-        return property_exists($this, $key)
51
-            ? $this->$key
52
-            : null;
53
-    }
41
+	/**
42
+	 * @param mixed $key
43
+	 * @return mixed
44
+	 */
45
+	public function offsetGet($key)
46
+	{
47
+		if (array_key_exists($key, $this->values)) {
48
+			return $this->values[$key];
49
+		}
50
+		return property_exists($this, $key)
51
+			? $this->$key
52
+			: null;
53
+	}
54 54
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -17,11 +17,11 @@  discard block
 block discarded – undo
17 17
      */
18 18
     public $values;
19 19
 
20
-    public function __construct(Review $review, array $values = [])
20
+    public function __construct( Review $review, array $values = [] )
21 21
     {
22 22
         $this->review = $review;
23 23
         $this->values = $values;
24
-        parent::__construct($values, ArrayObject::STD_PROP_LIST | ArrayObject::ARRAY_AS_PROPS);
24
+        parent::__construct( $values, ArrayObject::STD_PROP_LIST | ArrayObject::ARRAY_AS_PROPS );
25 25
     }
26 26
 
27 27
     /**
@@ -29,25 +29,25 @@  discard block
 block discarded – undo
29 29
      */
30 30
     public function __toString()
31 31
     {
32
-        if (empty($this->values)) {
32
+        if( empty($this->values) ) {
33 33
             return;
34 34
         }
35
-        return glsr(Template::class)->build('templates/review', [
35
+        return glsr( Template::class )->build( 'templates/review', [
36 36
             'context' => $this->values,
37 37
             'review' => $this->review,
38
-        ]);
38
+        ] );
39 39
     }
40 40
 
41 41
     /**
42 42
      * @param mixed $key
43 43
      * @return mixed
44 44
      */
45
-    public function offsetGet($key)
45
+    public function offsetGet( $key )
46 46
     {
47
-        if (array_key_exists($key, $this->values)) {
47
+        if( array_key_exists( $key, $this->values ) ) {
48 48
             return $this->values[$key];
49 49
         }
50
-        return property_exists($this, $key)
50
+        return property_exists( $this, $key )
51 51
             ? $this->$key
52 52
             : null;
53 53
     }
Please login to merge, or discard this patch.
plugin/Modules/Html/ReviewsHtml.php 2 patches
Indentation   +120 added lines, -120 removed lines patch added patch discarded remove patch
@@ -8,135 +8,135 @@
 block discarded – undo
8 8
 
9 9
 class ReviewsHtml extends ArrayObject
10 10
 {
11
-    /**
12
-     * @var array
13
-     */
14
-    public $args;
11
+	/**
12
+	 * @var array
13
+	 */
14
+	public $args;
15 15
 
16
-    /**
17
-     * @var int
18
-     */
19
-    public $max_num_pages;
16
+	/**
17
+	 * @var int
18
+	 */
19
+	public $max_num_pages;
20 20
 
21
-    /**
22
-     * @var string
23
-     */
24
-    public $pagination;
21
+	/**
22
+	 * @var string
23
+	 */
24
+	public $pagination;
25 25
 
26
-    /**
27
-     * @var array
28
-     */
29
-    public $reviews;
26
+	/**
27
+	 * @var array
28
+	 */
29
+	public $reviews;
30 30
 
31
-    public function __construct(array $renderedReviews, $maxPageCount, array $args)
32
-    {
33
-        $this->args = $args;
34
-        $this->max_num_pages = $maxPageCount;
35
-        $this->reviews = $renderedReviews;
36
-        $this->pagination = $this->buildPagination();
37
-        parent::__construct($renderedReviews, ArrayObject::STD_PROP_LIST | ArrayObject::ARRAY_AS_PROPS);
38
-    }
31
+	public function __construct(array $renderedReviews, $maxPageCount, array $args)
32
+	{
33
+		$this->args = $args;
34
+		$this->max_num_pages = $maxPageCount;
35
+		$this->reviews = $renderedReviews;
36
+		$this->pagination = $this->buildPagination();
37
+		parent::__construct($renderedReviews, ArrayObject::STD_PROP_LIST | ArrayObject::ARRAY_AS_PROPS);
38
+	}
39 39
 
40
-    /**
41
-     * @return string
42
-     */
43
-    public function __toString()
44
-    {
45
-        return glsr(Template::class)->build('templates/reviews', [
46
-            'args' => $this->args,
47
-            'context' => [
48
-                'assigned_to' => $this->args['assigned_to'],
49
-                'category' => $this->args['category'],
50
-                'class' => $this->getClass(),
51
-                'id' => $this->args['id'],
52
-                'pagination' => $this->getPagination(),
53
-                'reviews' => $this->getReviews(),
54
-            ],
55
-        ]);
56
-    }
40
+	/**
41
+	 * @return string
42
+	 */
43
+	public function __toString()
44
+	{
45
+		return glsr(Template::class)->build('templates/reviews', [
46
+			'args' => $this->args,
47
+			'context' => [
48
+				'assigned_to' => $this->args['assigned_to'],
49
+				'category' => $this->args['category'],
50
+				'class' => $this->getClass(),
51
+				'id' => $this->args['id'],
52
+				'pagination' => $this->getPagination(),
53
+				'reviews' => $this->getReviews(),
54
+			],
55
+		]);
56
+	}
57 57
 
58
-    /**
59
-     * @return string
60
-     */
61
-    public function getPagination()
62
-    {
63
-        return wp_validate_boolean($this->args['pagination'])
64
-            ? $this->pagination
65
-            : '';
66
-    }
58
+	/**
59
+	 * @return string
60
+	 */
61
+	public function getPagination()
62
+	{
63
+		return wp_validate_boolean($this->args['pagination'])
64
+			? $this->pagination
65
+			: '';
66
+	}
67 67
 
68
-    /**
69
-     * @return string
70
-     */
71
-    public function getReviews()
72
-    {
73
-        $html = empty($this->reviews)
74
-            ? $this->getReviewsFallback()
75
-            : implode(PHP_EOL, $this->reviews);
76
-        $wrapper = '<div class="glsr-reviews">%s</div>';
77
-        $wrapper = apply_filters('site-reviews/reviews/reviews-wrapper', $wrapper);
78
-        return sprintf($wrapper, $html);
79
-    }
68
+	/**
69
+	 * @return string
70
+	 */
71
+	public function getReviews()
72
+	{
73
+		$html = empty($this->reviews)
74
+			? $this->getReviewsFallback()
75
+			: implode(PHP_EOL, $this->reviews);
76
+		$wrapper = '<div class="glsr-reviews">%s</div>';
77
+		$wrapper = apply_filters('site-reviews/reviews/reviews-wrapper', $wrapper);
78
+		return sprintf($wrapper, $html);
79
+	}
80 80
 
81
-    /**
82
-     * @param mixed $key
83
-     * @return mixed
84
-     */
85
-    public function offsetGet($key)
86
-    {
87
-        if ('navigation' == $key) {
88
-            glsr()->deprecated[] = 'The $reviewsHtml->navigation property has been been deprecated. Please use the $reviewsHtml->pagination property instead.';
89
-            return $this->pagination;
90
-        }
91
-        if (array_key_exists($key, $this->reviews)) {
92
-            return $this->reviews[$key];
93
-        }
94
-        return property_exists($this, $key)
95
-            ? $this->$key
96
-            : null;
97
-    }
81
+	/**
82
+	 * @param mixed $key
83
+	 * @return mixed
84
+	 */
85
+	public function offsetGet($key)
86
+	{
87
+		if ('navigation' == $key) {
88
+			glsr()->deprecated[] = 'The $reviewsHtml->navigation property has been been deprecated. Please use the $reviewsHtml->pagination property instead.';
89
+			return $this->pagination;
90
+		}
91
+		if (array_key_exists($key, $this->reviews)) {
92
+			return $this->reviews[$key];
93
+		}
94
+		return property_exists($this, $key)
95
+			? $this->$key
96
+			: null;
97
+	}
98 98
 
99
-    /**
100
-     * @return string
101
-     */
102
-    protected function buildPagination()
103
-    {
104
-        $html = glsr(Partial::class)->build('pagination', [
105
-            'baseUrl' => Arr::get($this->args, 'pagedUrl'),
106
-            'current' => Arr::get($this->args, 'paged'),
107
-            'total' => $this->max_num_pages,
108
-        ]);
109
-        $html.= sprintf('<glsr-pagination hidden data-atts=\'%s\'></glsr-pagination>', $this->args['json']);
110
-        $wrapper = '<div class="glsr-pagination">%s</div>';
111
-        $wrapper = apply_filters('site-reviews/reviews/pagination-wrapper', $wrapper);
112
-        return sprintf($wrapper, $html);
113
-    }
99
+	/**
100
+	 * @return string
101
+	 */
102
+	protected function buildPagination()
103
+	{
104
+		$html = glsr(Partial::class)->build('pagination', [
105
+			'baseUrl' => Arr::get($this->args, 'pagedUrl'),
106
+			'current' => Arr::get($this->args, 'paged'),
107
+			'total' => $this->max_num_pages,
108
+		]);
109
+		$html.= sprintf('<glsr-pagination hidden data-atts=\'%s\'></glsr-pagination>', $this->args['json']);
110
+		$wrapper = '<div class="glsr-pagination">%s</div>';
111
+		$wrapper = apply_filters('site-reviews/reviews/pagination-wrapper', $wrapper);
112
+		return sprintf($wrapper, $html);
113
+	}
114 114
 
115
-    /**
116
-     * @return string
117
-     */
118
-    protected function getClass()
119
-    {
120
-        $defaults = [
121
-            'glsr-default',
122
-        ];
123
-        if ('ajax' == $this->args['pagination']) {
124
-            $defaults[] = 'glsr-ajax-pagination';
125
-        }
126
-        $classes = explode(' ', $this->args['class']);
127
-        $classes = array_unique(array_merge($defaults, array_filter($classes)));
128
-        return implode(' ', $classes);
129
-    }
115
+	/**
116
+	 * @return string
117
+	 */
118
+	protected function getClass()
119
+	{
120
+		$defaults = [
121
+			'glsr-default',
122
+		];
123
+		if ('ajax' == $this->args['pagination']) {
124
+			$defaults[] = 'glsr-ajax-pagination';
125
+		}
126
+		$classes = explode(' ', $this->args['class']);
127
+		$classes = array_unique(array_merge($defaults, array_filter($classes)));
128
+		return implode(' ', $classes);
129
+	}
130 130
 
131
-    /**
132
-     * @return string
133
-     */
134
-    protected function getReviewsFallback()
135
-    {
136
-        if (empty($this->args['fallback']) && glsr(OptionManager::class)->getBool('settings.reviews.fallback')) {
137
-            $this->args['fallback'] = __('There are no reviews yet. Be the first one to write one.', 'site-reviews');
138
-        }
139
-        $fallback = '<p class="glsr-no-margins">'.$this->args['fallback'].'</p>';
140
-        return apply_filters('site-reviews/reviews/fallback', $fallback, $this->args);
141
-    }
131
+	/**
132
+	 * @return string
133
+	 */
134
+	protected function getReviewsFallback()
135
+	{
136
+		if (empty($this->args['fallback']) && glsr(OptionManager::class)->getBool('settings.reviews.fallback')) {
137
+			$this->args['fallback'] = __('There are no reviews yet. Be the first one to write one.', 'site-reviews');
138
+		}
139
+		$fallback = '<p class="glsr-no-margins">'.$this->args['fallback'].'</p>';
140
+		return apply_filters('site-reviews/reviews/fallback', $fallback, $this->args);
141
+	}
142 142
 }
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -28,13 +28,13 @@  discard block
 block discarded – undo
28 28
      */
29 29
     public $reviews;
30 30
 
31
-    public function __construct(array $renderedReviews, $maxPageCount, array $args)
31
+    public function __construct( array $renderedReviews, $maxPageCount, array $args )
32 32
     {
33 33
         $this->args = $args;
34 34
         $this->max_num_pages = $maxPageCount;
35 35
         $this->reviews = $renderedReviews;
36 36
         $this->pagination = $this->buildPagination();
37
-        parent::__construct($renderedReviews, ArrayObject::STD_PROP_LIST | ArrayObject::ARRAY_AS_PROPS);
37
+        parent::__construct( $renderedReviews, ArrayObject::STD_PROP_LIST | ArrayObject::ARRAY_AS_PROPS );
38 38
     }
39 39
 
40 40
     /**
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
      */
43 43
     public function __toString()
44 44
     {
45
-        return glsr(Template::class)->build('templates/reviews', [
45
+        return glsr( Template::class )->build( 'templates/reviews', [
46 46
             'args' => $this->args,
47 47
             'context' => [
48 48
                 'assigned_to' => $this->args['assigned_to'],
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
                 'pagination' => $this->getPagination(),
53 53
                 'reviews' => $this->getReviews(),
54 54
             ],
55
-        ]);
55
+        ] );
56 56
     }
57 57
 
58 58
     /**
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
      */
61 61
     public function getPagination()
62 62
     {
63
-        return wp_validate_boolean($this->args['pagination'])
63
+        return wp_validate_boolean( $this->args['pagination'] )
64 64
             ? $this->pagination
65 65
             : '';
66 66
     }
@@ -72,26 +72,26 @@  discard block
 block discarded – undo
72 72
     {
73 73
         $html = empty($this->reviews)
74 74
             ? $this->getReviewsFallback()
75
-            : implode(PHP_EOL, $this->reviews);
75
+            : implode( PHP_EOL, $this->reviews );
76 76
         $wrapper = '<div class="glsr-reviews">%s</div>';
77
-        $wrapper = apply_filters('site-reviews/reviews/reviews-wrapper', $wrapper);
78
-        return sprintf($wrapper, $html);
77
+        $wrapper = apply_filters( 'site-reviews/reviews/reviews-wrapper', $wrapper );
78
+        return sprintf( $wrapper, $html );
79 79
     }
80 80
 
81 81
     /**
82 82
      * @param mixed $key
83 83
      * @return mixed
84 84
      */
85
-    public function offsetGet($key)
85
+    public function offsetGet( $key )
86 86
     {
87
-        if ('navigation' == $key) {
87
+        if( 'navigation' == $key ) {
88 88
             glsr()->deprecated[] = 'The $reviewsHtml->navigation property has been been deprecated. Please use the $reviewsHtml->pagination property instead.';
89 89
             return $this->pagination;
90 90
         }
91
-        if (array_key_exists($key, $this->reviews)) {
91
+        if( array_key_exists( $key, $this->reviews ) ) {
92 92
             return $this->reviews[$key];
93 93
         }
94
-        return property_exists($this, $key)
94
+        return property_exists( $this, $key )
95 95
             ? $this->$key
96 96
             : null;
97 97
     }
@@ -101,15 +101,15 @@  discard block
 block discarded – undo
101 101
      */
102 102
     protected function buildPagination()
103 103
     {
104
-        $html = glsr(Partial::class)->build('pagination', [
105
-            'baseUrl' => Arr::get($this->args, 'pagedUrl'),
106
-            'current' => Arr::get($this->args, 'paged'),
104
+        $html = glsr( Partial::class )->build( 'pagination', [
105
+            'baseUrl' => Arr::get( $this->args, 'pagedUrl' ),
106
+            'current' => Arr::get( $this->args, 'paged' ),
107 107
             'total' => $this->max_num_pages,
108
-        ]);
109
-        $html.= sprintf('<glsr-pagination hidden data-atts=\'%s\'></glsr-pagination>', $this->args['json']);
108
+        ] );
109
+        $html .= sprintf( '<glsr-pagination hidden data-atts=\'%s\'></glsr-pagination>', $this->args['json'] );
110 110
         $wrapper = '<div class="glsr-pagination">%s</div>';
111
-        $wrapper = apply_filters('site-reviews/reviews/pagination-wrapper', $wrapper);
112
-        return sprintf($wrapper, $html);
111
+        $wrapper = apply_filters( 'site-reviews/reviews/pagination-wrapper', $wrapper );
112
+        return sprintf( $wrapper, $html );
113 113
     }
114 114
 
115 115
     /**
@@ -120,12 +120,12 @@  discard block
 block discarded – undo
120 120
         $defaults = [
121 121
             'glsr-default',
122 122
         ];
123
-        if ('ajax' == $this->args['pagination']) {
123
+        if( 'ajax' == $this->args['pagination'] ) {
124 124
             $defaults[] = 'glsr-ajax-pagination';
125 125
         }
126
-        $classes = explode(' ', $this->args['class']);
127
-        $classes = array_unique(array_merge($defaults, array_filter($classes)));
128
-        return implode(' ', $classes);
126
+        $classes = explode( ' ', $this->args['class'] );
127
+        $classes = array_unique( array_merge( $defaults, array_filter( $classes ) ) );
128
+        return implode( ' ', $classes );
129 129
     }
130 130
 
131 131
     /**
@@ -133,10 +133,10 @@  discard block
 block discarded – undo
133 133
      */
134 134
     protected function getReviewsFallback()
135 135
     {
136
-        if (empty($this->args['fallback']) && glsr(OptionManager::class)->getBool('settings.reviews.fallback')) {
137
-            $this->args['fallback'] = __('There are no reviews yet. Be the first one to write one.', 'site-reviews');
136
+        if( empty($this->args['fallback']) && glsr( OptionManager::class )->getBool( 'settings.reviews.fallback' ) ) {
137
+            $this->args['fallback'] = __( 'There are no reviews yet. Be the first one to write one.', 'site-reviews' );
138 138
         }
139 139
         $fallback = '<p class="glsr-no-margins">'.$this->args['fallback'].'</p>';
140
-        return apply_filters('site-reviews/reviews/fallback', $fallback, $this->args);
140
+        return apply_filters( 'site-reviews/reviews/fallback', $fallback, $this->args );
141 141
     }
142 142
 }
Please login to merge, or discard this patch.
plugin/Contracts/PartialContract.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@
 block discarded – undo
4 4
 
5 5
 interface PartialContract
6 6
 {
7
-    /**
8
-     * @return string
9
-     */
10
-    public function build(array $args = []);
7
+	/**
8
+	 * @return string
9
+	 */
10
+	public function build(array $args = []);
11 11
 }
Please login to merge, or discard this 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.
uninstall.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
 require_once $file;
7 7
 
8 8
 if (!(new GL_Plugin_Check_v4($file))->isValid()) {
9
-    return;
9
+	return;
10 10
 }
11 11
 delete_option(GeminiLabs\SiteReviews\Database\OptionManager::databaseKey(3));
12 12
 delete_option(GeminiLabs\SiteReviews\Database\OptionManager::databaseKey(4));
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,23 +1,23 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-defined('WP_UNINSTALL_PLUGIN') || die;
3
+defined( 'WP_UNINSTALL_PLUGIN' ) || die;
4 4
 
5 5
 $file = __DIR__.'/site-reviews.php';
6 6
 require_once $file;
7 7
 
8
-if (!(new GL_Plugin_Check_v4($file))->isValid()) {
8
+if( !(new GL_Plugin_Check_v4( $file ))->isValid() ) {
9 9
     return;
10 10
 }
11
-delete_option(GeminiLabs\SiteReviews\Database\OptionManager::databaseKey(3));
12
-delete_option(GeminiLabs\SiteReviews\Database\OptionManager::databaseKey(4));
13
-delete_option('_glsr_trustalyze');
14
-delete_option('widget_'.glsr()->id.'_site-reviews');
15
-delete_option('widget_'.glsr()->id.'_site-reviews-form');
16
-delete_option('widget_'.glsr()->id.'_site-reviews-summary');
17
-delete_transient(glsr()->id.'_cloudflare_ips');
18
-delete_transient(glsr()->id.'_remote_post_test');
19
-wp_cache_delete(glsr()->id);
11
+delete_option( GeminiLabs\SiteReviews\Database\OptionManager::databaseKey( 3 ) );
12
+delete_option( GeminiLabs\SiteReviews\Database\OptionManager::databaseKey( 4 ) );
13
+delete_option( '_glsr_trustalyze' );
14
+delete_option( 'widget_'.glsr()->id.'_site-reviews' );
15
+delete_option( 'widget_'.glsr()->id.'_site-reviews-form' );
16
+delete_option( 'widget_'.glsr()->id.'_site-reviews-summary' );
17
+delete_transient( glsr()->id.'_cloudflare_ips' );
18
+delete_transient( glsr()->id.'_remote_post_test' );
19
+wp_cache_delete( glsr()->id );
20 20
 
21 21
 global $wpdb;
22 22
 
23
-$wpdb->query("DELETE FROM {$wpdb->usermeta} WHERE meta_key = '_glsr_notices'");
23
+$wpdb->query( "DELETE FROM {$wpdb->usermeta} WHERE meta_key = '_glsr_notices'" );
Please login to merge, or discard this patch.
plugin/Modules/Html/Partials/StarRating.php 2 patches
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -8,54 +8,54 @@
 block discarded – undo
8 8
 
9 9
 class StarRating implements PartialContract
10 10
 {
11
-    protected $prefix;
12
-    protected $rating;
11
+	protected $prefix;
12
+	protected $rating;
13 13
 
14
-    /**
15
-     * @return string
16
-     */
17
-    public function build(array $args = [])
18
-    {
19
-        $this->setProperties($args);
20
-        $fullStars = intval(floor($this->rating));
21
-        $halfStars = intval(ceil($this->rating - $fullStars));
22
-        $emptyStars = max(0, glsr()->constant('MAX_RATING', Rating::class) - $fullStars - $halfStars);
23
-        return glsr(Template::class)->build('templates/rating/stars', [
24
-            'context' => [
25
-                'empty_stars' => $this->getTemplate('empty-star', $emptyStars),
26
-                'full_stars' => $this->getTemplate('full-star', $fullStars),
27
-                'half_stars' => $this->getTemplate('half-star', $halfStars),
28
-                'prefix' => $this->prefix,
29
-                'title' => sprintf(__('%s rating', 'site-reviews'), number_format_i18n($this->rating, 1)),
30
-            ],
31
-        ]);
32
-    }
14
+	/**
15
+	 * @return string
16
+	 */
17
+	public function build(array $args = [])
18
+	{
19
+		$this->setProperties($args);
20
+		$fullStars = intval(floor($this->rating));
21
+		$halfStars = intval(ceil($this->rating - $fullStars));
22
+		$emptyStars = max(0, glsr()->constant('MAX_RATING', Rating::class) - $fullStars - $halfStars);
23
+		return glsr(Template::class)->build('templates/rating/stars', [
24
+			'context' => [
25
+				'empty_stars' => $this->getTemplate('empty-star', $emptyStars),
26
+				'full_stars' => $this->getTemplate('full-star', $fullStars),
27
+				'half_stars' => $this->getTemplate('half-star', $halfStars),
28
+				'prefix' => $this->prefix,
29
+				'title' => sprintf(__('%s rating', 'site-reviews'), number_format_i18n($this->rating, 1)),
30
+			],
31
+		]);
32
+	}
33 33
 
34
-    /**
35
-     * @param string $templateName
36
-     * @param int $timesRepeated
37
-     * @return string
38
-     */
39
-    protected function getTemplate($templateName, $timesRepeated)
40
-    {
41
-        $template = glsr(Template::class)->build('templates/rating/'.$templateName, [
42
-            'context' => [
43
-                'prefix' => $this->prefix,
44
-            ],
45
-        ]);
46
-        return str_repeat($template, $timesRepeated);
47
-    }
34
+	/**
35
+	 * @param string $templateName
36
+	 * @param int $timesRepeated
37
+	 * @return string
38
+	 */
39
+	protected function getTemplate($templateName, $timesRepeated)
40
+	{
41
+		$template = glsr(Template::class)->build('templates/rating/'.$templateName, [
42
+			'context' => [
43
+				'prefix' => $this->prefix,
44
+			],
45
+		]);
46
+		return str_repeat($template, $timesRepeated);
47
+	}
48 48
 
49
-    /**
50
-     * @return array
51
-     */
52
-    protected function setProperties(array $args)
53
-    {
54
-        $args = wp_parse_args($args, [
55
-            'prefix' => glsr()->isAdmin() ? '' : 'glsr-',
56
-            'rating' => 0,
57
-        ]);
58
-        $this->prefix = $args['prefix'];
59
-        $this->rating = (float) str_replace(',', '.', $args['rating']);
60
-    }
49
+	/**
50
+	 * @return array
51
+	 */
52
+	protected function setProperties(array $args)
53
+	{
54
+		$args = wp_parse_args($args, [
55
+			'prefix' => glsr()->isAdmin() ? '' : 'glsr-',
56
+			'rating' => 0,
57
+		]);
58
+		$this->prefix = $args['prefix'];
59
+		$this->rating = (float) str_replace(',', '.', $args['rating']);
60
+	}
61 61
 }
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -14,21 +14,21 @@  discard block
 block discarded – undo
14 14
     /**
15 15
      * @return string
16 16
      */
17
-    public function build(array $args = [])
17
+    public function build( array $args = [] )
18 18
     {
19
-        $this->setProperties($args);
20
-        $fullStars = intval(floor($this->rating));
21
-        $halfStars = intval(ceil($this->rating - $fullStars));
22
-        $emptyStars = max(0, glsr()->constant('MAX_RATING', Rating::class) - $fullStars - $halfStars);
23
-        return glsr(Template::class)->build('templates/rating/stars', [
19
+        $this->setProperties( $args );
20
+        $fullStars = intval( floor( $this->rating ) );
21
+        $halfStars = intval( ceil( $this->rating - $fullStars ) );
22
+        $emptyStars = max( 0, glsr()->constant( 'MAX_RATING', Rating::class ) - $fullStars - $halfStars );
23
+        return glsr( Template::class )->build( 'templates/rating/stars', [
24 24
             'context' => [
25
-                'empty_stars' => $this->getTemplate('empty-star', $emptyStars),
26
-                'full_stars' => $this->getTemplate('full-star', $fullStars),
27
-                'half_stars' => $this->getTemplate('half-star', $halfStars),
25
+                'empty_stars' => $this->getTemplate( 'empty-star', $emptyStars ),
26
+                'full_stars' => $this->getTemplate( 'full-star', $fullStars ),
27
+                'half_stars' => $this->getTemplate( 'half-star', $halfStars ),
28 28
                 'prefix' => $this->prefix,
29
-                'title' => sprintf(__('%s rating', 'site-reviews'), number_format_i18n($this->rating, 1)),
29
+                'title' => sprintf( __( '%s rating', 'site-reviews' ), number_format_i18n( $this->rating, 1 ) ),
30 30
             ],
31
-        ]);
31
+        ] );
32 32
     }
33 33
 
34 34
     /**
@@ -36,26 +36,26 @@  discard block
 block discarded – undo
36 36
      * @param int $timesRepeated
37 37
      * @return string
38 38
      */
39
-    protected function getTemplate($templateName, $timesRepeated)
39
+    protected function getTemplate( $templateName, $timesRepeated )
40 40
     {
41
-        $template = glsr(Template::class)->build('templates/rating/'.$templateName, [
41
+        $template = glsr( Template::class )->build( 'templates/rating/'.$templateName, [
42 42
             'context' => [
43 43
                 'prefix' => $this->prefix,
44 44
             ],
45
-        ]);
46
-        return str_repeat($template, $timesRepeated);
45
+        ] );
46
+        return str_repeat( $template, $timesRepeated );
47 47
     }
48 48
 
49 49
     /**
50 50
      * @return array
51 51
      */
52
-    protected function setProperties(array $args)
52
+    protected function setProperties( array $args )
53 53
     {
54
-        $args = wp_parse_args($args, [
54
+        $args = wp_parse_args( $args, [
55 55
             'prefix' => glsr()->isAdmin() ? '' : 'glsr-',
56 56
             'rating' => 0,
57
-        ]);
57
+        ] );
58 58
         $this->prefix = $args['prefix'];
59
-        $this->rating = (float) str_replace(',', '.', $args['rating']);
59
+        $this->rating = (float)str_replace( ',', '.', $args['rating'] );
60 60
     }
61 61
 }
Please login to merge, or discard this patch.
plugin/Blocks/SiteReviewsFormBlock.php 2 patches
Indentation   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -7,115 +7,115 @@
 block discarded – undo
7 7
 
8 8
 class SiteReviewsFormBlock extends BlockGenerator
9 9
 {
10
-    /**
11
-     * @return array
12
-     */
13
-    public function attributes()
14
-    {
15
-        return [
16
-            'assign_to' => [
17
-                'default' => '',
18
-                'type' => 'string',
19
-            ],
20
-            'category' => [
21
-                'default' => '',
22
-                'type' => 'string',
23
-            ],
24
-            'className' => [
25
-                'default' => '',
26
-                'type' => 'string',
27
-            ],
28
-            'hide' => [
29
-                'default' => '',
30
-                'type' => 'string',
31
-            ],
32
-            'id' => [
33
-                'default' => '',
34
-                'type' => 'string',
35
-            ],
36
-        ];
37
-    }
10
+	/**
11
+	 * @return array
12
+	 */
13
+	public function attributes()
14
+	{
15
+		return [
16
+			'assign_to' => [
17
+				'default' => '',
18
+				'type' => 'string',
19
+			],
20
+			'category' => [
21
+				'default' => '',
22
+				'type' => 'string',
23
+			],
24
+			'className' => [
25
+				'default' => '',
26
+				'type' => 'string',
27
+			],
28
+			'hide' => [
29
+				'default' => '',
30
+				'type' => 'string',
31
+			],
32
+			'id' => [
33
+				'default' => '',
34
+				'type' => 'string',
35
+			],
36
+		];
37
+	}
38 38
 
39
-    /**
40
-     * @return string
41
-     */
42
-    public function render(array $attributes)
43
-    {
44
-        $attributes['class'] = $attributes['className'];
45
-        $shortcode = glsr(Shortcode::class);
46
-        if ('edit' == filter_input(INPUT_GET, 'context')) {
47
-            $this->filterFormFields();
48
-            $this->filterRatingField();
49
-            $this->filterShortcodeClass();
50
-            $this->filterSubmitButton();
51
-            if (!$this->hasVisibleFields($shortcode, $attributes)) {
52
-                $this->filterInterpolation();
53
-            }
54
-        }
55
-        return $shortcode->buildShortcode($attributes);
56
-    }
39
+	/**
40
+	 * @return string
41
+	 */
42
+	public function render(array $attributes)
43
+	{
44
+		$attributes['class'] = $attributes['className'];
45
+		$shortcode = glsr(Shortcode::class);
46
+		if ('edit' == filter_input(INPUT_GET, 'context')) {
47
+			$this->filterFormFields();
48
+			$this->filterRatingField();
49
+			$this->filterShortcodeClass();
50
+			$this->filterSubmitButton();
51
+			if (!$this->hasVisibleFields($shortcode, $attributes)) {
52
+				$this->filterInterpolation();
53
+			}
54
+		}
55
+		return $shortcode->buildShortcode($attributes);
56
+	}
57 57
 
58
-    /**
59
-     * @return void
60
-     */
61
-    protected function filterFormFields()
62
-    {
63
-        add_filter('site-reviews/config/forms/submission-form', function (array $config) {
64
-            array_walk($config, function (&$field) {
65
-                $field['disabled'] = true;
66
-                $field['tabindex'] = '-1';
67
-            });
68
-            return $config;
69
-        });
70
-    }
58
+	/**
59
+	 * @return void
60
+	 */
61
+	protected function filterFormFields()
62
+	{
63
+		add_filter('site-reviews/config/forms/submission-form', function (array $config) {
64
+			array_walk($config, function (&$field) {
65
+				$field['disabled'] = true;
66
+				$field['tabindex'] = '-1';
67
+			});
68
+			return $config;
69
+		});
70
+	}
71 71
 
72
-    /**
73
-     * @return void
74
-     */
75
-    protected function filterInterpolation()
76
-    {
77
-        add_filter('site-reviews/interpolate/reviews-form', function ($context) {
78
-            $context['class'] = 'glsr-default glsr-block-disabled';
79
-            $context['fields'] = __('You have hidden all of the fields for this block.', 'site-reviews');
80
-            $context['response'] = '';
81
-            $context['submit_button'] = '';
82
-            return $context;
83
-        });
84
-    }
72
+	/**
73
+	 * @return void
74
+	 */
75
+	protected function filterInterpolation()
76
+	{
77
+		add_filter('site-reviews/interpolate/reviews-form', function ($context) {
78
+			$context['class'] = 'glsr-default glsr-block-disabled';
79
+			$context['fields'] = __('You have hidden all of the fields for this block.', 'site-reviews');
80
+			$context['response'] = '';
81
+			$context['submit_button'] = '';
82
+			return $context;
83
+		});
84
+	}
85 85
 
86
-    /**
87
-     * @return void
88
-     */
89
-    protected function filterRatingField()
90
-    {
91
-        add_filter('site-reviews/rendered/field', function ($html, $type, $args) {
92
-            if ('rating' == $args['path']) {
93
-                $stars = '<span class="glsr-stars">';
94
-                $stars.= str_repeat('<span class="glsr-star glsr-star-empty" aria-hidden="true"></span>', (int) glsr()->constant('MAX_RATING', Rating::class));
95
-                $stars.= '</span>';
96
-                $html = preg_replace('/(.*)(<select.*)(<\/select>)(.*)/', '$1'.$stars.'$4', $html);
97
-            }
98
-            return $html;
99
-        }, 10, 3);
100
-    }
86
+	/**
87
+	 * @return void
88
+	 */
89
+	protected function filterRatingField()
90
+	{
91
+		add_filter('site-reviews/rendered/field', function ($html, $type, $args) {
92
+			if ('rating' == $args['path']) {
93
+				$stars = '<span class="glsr-stars">';
94
+				$stars.= str_repeat('<span class="glsr-star glsr-star-empty" aria-hidden="true"></span>', (int) glsr()->constant('MAX_RATING', Rating::class));
95
+				$stars.= '</span>';
96
+				$html = preg_replace('/(.*)(<select.*)(<\/select>)(.*)/', '$1'.$stars.'$4', $html);
97
+			}
98
+			return $html;
99
+		}, 10, 3);
100
+	}
101 101
 
102
-    /**
103
-     * @return void
104
-     */
105
-    protected function filterShortcodeClass()
106
-    {
107
-        add_filter('site-reviews/style', function () {
108
-            return 'default';
109
-        });
110
-    }
102
+	/**
103
+	 * @return void
104
+	 */
105
+	protected function filterShortcodeClass()
106
+	{
107
+		add_filter('site-reviews/style', function () {
108
+			return 'default';
109
+		});
110
+	}
111 111
 
112
-    /**
113
-     * @return void
114
-     */
115
-    protected function filterSubmitButton()
116
-    {
117
-        add_filter('site-reviews/rendered/template/form/submit-button', function ($template) {
118
-            return str_replace('type="submit"', 'tabindex="-1"', $template);
119
-        });
120
-    }
112
+	/**
113
+	 * @return void
114
+	 */
115
+	protected function filterSubmitButton()
116
+	{
117
+		add_filter('site-reviews/rendered/template/form/submit-button', function ($template) {
118
+			return str_replace('type="submit"', 'tabindex="-1"', $template);
119
+		});
120
+	}
121 121
 }
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -39,20 +39,20 @@  discard block
 block discarded – undo
39 39
     /**
40 40
      * @return string
41 41
      */
42
-    public function render(array $attributes)
42
+    public function render( array $attributes )
43 43
     {
44 44
         $attributes['class'] = $attributes['className'];
45
-        $shortcode = glsr(Shortcode::class);
46
-        if ('edit' == filter_input(INPUT_GET, 'context')) {
45
+        $shortcode = glsr( Shortcode::class );
46
+        if( 'edit' == filter_input( INPUT_GET, 'context' ) ) {
47 47
             $this->filterFormFields();
48 48
             $this->filterRatingField();
49 49
             $this->filterShortcodeClass();
50 50
             $this->filterSubmitButton();
51
-            if (!$this->hasVisibleFields($shortcode, $attributes)) {
51
+            if( !$this->hasVisibleFields( $shortcode, $attributes ) ) {
52 52
                 $this->filterInterpolation();
53 53
             }
54 54
         }
55
-        return $shortcode->buildShortcode($attributes);
55
+        return $shortcode->buildShortcode( $attributes );
56 56
     }
57 57
 
58 58
     /**
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
60 60
      */
61 61
     protected function filterFormFields()
62 62
     {
63
-        add_filter('site-reviews/config/forms/submission-form', function (array $config) {
64
-            array_walk($config, function (&$field) {
63
+        add_filter( 'site-reviews/config/forms/submission-form', function( array $config ) {
64
+            array_walk( $config, function( &$field ) {
65 65
                 $field['disabled'] = true;
66 66
                 $field['tabindex'] = '-1';
67 67
             });
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
      */
75 75
     protected function filterInterpolation()
76 76
     {
77
-        add_filter('site-reviews/interpolate/reviews-form', function ($context) {
77
+        add_filter( 'site-reviews/interpolate/reviews-form', function( $context ) {
78 78
             $context['class'] = 'glsr-default glsr-block-disabled';
79
-            $context['fields'] = __('You have hidden all of the fields for this block.', 'site-reviews');
79
+            $context['fields'] = __( 'You have hidden all of the fields for this block.', 'site-reviews' );
80 80
             $context['response'] = '';
81 81
             $context['submit_button'] = '';
82 82
             return $context;
@@ -88,15 +88,15 @@  discard block
 block discarded – undo
88 88
      */
89 89
     protected function filterRatingField()
90 90
     {
91
-        add_filter('site-reviews/rendered/field', function ($html, $type, $args) {
92
-            if ('rating' == $args['path']) {
91
+        add_filter( 'site-reviews/rendered/field', function( $html, $type, $args ) {
92
+            if( 'rating' == $args['path'] ) {
93 93
                 $stars = '<span class="glsr-stars">';
94
-                $stars.= str_repeat('<span class="glsr-star glsr-star-empty" aria-hidden="true"></span>', (int) glsr()->constant('MAX_RATING', Rating::class));
95
-                $stars.= '</span>';
96
-                $html = preg_replace('/(.*)(<select.*)(<\/select>)(.*)/', '$1'.$stars.'$4', $html);
94
+                $stars .= str_repeat( '<span class="glsr-star glsr-star-empty" aria-hidden="true"></span>', (int)glsr()->constant( 'MAX_RATING', Rating::class ) );
95
+                $stars .= '</span>';
96
+                $html = preg_replace( '/(.*)(<select.*)(<\/select>)(.*)/', '$1'.$stars.'$4', $html );
97 97
             }
98 98
             return $html;
99
-        }, 10, 3);
99
+        }, 10, 3 );
100 100
     }
101 101
 
102 102
     /**
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
      */
105 105
     protected function filterShortcodeClass()
106 106
     {
107
-        add_filter('site-reviews/style', function () {
107
+        add_filter( 'site-reviews/style', function() {
108 108
             return 'default';
109 109
         });
110 110
     }
@@ -114,8 +114,8 @@  discard block
 block discarded – undo
114 114
      */
115 115
     protected function filterSubmitButton()
116 116
     {
117
-        add_filter('site-reviews/rendered/template/form/submit-button', function ($template) {
118
-            return str_replace('type="submit"', 'tabindex="-1"', $template);
117
+        add_filter( 'site-reviews/rendered/template/form/submit-button', function( $template ) {
118
+            return str_replace( 'type="submit"', 'tabindex="-1"', $template );
119 119
         });
120 120
     }
121 121
 }
Please login to merge, or discard this patch.