Passed
Push — master ( 0b281c...7e4cda )
by Paul
10:53 queued 04:23
created
plugin/Blocks/SiteReviewsBlock.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -62,21 +62,21 @@  discard block
 block discarded – undo
62 62
     /**
63 63
      * @return string
64 64
      */
65
-    public function render(array $attributes)
65
+    public function render( array $attributes )
66 66
     {
67 67
         $attributes['class'] = $attributes['className'];
68
-        $shortcode = glsr(Shortcode::class);
69
-        if ('edit' == filter_input(INPUT_GET, 'context')) {
70
-            $attributes = $this->normalize($attributes);
68
+        $shortcode = glsr( Shortcode::class );
69
+        if( 'edit' == filter_input( INPUT_GET, 'context' ) ) {
70
+            $attributes = $this->normalize( $attributes );
71 71
             $this->filterReviewLinks();
72 72
             $this->filterShortcodeClass();
73
-            $this->filterShowMoreLinks('content');
74
-            $this->filterShowMoreLinks('response');
75
-            if (!$this->hasVisibleFields($shortcode, $attributes)) {
73
+            $this->filterShowMoreLinks( 'content' );
74
+            $this->filterShowMoreLinks( 'response' );
75
+            if( !$this->hasVisibleFields( $shortcode, $attributes ) ) {
76 76
                 $this->filterInterpolation();
77 77
             }
78 78
         }
79
-        return $shortcode->buildShortcode($attributes);
79
+        return $shortcode->buildShortcode( $attributes );
80 80
     }
81 81
 
82 82
     /**
@@ -84,9 +84,9 @@  discard block
 block discarded – undo
84 84
      */
85 85
     protected function filterInterpolation()
86 86
     {
87
-        add_filter('site-reviews/interpolate/reviews', function ($context) {
87
+        add_filter( 'site-reviews/interpolate/reviews', function( $context ) {
88 88
             $context['class'] = 'glsr-default glsr-block-disabled';
89
-            $context['reviews'] = __('You have hidden all of the fields for this block.', 'site-reviews');
89
+            $context['reviews'] = __( 'You have hidden all of the fields for this block.', 'site-reviews' );
90 90
             return $context;
91 91
         });
92 92
     }
@@ -96,8 +96,8 @@  discard block
 block discarded – undo
96 96
      */
97 97
     protected function filterReviewLinks()
98 98
     {
99
-        add_filter('site-reviews/rendered/template/reviews', function ($template) {
100
-            return str_replace('<a', '<a tabindex="-1"', $template);
99
+        add_filter( 'site-reviews/rendered/template/reviews', function( $template ) {
100
+            return str_replace( '<a', '<a tabindex="-1"', $template );
101 101
         });
102 102
     }
103 103
 
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
      */
107 107
     protected function filterShortcodeClass()
108 108
     {
109
-        add_filter('site-reviews/style', function () {
109
+        add_filter( 'site-reviews/style', function() {
110 110
             return 'default';
111 111
         });
112 112
     }
@@ -115,12 +115,12 @@  discard block
 block discarded – undo
115 115
      * @param string $field
116 116
      * @return void
117 117
      */
118
-    protected function filterShowMoreLinks($field)
118
+    protected function filterShowMoreLinks( $field )
119 119
     {
120
-        add_filter('site-reviews/review/wrap/'.$field, function ($value) {
120
+        add_filter( 'site-reviews/review/wrap/'.$field, function( $value ) {
121 121
             $value = preg_replace(
122 122
                 '/(.*)(<span class="glsr-hidden)(.*)(<\/span>)(.*)/s',
123
-                '$1... <a href="#" class="glsr-read-more" tabindex="-1">'.__('Show more', 'site-reviews').'</a>$5',
123
+                '$1... <a href="#" class="glsr-read-more" tabindex="-1">'.__( 'Show more', 'site-reviews' ).'</a>$5',
124 124
                 $value
125 125
             );
126 126
             return $value;
Please login to merge, or discard this patch.
Indentation   +115 added lines, -115 removed lines patch added patch discarded remove patch
@@ -6,124 +6,124 @@
 block discarded – undo
6 6
 
7 7
 class SiteReviewsBlock extends BlockGenerator
8 8
 {
9
-    /**
10
-     * @return array
11
-     */
12
-    public function attributes()
13
-    {
14
-        return [
15
-            'assigned_to' => [
16
-                'default' => '',
17
-                'type' => 'string',
18
-            ],
19
-            'category' => [
20
-                'default' => '',
21
-                'type' => 'string',
22
-            ],
23
-            'className' => [
24
-                'default' => '',
25
-                'type' => 'string',
26
-            ],
27
-            'display' => [
28
-                'default' => 5,
29
-                'type' => 'number',
30
-            ],
31
-            'hide' => [
32
-                'default' => '',
33
-                'type' => 'string',
34
-            ],
35
-            'id' => [
36
-                'default' => '',
37
-                'type' => 'string',
38
-            ],
39
-            'pagination' => [
40
-                'default' => '',
41
-                'type' => 'string',
42
-            ],
43
-            'post_id' => [
44
-                'default' => '',
45
-                'type' => 'string',
46
-            ],
47
-            'rating' => [
48
-                'default' => 0,
49
-                'type' => 'number',
50
-            ],
51
-            'schema' => [
52
-                'default' => false,
53
-                'type' => 'boolean',
54
-            ],
55
-            'type' => [
56
-                'default' => 'local',
57
-                'type' => 'string',
58
-            ],
59
-        ];
60
-    }
9
+	/**
10
+	 * @return array
11
+	 */
12
+	public function attributes()
13
+	{
14
+		return [
15
+			'assigned_to' => [
16
+				'default' => '',
17
+				'type' => 'string',
18
+			],
19
+			'category' => [
20
+				'default' => '',
21
+				'type' => 'string',
22
+			],
23
+			'className' => [
24
+				'default' => '',
25
+				'type' => 'string',
26
+			],
27
+			'display' => [
28
+				'default' => 5,
29
+				'type' => 'number',
30
+			],
31
+			'hide' => [
32
+				'default' => '',
33
+				'type' => 'string',
34
+			],
35
+			'id' => [
36
+				'default' => '',
37
+				'type' => 'string',
38
+			],
39
+			'pagination' => [
40
+				'default' => '',
41
+				'type' => 'string',
42
+			],
43
+			'post_id' => [
44
+				'default' => '',
45
+				'type' => 'string',
46
+			],
47
+			'rating' => [
48
+				'default' => 0,
49
+				'type' => 'number',
50
+			],
51
+			'schema' => [
52
+				'default' => false,
53
+				'type' => 'boolean',
54
+			],
55
+			'type' => [
56
+				'default' => 'local',
57
+				'type' => 'string',
58
+			],
59
+		];
60
+	}
61 61
 
62
-    /**
63
-     * @return string
64
-     */
65
-    public function render(array $attributes)
66
-    {
67
-        $attributes['class'] = $attributes['className'];
68
-        $shortcode = glsr(Shortcode::class);
69
-        if ('edit' == filter_input(INPUT_GET, 'context')) {
70
-            $attributes = $this->normalize($attributes);
71
-            $this->filterReviewLinks();
72
-            $this->filterShortcodeClass();
73
-            $this->filterShowMoreLinks('content');
74
-            $this->filterShowMoreLinks('response');
75
-            if (!$this->hasVisibleFields($shortcode, $attributes)) {
76
-                $this->filterInterpolation();
77
-            }
78
-        }
79
-        return $shortcode->buildShortcode($attributes);
80
-    }
62
+	/**
63
+	 * @return string
64
+	 */
65
+	public function render(array $attributes)
66
+	{
67
+		$attributes['class'] = $attributes['className'];
68
+		$shortcode = glsr(Shortcode::class);
69
+		if ('edit' == filter_input(INPUT_GET, 'context')) {
70
+			$attributes = $this->normalize($attributes);
71
+			$this->filterReviewLinks();
72
+			$this->filterShortcodeClass();
73
+			$this->filterShowMoreLinks('content');
74
+			$this->filterShowMoreLinks('response');
75
+			if (!$this->hasVisibleFields($shortcode, $attributes)) {
76
+				$this->filterInterpolation();
77
+			}
78
+		}
79
+		return $shortcode->buildShortcode($attributes);
80
+	}
81 81
 
82
-    /**
83
-     * @return void
84
-     */
85
-    protected function filterInterpolation()
86
-    {
87
-        add_filter('site-reviews/interpolate/reviews', function ($context) {
88
-            $context['class'] = 'glsr-default glsr-block-disabled';
89
-            $context['reviews'] = __('You have hidden all of the fields for this block.', 'site-reviews');
90
-            return $context;
91
-        });
92
-    }
82
+	/**
83
+	 * @return void
84
+	 */
85
+	protected function filterInterpolation()
86
+	{
87
+		add_filter('site-reviews/interpolate/reviews', function ($context) {
88
+			$context['class'] = 'glsr-default glsr-block-disabled';
89
+			$context['reviews'] = __('You have hidden all of the fields for this block.', 'site-reviews');
90
+			return $context;
91
+		});
92
+	}
93 93
 
94
-    /**
95
-     * @return void
96
-     */
97
-    protected function filterReviewLinks()
98
-    {
99
-        add_filter('site-reviews/rendered/template/reviews', function ($template) {
100
-            return str_replace('<a', '<a tabindex="-1"', $template);
101
-        });
102
-    }
94
+	/**
95
+	 * @return void
96
+	 */
97
+	protected function filterReviewLinks()
98
+	{
99
+		add_filter('site-reviews/rendered/template/reviews', function ($template) {
100
+			return str_replace('<a', '<a tabindex="-1"', $template);
101
+		});
102
+	}
103 103
 
104
-    /**
105
-     * @return void
106
-     */
107
-    protected function filterShortcodeClass()
108
-    {
109
-        add_filter('site-reviews/style', function () {
110
-            return 'default';
111
-        });
112
-    }
104
+	/**
105
+	 * @return void
106
+	 */
107
+	protected function filterShortcodeClass()
108
+	{
109
+		add_filter('site-reviews/style', function () {
110
+			return 'default';
111
+		});
112
+	}
113 113
 
114
-    /**
115
-     * @param string $field
116
-     * @return void
117
-     */
118
-    protected function filterShowMoreLinks($field)
119
-    {
120
-        add_filter('site-reviews/review/wrap/'.$field, function ($value) {
121
-            $value = preg_replace(
122
-                '/(.*)(<span class="glsr-hidden)(.*)(<\/span>)(.*)/s',
123
-                '$1... <a href="#" class="glsr-read-more" tabindex="-1">'.__('Show more', 'site-reviews').'</a>$5',
124
-                $value
125
-            );
126
-            return $value;
127
-        });
128
-    }
114
+	/**
115
+	 * @param string $field
116
+	 * @return void
117
+	 */
118
+	protected function filterShowMoreLinks($field)
119
+	{
120
+		add_filter('site-reviews/review/wrap/'.$field, function ($value) {
121
+			$value = preg_replace(
122
+				'/(.*)(<span class="glsr-hidden)(.*)(<\/span>)(.*)/s',
123
+				'$1... <a href="#" class="glsr-read-more" tabindex="-1">'.__('Show more', 'site-reviews').'</a>$5',
124
+				$value
125
+			);
126
+			return $value;
127
+		});
128
+	}
129 129
 }
Please login to merge, or discard this patch.
plugin/Container.php 3 patches
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -68,9 +68,11 @@  discard block
 block discarded – undo
68 68
     {
69 69
         if (!property_exists($this, $property) || in_array($property, static::PROTECTED_PROPERTIES)) {
70 70
             $this->storage[$property] = $value;
71
-        } elseif (!isset($this->$property)) {
71
+        }
72
+        elseif (!isset($this->$property)) {
72 73
             $this->$property = $value;
73
-        } else {
74
+        }
75
+        else {
74 76
             throw new Exception(sprintf('The "%s" property cannot be changed once set.', $property));
75 77
         }
76 78
     }
@@ -165,7 +167,8 @@  discard block
 block discarded – undo
165 167
     {
166 168
         try {
167 169
             return $this->make($parameter->getClass()->name);
168
-        } catch (Exception $error) {
170
+        }
171
+        catch (Exception $error) {
169 172
             if ($parameter->isOptional()) {
170 173
                 return $parameter->getDefaultValue();
171 174
             }
Please login to merge, or discard this patch.
Indentation   +222 added lines, -222 removed lines patch added patch discarded remove patch
@@ -11,226 +11,226 @@
 block discarded – undo
11 11
 
12 12
 abstract class Container
13 13
 {
14
-    const PROTECTED_PROPERTIES = [
15
-        'instance',
16
-        'services',
17
-        'session',
18
-        'storage',
19
-    ];
20
-
21
-    /**
22
-     * @var static
23
-     */
24
-    protected static $instance;
25
-
26
-    /**
27
-     * The container's bound services.
28
-     * @var array
29
-     */
30
-    protected $services = [];
31
-
32
-    /**
33
-     * @var array
34
-     */
35
-    protected $session = [];
36
-
37
-    /**
38
-     * The container's storage items.
39
-     * @var array
40
-     */
41
-    protected $storage = [];
42
-
43
-    /**
44
-     * @return static
45
-     */
46
-    public static function load()
47
-    {
48
-        if (empty(static::$instance)) {
49
-            static::$instance = new static();
50
-        }
51
-        return static::$instance;
52
-    }
53
-
54
-    /**
55
-     * @param string $property
56
-     * @return mixed
57
-     */
58
-    public function __get($property)
59
-    {
60
-        if (property_exists($this, $property) && !in_array($property, static::PROTECTED_PROPERTIES)) {
61
-            return $this->$property;
62
-        }
63
-        $constant = 'static::'.strtoupper(Str::snakeCase($property));
64
-        if (defined($constant)) {
65
-            return constant($constant);
66
-        }
67
-        return Arr::get($this->storage, $property, null);
68
-    }
69
-
70
-    /**
71
-     * @param string $property
72
-     * @param string $value
73
-     * @return void
74
-     */
75
-    public function __set($property, $value)
76
-    {
77
-        if (!property_exists($this, $property) || in_array($property, static::PROTECTED_PROPERTIES)) {
78
-            $this->storage[$property] = $value;
79
-        } elseif (!isset($this->$property)) {
80
-            $this->$property = $value;
81
-        } else {
82
-            throw new Exception(sprintf('The "%s" property cannot be changed once set.', $property));
83
-        }
84
-    }
85
-
86
-    /**
87
-     * Bind a service to the container.
88
-     * @param string $alias
89
-     * @param mixed $concrete
90
-     * @return mixed
91
-     */
92
-    public function bind($alias, $concrete)
93
-    {
94
-        $this->services[$alias] = $concrete;
95
-    }
96
-
97
-    /**
98
-     * Request a service from the container.
99
-     * @param mixed $abstract
100
-     * @return mixed
101
-     */
102
-    public function make($abstract)
103
-    {
104
-        if (!isset($this->services[$abstract])) {
105
-            $abstract = $this->addNamespace($abstract);
106
-        }
107
-        if (isset($this->services[$abstract])) {
108
-            $abstract = $this->services[$abstract];
109
-        }
110
-        if (is_callable($abstract)) {
111
-            return call_user_func_array($abstract, [$this]);
112
-        }
113
-        if (is_object($abstract)) {
114
-            return $abstract;
115
-        }
116
-        return $this->resolve($abstract);
117
-    }
118
-
119
-    /**
120
-     * @return void
121
-     */
122
-    public function sessionClear()
123
-    {
124
-        $this->session = [];
125
-    }
126
-
127
-    /**
128
-     * @return mixed
129
-     */
130
-    public function sessionGet($key, $fallback = '')
131
-    {
132
-        $value = Arr::get($this->session, $key, $fallback);
133
-        unset($this->session[$key]);
134
-        return $value;
135
-    }
136
-
137
-    /**
138
-     * @return void
139
-     */
140
-    public function sessionSet($key, $value)
141
-    {
142
-        $this->session[$key] = $value;
143
-    }
144
-
145
-    /**
146
-     * Bind a singleton instance to the container.
147
-     * @param string $alias
148
-     * @param callable|string|null $binding
149
-     * @return void
150
-     */
151
-    public function singleton($alias, $binding)
152
-    {
153
-        $this->bind($alias, $this->make($binding));
154
-    }
155
-
156
-    /**
157
-     * Prefix the current namespace to the abstract if absent.
158
-     * @param string $abstract
159
-     * @return string
160
-     */
161
-    protected function addNamespace($abstract)
162
-    {
163
-        if (!Str::contains($abstract, __NAMESPACE__) && !class_exists($abstract)) {
164
-            $abstract = __NAMESPACE__.'\\'.$abstract;
165
-        }
166
-        return $abstract;
167
-    }
168
-
169
-    /**
170
-     * Resolve a service from the container.
171
-     * @param mixed $concrete
172
-     * @return mixed
173
-     * @throws Exception
174
-     */
175
-    protected function resolve($concrete)
176
-    {
177
-        if ($concrete instanceof Closure) {
178
-            return $concrete($this);
179
-        }
180
-        $reflector = new ReflectionClass($concrete);
181
-        if (!$reflector->isInstantiable()) {
182
-            throw new Exception('Target ['.$concrete.'] is not instantiable.');
183
-        }
184
-        $constructor = $reflector->getConstructor();
185
-        if (empty($constructor)) {
186
-            return new $concrete();
187
-        }
188
-        return $reflector->newInstanceArgs(
189
-            $this->resolveDependencies($constructor->getParameters())
190
-        );
191
-    }
192
-
193
-    /**
194
-     * Resolve a class based dependency from the container.
195
-     * @return mixed
196
-     * @throws Exception
197
-     */
198
-    protected function resolveClass(ReflectionParameter $parameter)
199
-    {
200
-        try {
201
-            return $this->make($parameter->getClass()->name);
202
-        } catch (Exception $error) {
203
-            if ($parameter->isOptional()) {
204
-                return $parameter->getDefaultValue();
205
-            }
206
-            throw $error;
207
-        }
208
-    }
209
-
210
-    /**
211
-     * Resolve all of the dependencies from the ReflectionParameters.
212
-     * @return array
213
-     */
214
-    protected function resolveDependencies(array $dependencies)
215
-    {
216
-        $results = [];
217
-        foreach ($dependencies as $dependency) {
218
-            $results[] = !is_null($class = $dependency->getClass())
219
-                ? $this->resolveClass($dependency)
220
-                : $this->resolveDependency($dependency);
221
-        }
222
-        return $results;
223
-    }
224
-
225
-    /**
226
-     * Resolve a single ReflectionParameter dependency.
227
-     * @return array|null
228
-     */
229
-    protected function resolveDependency(ReflectionParameter $parameter)
230
-    {
231
-        if ($parameter->isArray() && $parameter->isDefaultValueAvailable()) {
232
-            return $parameter->getDefaultValue();
233
-        }
234
-        return null;
235
-    }
14
+	const PROTECTED_PROPERTIES = [
15
+		'instance',
16
+		'services',
17
+		'session',
18
+		'storage',
19
+	];
20
+
21
+	/**
22
+	 * @var static
23
+	 */
24
+	protected static $instance;
25
+
26
+	/**
27
+	 * The container's bound services.
28
+	 * @var array
29
+	 */
30
+	protected $services = [];
31
+
32
+	/**
33
+	 * @var array
34
+	 */
35
+	protected $session = [];
36
+
37
+	/**
38
+	 * The container's storage items.
39
+	 * @var array
40
+	 */
41
+	protected $storage = [];
42
+
43
+	/**
44
+	 * @return static
45
+	 */
46
+	public static function load()
47
+	{
48
+		if (empty(static::$instance)) {
49
+			static::$instance = new static();
50
+		}
51
+		return static::$instance;
52
+	}
53
+
54
+	/**
55
+	 * @param string $property
56
+	 * @return mixed
57
+	 */
58
+	public function __get($property)
59
+	{
60
+		if (property_exists($this, $property) && !in_array($property, static::PROTECTED_PROPERTIES)) {
61
+			return $this->$property;
62
+		}
63
+		$constant = 'static::'.strtoupper(Str::snakeCase($property));
64
+		if (defined($constant)) {
65
+			return constant($constant);
66
+		}
67
+		return Arr::get($this->storage, $property, null);
68
+	}
69
+
70
+	/**
71
+	 * @param string $property
72
+	 * @param string $value
73
+	 * @return void
74
+	 */
75
+	public function __set($property, $value)
76
+	{
77
+		if (!property_exists($this, $property) || in_array($property, static::PROTECTED_PROPERTIES)) {
78
+			$this->storage[$property] = $value;
79
+		} elseif (!isset($this->$property)) {
80
+			$this->$property = $value;
81
+		} else {
82
+			throw new Exception(sprintf('The "%s" property cannot be changed once set.', $property));
83
+		}
84
+	}
85
+
86
+	/**
87
+	 * Bind a service to the container.
88
+	 * @param string $alias
89
+	 * @param mixed $concrete
90
+	 * @return mixed
91
+	 */
92
+	public function bind($alias, $concrete)
93
+	{
94
+		$this->services[$alias] = $concrete;
95
+	}
96
+
97
+	/**
98
+	 * Request a service from the container.
99
+	 * @param mixed $abstract
100
+	 * @return mixed
101
+	 */
102
+	public function make($abstract)
103
+	{
104
+		if (!isset($this->services[$abstract])) {
105
+			$abstract = $this->addNamespace($abstract);
106
+		}
107
+		if (isset($this->services[$abstract])) {
108
+			$abstract = $this->services[$abstract];
109
+		}
110
+		if (is_callable($abstract)) {
111
+			return call_user_func_array($abstract, [$this]);
112
+		}
113
+		if (is_object($abstract)) {
114
+			return $abstract;
115
+		}
116
+		return $this->resolve($abstract);
117
+	}
118
+
119
+	/**
120
+	 * @return void
121
+	 */
122
+	public function sessionClear()
123
+	{
124
+		$this->session = [];
125
+	}
126
+
127
+	/**
128
+	 * @return mixed
129
+	 */
130
+	public function sessionGet($key, $fallback = '')
131
+	{
132
+		$value = Arr::get($this->session, $key, $fallback);
133
+		unset($this->session[$key]);
134
+		return $value;
135
+	}
136
+
137
+	/**
138
+	 * @return void
139
+	 */
140
+	public function sessionSet($key, $value)
141
+	{
142
+		$this->session[$key] = $value;
143
+	}
144
+
145
+	/**
146
+	 * Bind a singleton instance to the container.
147
+	 * @param string $alias
148
+	 * @param callable|string|null $binding
149
+	 * @return void
150
+	 */
151
+	public function singleton($alias, $binding)
152
+	{
153
+		$this->bind($alias, $this->make($binding));
154
+	}
155
+
156
+	/**
157
+	 * Prefix the current namespace to the abstract if absent.
158
+	 * @param string $abstract
159
+	 * @return string
160
+	 */
161
+	protected function addNamespace($abstract)
162
+	{
163
+		if (!Str::contains($abstract, __NAMESPACE__) && !class_exists($abstract)) {
164
+			$abstract = __NAMESPACE__.'\\'.$abstract;
165
+		}
166
+		return $abstract;
167
+	}
168
+
169
+	/**
170
+	 * Resolve a service from the container.
171
+	 * @param mixed $concrete
172
+	 * @return mixed
173
+	 * @throws Exception
174
+	 */
175
+	protected function resolve($concrete)
176
+	{
177
+		if ($concrete instanceof Closure) {
178
+			return $concrete($this);
179
+		}
180
+		$reflector = new ReflectionClass($concrete);
181
+		if (!$reflector->isInstantiable()) {
182
+			throw new Exception('Target ['.$concrete.'] is not instantiable.');
183
+		}
184
+		$constructor = $reflector->getConstructor();
185
+		if (empty($constructor)) {
186
+			return new $concrete();
187
+		}
188
+		return $reflector->newInstanceArgs(
189
+			$this->resolveDependencies($constructor->getParameters())
190
+		);
191
+	}
192
+
193
+	/**
194
+	 * Resolve a class based dependency from the container.
195
+	 * @return mixed
196
+	 * @throws Exception
197
+	 */
198
+	protected function resolveClass(ReflectionParameter $parameter)
199
+	{
200
+		try {
201
+			return $this->make($parameter->getClass()->name);
202
+		} catch (Exception $error) {
203
+			if ($parameter->isOptional()) {
204
+				return $parameter->getDefaultValue();
205
+			}
206
+			throw $error;
207
+		}
208
+	}
209
+
210
+	/**
211
+	 * Resolve all of the dependencies from the ReflectionParameters.
212
+	 * @return array
213
+	 */
214
+	protected function resolveDependencies(array $dependencies)
215
+	{
216
+		$results = [];
217
+		foreach ($dependencies as $dependency) {
218
+			$results[] = !is_null($class = $dependency->getClass())
219
+				? $this->resolveClass($dependency)
220
+				: $this->resolveDependency($dependency);
221
+		}
222
+		return $results;
223
+	}
224
+
225
+	/**
226
+	 * Resolve a single ReflectionParameter dependency.
227
+	 * @return array|null
228
+	 */
229
+	protected function resolveDependency(ReflectionParameter $parameter)
230
+	{
231
+		if ($parameter->isArray() && $parameter->isDefaultValueAvailable()) {
232
+			return $parameter->getDefaultValue();
233
+		}
234
+		return null;
235
+	}
236 236
 }
Please login to merge, or discard this patch.
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
      */
46 46
     public static function load()
47 47
     {
48
-        if (empty(static::$instance)) {
48
+        if( empty(static::$instance) ) {
49 49
             static::$instance = new static();
50 50
         }
51 51
         return static::$instance;
@@ -55,16 +55,16 @@  discard block
 block discarded – undo
55 55
      * @param string $property
56 56
      * @return mixed
57 57
      */
58
-    public function __get($property)
58
+    public function __get( $property )
59 59
     {
60
-        if (property_exists($this, $property) && !in_array($property, static::PROTECTED_PROPERTIES)) {
60
+        if( property_exists( $this, $property ) && !in_array( $property, static::PROTECTED_PROPERTIES ) ) {
61 61
             return $this->$property;
62 62
         }
63
-        $constant = 'static::'.strtoupper(Str::snakeCase($property));
64
-        if (defined($constant)) {
65
-            return constant($constant);
63
+        $constant = 'static::'.strtoupper( Str::snakeCase( $property ) );
64
+        if( defined( $constant ) ) {
65
+            return constant( $constant );
66 66
         }
67
-        return Arr::get($this->storage, $property, null);
67
+        return Arr::get( $this->storage, $property, null );
68 68
     }
69 69
 
70 70
     /**
@@ -72,14 +72,14 @@  discard block
 block discarded – undo
72 72
      * @param string $value
73 73
      * @return void
74 74
      */
75
-    public function __set($property, $value)
75
+    public function __set( $property, $value )
76 76
     {
77
-        if (!property_exists($this, $property) || in_array($property, static::PROTECTED_PROPERTIES)) {
77
+        if( !property_exists( $this, $property ) || in_array( $property, static::PROTECTED_PROPERTIES ) ) {
78 78
             $this->storage[$property] = $value;
79
-        } elseif (!isset($this->$property)) {
79
+        } elseif( !isset($this->$property) ) {
80 80
             $this->$property = $value;
81 81
         } else {
82
-            throw new Exception(sprintf('The "%s" property cannot be changed once set.', $property));
82
+            throw new Exception( sprintf( 'The "%s" property cannot be changed once set.', $property ) );
83 83
         }
84 84
     }
85 85
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
      * @param mixed $concrete
90 90
      * @return mixed
91 91
      */
92
-    public function bind($alias, $concrete)
92
+    public function bind( $alias, $concrete )
93 93
     {
94 94
         $this->services[$alias] = $concrete;
95 95
     }
@@ -99,21 +99,21 @@  discard block
 block discarded – undo
99 99
      * @param mixed $abstract
100 100
      * @return mixed
101 101
      */
102
-    public function make($abstract)
102
+    public function make( $abstract )
103 103
     {
104
-        if (!isset($this->services[$abstract])) {
105
-            $abstract = $this->addNamespace($abstract);
104
+        if( !isset($this->services[$abstract]) ) {
105
+            $abstract = $this->addNamespace( $abstract );
106 106
         }
107
-        if (isset($this->services[$abstract])) {
107
+        if( isset($this->services[$abstract]) ) {
108 108
             $abstract = $this->services[$abstract];
109 109
         }
110
-        if (is_callable($abstract)) {
111
-            return call_user_func_array($abstract, [$this]);
110
+        if( is_callable( $abstract ) ) {
111
+            return call_user_func_array( $abstract, [$this] );
112 112
         }
113
-        if (is_object($abstract)) {
113
+        if( is_object( $abstract ) ) {
114 114
             return $abstract;
115 115
         }
116
-        return $this->resolve($abstract);
116
+        return $this->resolve( $abstract );
117 117
     }
118 118
 
119 119
     /**
@@ -127,9 +127,9 @@  discard block
 block discarded – undo
127 127
     /**
128 128
      * @return mixed
129 129
      */
130
-    public function sessionGet($key, $fallback = '')
130
+    public function sessionGet( $key, $fallback = '' )
131 131
     {
132
-        $value = Arr::get($this->session, $key, $fallback);
132
+        $value = Arr::get( $this->session, $key, $fallback );
133 133
         unset($this->session[$key]);
134 134
         return $value;
135 135
     }
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
     /**
138 138
      * @return void
139 139
      */
140
-    public function sessionSet($key, $value)
140
+    public function sessionSet( $key, $value )
141 141
     {
142 142
         $this->session[$key] = $value;
143 143
     }
@@ -148,9 +148,9 @@  discard block
 block discarded – undo
148 148
      * @param callable|string|null $binding
149 149
      * @return void
150 150
      */
151
-    public function singleton($alias, $binding)
151
+    public function singleton( $alias, $binding )
152 152
     {
153
-        $this->bind($alias, $this->make($binding));
153
+        $this->bind( $alias, $this->make( $binding ) );
154 154
     }
155 155
 
156 156
     /**
@@ -158,9 +158,9 @@  discard block
 block discarded – undo
158 158
      * @param string $abstract
159 159
      * @return string
160 160
      */
161
-    protected function addNamespace($abstract)
161
+    protected function addNamespace( $abstract )
162 162
     {
163
-        if (!Str::contains($abstract, __NAMESPACE__) && !class_exists($abstract)) {
163
+        if( !Str::contains( $abstract, __NAMESPACE__ ) && !class_exists( $abstract ) ) {
164 164
             $abstract = __NAMESPACE__.'\\'.$abstract;
165 165
         }
166 166
         return $abstract;
@@ -172,21 +172,21 @@  discard block
 block discarded – undo
172 172
      * @return mixed
173 173
      * @throws Exception
174 174
      */
175
-    protected function resolve($concrete)
175
+    protected function resolve( $concrete )
176 176
     {
177
-        if ($concrete instanceof Closure) {
178
-            return $concrete($this);
177
+        if( $concrete instanceof Closure ) {
178
+            return $concrete( $this );
179 179
         }
180
-        $reflector = new ReflectionClass($concrete);
181
-        if (!$reflector->isInstantiable()) {
182
-            throw new Exception('Target ['.$concrete.'] is not instantiable.');
180
+        $reflector = new ReflectionClass( $concrete );
181
+        if( !$reflector->isInstantiable() ) {
182
+            throw new Exception( 'Target ['.$concrete.'] is not instantiable.' );
183 183
         }
184 184
         $constructor = $reflector->getConstructor();
185
-        if (empty($constructor)) {
185
+        if( empty($constructor) ) {
186 186
             return new $concrete();
187 187
         }
188 188
         return $reflector->newInstanceArgs(
189
-            $this->resolveDependencies($constructor->getParameters())
189
+            $this->resolveDependencies( $constructor->getParameters() )
190 190
         );
191 191
     }
192 192
 
@@ -195,12 +195,12 @@  discard block
 block discarded – undo
195 195
      * @return mixed
196 196
      * @throws Exception
197 197
      */
198
-    protected function resolveClass(ReflectionParameter $parameter)
198
+    protected function resolveClass( ReflectionParameter $parameter )
199 199
     {
200 200
         try {
201
-            return $this->make($parameter->getClass()->name);
202
-        } catch (Exception $error) {
203
-            if ($parameter->isOptional()) {
201
+            return $this->make( $parameter->getClass()->name );
202
+        } catch( Exception $error ) {
203
+            if( $parameter->isOptional() ) {
204 204
                 return $parameter->getDefaultValue();
205 205
             }
206 206
             throw $error;
@@ -211,13 +211,13 @@  discard block
 block discarded – undo
211 211
      * Resolve all of the dependencies from the ReflectionParameters.
212 212
      * @return array
213 213
      */
214
-    protected function resolveDependencies(array $dependencies)
214
+    protected function resolveDependencies( array $dependencies )
215 215
     {
216 216
         $results = [];
217
-        foreach ($dependencies as $dependency) {
218
-            $results[] = !is_null($class = $dependency->getClass())
219
-                ? $this->resolveClass($dependency)
220
-                : $this->resolveDependency($dependency);
217
+        foreach( $dependencies as $dependency ) {
218
+            $results[] = !is_null( $class = $dependency->getClass() )
219
+                ? $this->resolveClass( $dependency )
220
+                : $this->resolveDependency( $dependency );
221 221
         }
222 222
         return $results;
223 223
     }
@@ -226,9 +226,9 @@  discard block
 block discarded – undo
226 226
      * Resolve a single ReflectionParameter dependency.
227 227
      * @return array|null
228 228
      */
229
-    protected function resolveDependency(ReflectionParameter $parameter)
229
+    protected function resolveDependency( ReflectionParameter $parameter )
230 230
     {
231
-        if ($parameter->isArray() && $parameter->isDefaultValueAvailable()) {
231
+        if( $parameter->isArray() && $parameter->isDefaultValueAvailable() ) {
232 232
             return $parameter->getDefaultValue();
233 233
         }
234 234
         return null;
Please login to merge, or discard this patch.
plugin/Handlers/RegisterTaxonomy.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -7,12 +7,12 @@
 block discarded – undo
7 7
 
8 8
 class RegisterTaxonomy
9 9
 {
10
-    /**
11
-     * @return void
12
-     */
13
-    public function handle(Command $command)
14
-    {
15
-        register_taxonomy(Application::TAXONOMY, Application::POST_TYPE, $command->args);
16
-        register_taxonomy_for_object_type(Application::TAXONOMY, Application::POST_TYPE);
17
-    }
10
+	/**
11
+	 * @return void
12
+	 */
13
+	public function handle(Command $command)
14
+	{
15
+		register_taxonomy(Application::TAXONOMY, Application::POST_TYPE, $command->args);
16
+		register_taxonomy_for_object_type(Application::TAXONOMY, Application::POST_TYPE);
17
+	}
18 18
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,9 +10,9 @@
 block discarded – undo
10 10
     /**
11 11
      * @return void
12 12
      */
13
-    public function handle(Command $command)
13
+    public function handle( Command $command )
14 14
     {
15
-        register_taxonomy(Application::TAXONOMY, Application::POST_TYPE, $command->args);
16
-        register_taxonomy_for_object_type(Application::TAXONOMY, Application::POST_TYPE);
15
+        register_taxonomy( Application::TAXONOMY, Application::POST_TYPE, $command->args );
16
+        register_taxonomy_for_object_type( Application::TAXONOMY, Application::POST_TYPE );
17 17
     }
18 18
 }
Please login to merge, or discard this patch.
plugin/Handlers/RegisterPostType.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -6,16 +6,16 @@
 block discarded – undo
6 6
 
7 7
 class RegisterPostType
8 8
 {
9
-    /**
10
-     * @return void
11
-     */
12
-    public function handle(Command $command)
13
-    {
14
-        if (!in_array($command->postType, get_post_types(['_builtin' => true]))) {
15
-            register_post_type($command->postType, $command->args);
16
-            glsr()->postTypeColumns = wp_parse_args(glsr()->postTypeColumns, [
17
-                $command->postType => $command->columns,
18
-            ]);
19
-        }
20
-    }
9
+	/**
10
+	 * @return void
11
+	 */
12
+	public function handle(Command $command)
13
+	{
14
+		if (!in_array($command->postType, get_post_types(['_builtin' => true]))) {
15
+			register_post_type($command->postType, $command->args);
16
+			glsr()->postTypeColumns = wp_parse_args(glsr()->postTypeColumns, [
17
+				$command->postType => $command->columns,
18
+			]);
19
+		}
20
+	}
21 21
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -9,13 +9,13 @@
 block discarded – undo
9 9
     /**
10 10
      * @return void
11 11
      */
12
-    public function handle(Command $command)
12
+    public function handle( Command $command )
13 13
     {
14
-        if (!in_array($command->postType, get_post_types(['_builtin' => true]))) {
15
-            register_post_type($command->postType, $command->args);
16
-            glsr()->postTypeColumns = wp_parse_args(glsr()->postTypeColumns, [
14
+        if( !in_array( $command->postType, get_post_types( ['_builtin' => true] ) ) ) {
15
+            register_post_type( $command->postType, $command->args );
16
+            glsr()->postTypeColumns = wp_parse_args( glsr()->postTypeColumns, [
17 17
                 $command->postType => $command->columns,
18
-            ]);
18
+            ] );
19 19
         }
20 20
     }
21 21
 }
Please login to merge, or discard this patch.
plugin/Shortcodes/Shortcode.php 3 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -148,7 +148,8 @@
 block discarded – undo
148 148
     {
149 149
         if ('parent_id' == $postId) {
150 150
             $postId = intval(wp_get_post_parent_id(intval(get_the_ID())));
151
-        } elseif ('post_id' == $postId) {
151
+        }
152
+        elseif ('post_id' == $postId) {
152 153
             $postId = intval(get_the_ID());
153 154
         }
154 155
         return $postId;
Please login to merge, or discard this patch.
Indentation   +223 added lines, -223 removed lines patch added patch discarded remove patch
@@ -11,227 +11,227 @@
 block discarded – undo
11 11
 
12 12
 abstract class Shortcode implements ShortcodeContract
13 13
 {
14
-    /**
15
-     * @var string
16
-     */
17
-    protected $partialName;
18
-
19
-    /**
20
-     * @var string
21
-     */
22
-    protected $shortcodeName;
23
-
24
-    public function __construct()
25
-    {
26
-        $this->partialName = $this->getShortcodePartialName();
27
-        $this->shortcodeName = $this->getShortcodeName();
28
-    }
29
-
30
-    /**
31
-     * @param string|array $atts
32
-     * @param string $type
33
-     * @return string
34
-     */
35
-    public function build($atts, array $args = [], $type = 'shortcode')
36
-    {
37
-        $args = $this->normalizeArgs($args, $type);
38
-        $atts = $this->normalizeAtts($atts, $type);
39
-        $partial = glsr(Partial::class)->build($this->partialName, $atts);
40
-        $title = !empty($atts['title'])
41
-            ? $args['before_title'].$atts['title'].$args['after_title']
42
-            : '';
43
-        $debug = sprintf('<glsr-%1$s hidden data-atts=\'%2$s\'></glsr-%1$s>', $type, $atts['json']);
44
-        return $args['before_widget'].$title.$partial.$debug.$args['after_widget'];
45
-    }
46
-
47
-    /**
48
-     * @param string|array $atts
49
-     * @return string
50
-     */
51
-    public function buildShortcode($atts = [])
52
-    {
53
-        return $this->build($atts);
54
-    }
55
-
56
-    /**
57
-     * @return array
58
-     */
59
-    public function getDefaults($atts)
60
-    {
61
-        return glsr($this->getShortcodeDefaultsClassName())->restrict(wp_parse_args($atts));
62
-    }
63
-
64
-    /**
65
-     * @return array
66
-     */
67
-    public function getHideOptions()
68
-    {
69
-        $options = $this->hideOptions();
70
-        return apply_filters('site-reviews/shortcode/hide-options', $options, $this->shortcodeName);
71
-    }
72
-
73
-    /**
74
-     * @return string
75
-     */
76
-    public function getShortcodeClassName($replace = '', $search = 'Shortcode')
77
-    {
78
-        return str_replace($search, $replace, (new ReflectionClass($this))->getShortName());
79
-    }
80
-
81
-    /**
82
-     * @return string
83
-     */
84
-    public function getShortcodeDefaultsClassName()
85
-    {
86
-        return Helper::buildClassName(
87
-            $this->getShortcodeClassName('Defaults'),
88
-            'Defaults'
89
-        );
90
-    }
91
-
92
-    /**
93
-     * @return string
94
-     */
95
-    public function getShortcodeName()
96
-    {
97
-        return Str::snakeCase($this->getShortcodeClassName());
98
-    }
99
-
100
-    /**
101
-     * @return string
102
-     */
103
-    public function getShortcodePartialName()
104
-    {
105
-        return Str::dashCase($this->getShortcodeClassName());
106
-    }
107
-
108
-    /**
109
-     * @param array|string $args
110
-     * @param string $type
111
-     * @return array
112
-     */
113
-    public function normalizeArgs($args, $type = 'shortcode')
114
-    {
115
-        $args = wp_parse_args($args, [
116
-            'before_widget' => '<div class="glsr-'.$type.' '.$type.'-'.$this->partialName.'">',
117
-            'after_widget' => '</div>',
118
-            'before_title' => '<h3 class="glsr-'.$type.'-title">',
119
-            'after_title' => '</h3>',
120
-        ]);
121
-        return apply_filters('site-reviews/shortcode/args', $args, $type, $this->partialName);
122
-    }
123
-
124
-    /**
125
-     * @param array|string $atts
126
-     * @param string $type
127
-     * @return array
128
-     */
129
-    public function normalizeAtts($atts, $type = 'shortcode')
130
-    {
131
-        $atts = apply_filters('site-reviews/shortcode/atts', $atts, $type, $this->partialName);
132
-        $atts = $this->getDefaults($atts);
133
-        array_walk($atts, function (&$value, $key) {
134
-            $methodName = Helper::buildMethodName($key, 'normalize');
135
-            if (!method_exists($this, $methodName)) {
136
-                return;
137
-            }
138
-            $value = $this->$methodName($value);
139
-        });
140
-        return $atts;
141
-    }
142
-
143
-    /**
144
-     * @return array
145
-     */
146
-    abstract protected function hideOptions();
147
-
148
-    /**
149
-     * @param string $postId
150
-     * @return int|string
151
-     */
152
-    protected function normalizeAssignedTo($postId)
153
-    {
154
-        if ('parent_id' == $postId) {
155
-            $postId = intval(wp_get_post_parent_id(intval(get_the_ID())));
156
-        } elseif ('post_id' == $postId) {
157
-            $postId = intval(get_the_ID());
158
-        }
159
-        return $postId;
160
-    }
161
-
162
-    /**
163
-     * @param string $postId
164
-     * @return int|string
165
-     */
166
-    protected function normalizeAssignTo($postId)
167
-    {
168
-        return $this->normalizeAssignedTo($postId);
169
-    }
170
-
171
-    /**
172
-     * @param string|array $hide
173
-     * @return array
174
-     */
175
-    protected function normalizeHide($hide)
176
-    {
177
-        if (is_string($hide)) {
178
-            $hide = explode(',', $hide);
179
-        }
180
-        $hideKeys = array_keys($this->getHideOptions());
181
-        return array_filter(array_map('trim', $hide), function ($value) use ($hideKeys) {
182
-            return in_array($value, $hideKeys);
183
-        });
184
-    }
185
-
186
-    /**
187
-     * @param string $id
188
-     * @return string
189
-     */
190
-    protected function normalizeId($id)
191
-    {
192
-        return sanitize_title($id);
193
-    }
194
-
195
-    /**
196
-     * @param string $labels
197
-     * @return array
198
-     */
199
-    protected function normalizeLabels($labels)
200
-    {
201
-        $defaults = [
202
-            __('Excellent', 'site-reviews'),
203
-            __('Very good', 'site-reviews'),
204
-            __('Average', 'site-reviews'),
205
-            __('Poor', 'site-reviews'),
206
-            __('Terrible', 'site-reviews'),
207
-        ];
208
-        $maxRating = (int) glsr()->constant('MAX_RATING', Rating::class);
209
-        $defaults = array_pad(array_slice($defaults, 0, $maxRating), $maxRating, '');
210
-        $labels = array_map('trim', explode(',', $labels));
211
-        foreach ($defaults as $i => $label) {
212
-            if (empty($labels[$i])) {
213
-                continue;
214
-            }
215
-            $defaults[$i] = $labels[$i];
216
-        }
217
-        return array_combine(range($maxRating, 1), $defaults);
218
-    }
219
-
220
-    /**
221
-     * @param string $schema
222
-     * @return bool
223
-     */
224
-    protected function normalizeSchema($schema)
225
-    {
226
-        return wp_validate_boolean($schema);
227
-    }
228
-
229
-    /**
230
-     * @param string $text
231
-     * @return string
232
-     */
233
-    protected function normalizeText($text)
234
-    {
235
-        return trim($text);
236
-    }
14
+	/**
15
+	 * @var string
16
+	 */
17
+	protected $partialName;
18
+
19
+	/**
20
+	 * @var string
21
+	 */
22
+	protected $shortcodeName;
23
+
24
+	public function __construct()
25
+	{
26
+		$this->partialName = $this->getShortcodePartialName();
27
+		$this->shortcodeName = $this->getShortcodeName();
28
+	}
29
+
30
+	/**
31
+	 * @param string|array $atts
32
+	 * @param string $type
33
+	 * @return string
34
+	 */
35
+	public function build($atts, array $args = [], $type = 'shortcode')
36
+	{
37
+		$args = $this->normalizeArgs($args, $type);
38
+		$atts = $this->normalizeAtts($atts, $type);
39
+		$partial = glsr(Partial::class)->build($this->partialName, $atts);
40
+		$title = !empty($atts['title'])
41
+			? $args['before_title'].$atts['title'].$args['after_title']
42
+			: '';
43
+		$debug = sprintf('<glsr-%1$s hidden data-atts=\'%2$s\'></glsr-%1$s>', $type, $atts['json']);
44
+		return $args['before_widget'].$title.$partial.$debug.$args['after_widget'];
45
+	}
46
+
47
+	/**
48
+	 * @param string|array $atts
49
+	 * @return string
50
+	 */
51
+	public function buildShortcode($atts = [])
52
+	{
53
+		return $this->build($atts);
54
+	}
55
+
56
+	/**
57
+	 * @return array
58
+	 */
59
+	public function getDefaults($atts)
60
+	{
61
+		return glsr($this->getShortcodeDefaultsClassName())->restrict(wp_parse_args($atts));
62
+	}
63
+
64
+	/**
65
+	 * @return array
66
+	 */
67
+	public function getHideOptions()
68
+	{
69
+		$options = $this->hideOptions();
70
+		return apply_filters('site-reviews/shortcode/hide-options', $options, $this->shortcodeName);
71
+	}
72
+
73
+	/**
74
+	 * @return string
75
+	 */
76
+	public function getShortcodeClassName($replace = '', $search = 'Shortcode')
77
+	{
78
+		return str_replace($search, $replace, (new ReflectionClass($this))->getShortName());
79
+	}
80
+
81
+	/**
82
+	 * @return string
83
+	 */
84
+	public function getShortcodeDefaultsClassName()
85
+	{
86
+		return Helper::buildClassName(
87
+			$this->getShortcodeClassName('Defaults'),
88
+			'Defaults'
89
+		);
90
+	}
91
+
92
+	/**
93
+	 * @return string
94
+	 */
95
+	public function getShortcodeName()
96
+	{
97
+		return Str::snakeCase($this->getShortcodeClassName());
98
+	}
99
+
100
+	/**
101
+	 * @return string
102
+	 */
103
+	public function getShortcodePartialName()
104
+	{
105
+		return Str::dashCase($this->getShortcodeClassName());
106
+	}
107
+
108
+	/**
109
+	 * @param array|string $args
110
+	 * @param string $type
111
+	 * @return array
112
+	 */
113
+	public function normalizeArgs($args, $type = 'shortcode')
114
+	{
115
+		$args = wp_parse_args($args, [
116
+			'before_widget' => '<div class="glsr-'.$type.' '.$type.'-'.$this->partialName.'">',
117
+			'after_widget' => '</div>',
118
+			'before_title' => '<h3 class="glsr-'.$type.'-title">',
119
+			'after_title' => '</h3>',
120
+		]);
121
+		return apply_filters('site-reviews/shortcode/args', $args, $type, $this->partialName);
122
+	}
123
+
124
+	/**
125
+	 * @param array|string $atts
126
+	 * @param string $type
127
+	 * @return array
128
+	 */
129
+	public function normalizeAtts($atts, $type = 'shortcode')
130
+	{
131
+		$atts = apply_filters('site-reviews/shortcode/atts', $atts, $type, $this->partialName);
132
+		$atts = $this->getDefaults($atts);
133
+		array_walk($atts, function (&$value, $key) {
134
+			$methodName = Helper::buildMethodName($key, 'normalize');
135
+			if (!method_exists($this, $methodName)) {
136
+				return;
137
+			}
138
+			$value = $this->$methodName($value);
139
+		});
140
+		return $atts;
141
+	}
142
+
143
+	/**
144
+	 * @return array
145
+	 */
146
+	abstract protected function hideOptions();
147
+
148
+	/**
149
+	 * @param string $postId
150
+	 * @return int|string
151
+	 */
152
+	protected function normalizeAssignedTo($postId)
153
+	{
154
+		if ('parent_id' == $postId) {
155
+			$postId = intval(wp_get_post_parent_id(intval(get_the_ID())));
156
+		} elseif ('post_id' == $postId) {
157
+			$postId = intval(get_the_ID());
158
+		}
159
+		return $postId;
160
+	}
161
+
162
+	/**
163
+	 * @param string $postId
164
+	 * @return int|string
165
+	 */
166
+	protected function normalizeAssignTo($postId)
167
+	{
168
+		return $this->normalizeAssignedTo($postId);
169
+	}
170
+
171
+	/**
172
+	 * @param string|array $hide
173
+	 * @return array
174
+	 */
175
+	protected function normalizeHide($hide)
176
+	{
177
+		if (is_string($hide)) {
178
+			$hide = explode(',', $hide);
179
+		}
180
+		$hideKeys = array_keys($this->getHideOptions());
181
+		return array_filter(array_map('trim', $hide), function ($value) use ($hideKeys) {
182
+			return in_array($value, $hideKeys);
183
+		});
184
+	}
185
+
186
+	/**
187
+	 * @param string $id
188
+	 * @return string
189
+	 */
190
+	protected function normalizeId($id)
191
+	{
192
+		return sanitize_title($id);
193
+	}
194
+
195
+	/**
196
+	 * @param string $labels
197
+	 * @return array
198
+	 */
199
+	protected function normalizeLabels($labels)
200
+	{
201
+		$defaults = [
202
+			__('Excellent', 'site-reviews'),
203
+			__('Very good', 'site-reviews'),
204
+			__('Average', 'site-reviews'),
205
+			__('Poor', 'site-reviews'),
206
+			__('Terrible', 'site-reviews'),
207
+		];
208
+		$maxRating = (int) glsr()->constant('MAX_RATING', Rating::class);
209
+		$defaults = array_pad(array_slice($defaults, 0, $maxRating), $maxRating, '');
210
+		$labels = array_map('trim', explode(',', $labels));
211
+		foreach ($defaults as $i => $label) {
212
+			if (empty($labels[$i])) {
213
+				continue;
214
+			}
215
+			$defaults[$i] = $labels[$i];
216
+		}
217
+		return array_combine(range($maxRating, 1), $defaults);
218
+	}
219
+
220
+	/**
221
+	 * @param string $schema
222
+	 * @return bool
223
+	 */
224
+	protected function normalizeSchema($schema)
225
+	{
226
+		return wp_validate_boolean($schema);
227
+	}
228
+
229
+	/**
230
+	 * @param string $text
231
+	 * @return string
232
+	 */
233
+	protected function normalizeText($text)
234
+	{
235
+		return trim($text);
236
+	}
237 237
 }
Please login to merge, or discard this patch.
Spacing   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -32,15 +32,15 @@  discard block
 block discarded – undo
32 32
      * @param string $type
33 33
      * @return string
34 34
      */
35
-    public function build($atts, array $args = [], $type = 'shortcode')
35
+    public function build( $atts, array $args = [], $type = 'shortcode' )
36 36
     {
37
-        $args = $this->normalizeArgs($args, $type);
38
-        $atts = $this->normalizeAtts($atts, $type);
39
-        $partial = glsr(Partial::class)->build($this->partialName, $atts);
37
+        $args = $this->normalizeArgs( $args, $type );
38
+        $atts = $this->normalizeAtts( $atts, $type );
39
+        $partial = glsr( Partial::class )->build( $this->partialName, $atts );
40 40
         $title = !empty($atts['title'])
41 41
             ? $args['before_title'].$atts['title'].$args['after_title']
42 42
             : '';
43
-        $debug = sprintf('<glsr-%1$s hidden data-atts=\'%2$s\'></glsr-%1$s>', $type, $atts['json']);
43
+        $debug = sprintf( '<glsr-%1$s hidden data-atts=\'%2$s\'></glsr-%1$s>', $type, $atts['json'] );
44 44
         return $args['before_widget'].$title.$partial.$debug.$args['after_widget'];
45 45
     }
46 46
 
@@ -48,17 +48,17 @@  discard block
 block discarded – undo
48 48
      * @param string|array $atts
49 49
      * @return string
50 50
      */
51
-    public function buildShortcode($atts = [])
51
+    public function buildShortcode( $atts = [] )
52 52
     {
53
-        return $this->build($atts);
53
+        return $this->build( $atts );
54 54
     }
55 55
 
56 56
     /**
57 57
      * @return array
58 58
      */
59
-    public function getDefaults($atts)
59
+    public function getDefaults( $atts )
60 60
     {
61
-        return glsr($this->getShortcodeDefaultsClassName())->restrict(wp_parse_args($atts));
61
+        return glsr( $this->getShortcodeDefaultsClassName() )->restrict( wp_parse_args( $atts ) );
62 62
     }
63 63
 
64 64
     /**
@@ -67,15 +67,15 @@  discard block
 block discarded – undo
67 67
     public function getHideOptions()
68 68
     {
69 69
         $options = $this->hideOptions();
70
-        return apply_filters('site-reviews/shortcode/hide-options', $options, $this->shortcodeName);
70
+        return apply_filters( 'site-reviews/shortcode/hide-options', $options, $this->shortcodeName );
71 71
     }
72 72
 
73 73
     /**
74 74
      * @return string
75 75
      */
76
-    public function getShortcodeClassName($replace = '', $search = 'Shortcode')
76
+    public function getShortcodeClassName( $replace = '', $search = 'Shortcode' )
77 77
     {
78
-        return str_replace($search, $replace, (new ReflectionClass($this))->getShortName());
78
+        return str_replace( $search, $replace, (new ReflectionClass( $this ))->getShortName() );
79 79
     }
80 80
 
81 81
     /**
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
     public function getShortcodeDefaultsClassName()
85 85
     {
86 86
         return Helper::buildClassName(
87
-            $this->getShortcodeClassName('Defaults'),
87
+            $this->getShortcodeClassName( 'Defaults' ),
88 88
             'Defaults'
89 89
         );
90 90
     }
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
      */
95 95
     public function getShortcodeName()
96 96
     {
97
-        return Str::snakeCase($this->getShortcodeClassName());
97
+        return Str::snakeCase( $this->getShortcodeClassName() );
98 98
     }
99 99
 
100 100
     /**
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
      */
103 103
     public function getShortcodePartialName()
104 104
     {
105
-        return Str::dashCase($this->getShortcodeClassName());
105
+        return Str::dashCase( $this->getShortcodeClassName() );
106 106
     }
107 107
 
108 108
     /**
@@ -110,15 +110,15 @@  discard block
 block discarded – undo
110 110
      * @param string $type
111 111
      * @return array
112 112
      */
113
-    public function normalizeArgs($args, $type = 'shortcode')
113
+    public function normalizeArgs( $args, $type = 'shortcode' )
114 114
     {
115
-        $args = wp_parse_args($args, [
115
+        $args = wp_parse_args( $args, [
116 116
             'before_widget' => '<div class="glsr-'.$type.' '.$type.'-'.$this->partialName.'">',
117 117
             'after_widget' => '</div>',
118 118
             'before_title' => '<h3 class="glsr-'.$type.'-title">',
119 119
             'after_title' => '</h3>',
120
-        ]);
121
-        return apply_filters('site-reviews/shortcode/args', $args, $type, $this->partialName);
120
+        ] );
121
+        return apply_filters( 'site-reviews/shortcode/args', $args, $type, $this->partialName );
122 122
     }
123 123
 
124 124
     /**
@@ -126,16 +126,16 @@  discard block
 block discarded – undo
126 126
      * @param string $type
127 127
      * @return array
128 128
      */
129
-    public function normalizeAtts($atts, $type = 'shortcode')
129
+    public function normalizeAtts( $atts, $type = 'shortcode' )
130 130
     {
131
-        $atts = apply_filters('site-reviews/shortcode/atts', $atts, $type, $this->partialName);
132
-        $atts = $this->getDefaults($atts);
133
-        array_walk($atts, function (&$value, $key) {
134
-            $methodName = Helper::buildMethodName($key, 'normalize');
135
-            if (!method_exists($this, $methodName)) {
131
+        $atts = apply_filters( 'site-reviews/shortcode/atts', $atts, $type, $this->partialName );
132
+        $atts = $this->getDefaults( $atts );
133
+        array_walk( $atts, function( &$value, $key ) {
134
+            $methodName = Helper::buildMethodName( $key, 'normalize' );
135
+            if( !method_exists( $this, $methodName ) ) {
136 136
                 return;
137 137
             }
138
-            $value = $this->$methodName($value);
138
+            $value = $this->$methodName( $value );
139 139
         });
140 140
         return $atts;
141 141
     }
@@ -149,12 +149,12 @@  discard block
 block discarded – undo
149 149
      * @param string $postId
150 150
      * @return int|string
151 151
      */
152
-    protected function normalizeAssignedTo($postId)
152
+    protected function normalizeAssignedTo( $postId )
153 153
     {
154
-        if ('parent_id' == $postId) {
155
-            $postId = intval(wp_get_post_parent_id(intval(get_the_ID())));
156
-        } elseif ('post_id' == $postId) {
157
-            $postId = intval(get_the_ID());
154
+        if( 'parent_id' == $postId ) {
155
+            $postId = intval( wp_get_post_parent_id( intval( get_the_ID() ) ) );
156
+        } elseif( 'post_id' == $postId ) {
157
+            $postId = intval( get_the_ID() );
158 158
         }
159 159
         return $postId;
160 160
     }
@@ -163,23 +163,23 @@  discard block
 block discarded – undo
163 163
      * @param string $postId
164 164
      * @return int|string
165 165
      */
166
-    protected function normalizeAssignTo($postId)
166
+    protected function normalizeAssignTo( $postId )
167 167
     {
168
-        return $this->normalizeAssignedTo($postId);
168
+        return $this->normalizeAssignedTo( $postId );
169 169
     }
170 170
 
171 171
     /**
172 172
      * @param string|array $hide
173 173
      * @return array
174 174
      */
175
-    protected function normalizeHide($hide)
175
+    protected function normalizeHide( $hide )
176 176
     {
177
-        if (is_string($hide)) {
178
-            $hide = explode(',', $hide);
177
+        if( is_string( $hide ) ) {
178
+            $hide = explode( ',', $hide );
179 179
         }
180
-        $hideKeys = array_keys($this->getHideOptions());
181
-        return array_filter(array_map('trim', $hide), function ($value) use ($hideKeys) {
182
-            return in_array($value, $hideKeys);
180
+        $hideKeys = array_keys( $this->getHideOptions() );
181
+        return array_filter( array_map( 'trim', $hide ), function( $value ) use ($hideKeys) {
182
+            return in_array( $value, $hideKeys );
183 183
         });
184 184
     }
185 185
 
@@ -187,51 +187,51 @@  discard block
 block discarded – undo
187 187
      * @param string $id
188 188
      * @return string
189 189
      */
190
-    protected function normalizeId($id)
190
+    protected function normalizeId( $id )
191 191
     {
192
-        return sanitize_title($id);
192
+        return sanitize_title( $id );
193 193
     }
194 194
 
195 195
     /**
196 196
      * @param string $labels
197 197
      * @return array
198 198
      */
199
-    protected function normalizeLabels($labels)
199
+    protected function normalizeLabels( $labels )
200 200
     {
201 201
         $defaults = [
202
-            __('Excellent', 'site-reviews'),
203
-            __('Very good', 'site-reviews'),
204
-            __('Average', 'site-reviews'),
205
-            __('Poor', 'site-reviews'),
206
-            __('Terrible', 'site-reviews'),
202
+            __( 'Excellent', 'site-reviews' ),
203
+            __( 'Very good', 'site-reviews' ),
204
+            __( 'Average', 'site-reviews' ),
205
+            __( 'Poor', 'site-reviews' ),
206
+            __( 'Terrible', 'site-reviews' ),
207 207
         ];
208
-        $maxRating = (int) glsr()->constant('MAX_RATING', Rating::class);
209
-        $defaults = array_pad(array_slice($defaults, 0, $maxRating), $maxRating, '');
210
-        $labels = array_map('trim', explode(',', $labels));
211
-        foreach ($defaults as $i => $label) {
212
-            if (empty($labels[$i])) {
208
+        $maxRating = (int)glsr()->constant( 'MAX_RATING', Rating::class );
209
+        $defaults = array_pad( array_slice( $defaults, 0, $maxRating ), $maxRating, '' );
210
+        $labels = array_map( 'trim', explode( ',', $labels ) );
211
+        foreach( $defaults as $i => $label ) {
212
+            if( empty($labels[$i]) ) {
213 213
                 continue;
214 214
             }
215 215
             $defaults[$i] = $labels[$i];
216 216
         }
217
-        return array_combine(range($maxRating, 1), $defaults);
217
+        return array_combine( range( $maxRating, 1 ), $defaults );
218 218
     }
219 219
 
220 220
     /**
221 221
      * @param string $schema
222 222
      * @return bool
223 223
      */
224
-    protected function normalizeSchema($schema)
224
+    protected function normalizeSchema( $schema )
225 225
     {
226
-        return wp_validate_boolean($schema);
226
+        return wp_validate_boolean( $schema );
227 227
     }
228 228
 
229 229
     /**
230 230
      * @param string $text
231 231
      * @return string
232 232
      */
233
-    protected function normalizeText($text)
233
+    protected function normalizeText( $text )
234 234
     {
235
-        return trim($text);
235
+        return trim( $text );
236 236
     }
237 237
 }
Please login to merge, or discard this patch.
plugin/Shortcodes/SiteReviewsFormPopup.php 2 patches
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -4,50 +4,50 @@
 block discarded – undo
4 4
 
5 5
 class SiteReviewsFormPopup extends TinymcePopupGenerator
6 6
 {
7
-    /**
8
-     * @return array
9
-     */
10
-    public function fields()
11
-    {
12
-        return [[
13
-            'type' => 'container',
14
-            'html' => '<p class="strong">'.esc_html__('All settings are optional.', 'site-reviews').'</p>',
15
-        ], [
16
-            'label' => esc_html__('Title', 'site-reviews'),
17
-            'name' => 'title',
18
-            'tooltip' => __('Enter a custom shortcode heading.', 'site-reviews'),
19
-            'type' => 'textbox',
20
-        ], [
21
-            'label' => esc_html__('Description', 'site-reviews'),
22
-            'minHeight' => 60,
23
-            'minWidth' => 240,
24
-            'multiline' => true,
25
-            'name' => 'description',
26
-            'tooltip' => __('Enter a custom shortcode description.', 'site-reviews'),
27
-            'type' => 'textbox',
28
-        ],
29
-        $this->getCategories(__('Automatically assign a category to reviews submitted with this shortcode.', 'site-reviews')),
30
-        [
31
-            'label' => esc_html__('Assign To', 'site-reviews'),
32
-            'name' => 'assign_to',
33
-            'tooltip' => __('Assign submitted reviews to a custom page/post ID. You can also enter "post_id" to assign reviews to the ID of the current page.', 'site-reviews'),
34
-            'type' => 'textbox',
35
-        ], [
36
-            'label' => esc_html__('Classes', 'site-reviews'),
37
-            'name' => 'class',
38
-            'tooltip' => __('Add custom CSS classes to the shortcode.', 'site-reviews'),
39
-            'type' => 'textbox',
40
-        ], [
41
-            'columns' => 2,
42
-            'items' => $this->getHideOptions(),
43
-            'label' => esc_html__('Hide', 'site-reviews'),
44
-            'layout' => 'grid',
45
-            'spacing' => 5,
46
-            'type' => 'container',
47
-        ], [
48
-            'hidden' => true,
49
-            'name' => 'id',
50
-            'type' => 'textbox',
51
-        ], ];
52
-    }
7
+	/**
8
+	 * @return array
9
+	 */
10
+	public function fields()
11
+	{
12
+		return [[
13
+			'type' => 'container',
14
+			'html' => '<p class="strong">'.esc_html__('All settings are optional.', 'site-reviews').'</p>',
15
+		], [
16
+			'label' => esc_html__('Title', 'site-reviews'),
17
+			'name' => 'title',
18
+			'tooltip' => __('Enter a custom shortcode heading.', 'site-reviews'),
19
+			'type' => 'textbox',
20
+		], [
21
+			'label' => esc_html__('Description', 'site-reviews'),
22
+			'minHeight' => 60,
23
+			'minWidth' => 240,
24
+			'multiline' => true,
25
+			'name' => 'description',
26
+			'tooltip' => __('Enter a custom shortcode description.', 'site-reviews'),
27
+			'type' => 'textbox',
28
+		],
29
+		$this->getCategories(__('Automatically assign a category to reviews submitted with this shortcode.', 'site-reviews')),
30
+		[
31
+			'label' => esc_html__('Assign To', 'site-reviews'),
32
+			'name' => 'assign_to',
33
+			'tooltip' => __('Assign submitted reviews to a custom page/post ID. You can also enter "post_id" to assign reviews to the ID of the current page.', 'site-reviews'),
34
+			'type' => 'textbox',
35
+		], [
36
+			'label' => esc_html__('Classes', 'site-reviews'),
37
+			'name' => 'class',
38
+			'tooltip' => __('Add custom CSS classes to the shortcode.', 'site-reviews'),
39
+			'type' => 'textbox',
40
+		], [
41
+			'columns' => 2,
42
+			'items' => $this->getHideOptions(),
43
+			'label' => esc_html__('Hide', 'site-reviews'),
44
+			'layout' => 'grid',
45
+			'spacing' => 5,
46
+			'type' => 'container',
47
+		], [
48
+			'hidden' => true,
49
+			'name' => 'id',
50
+			'type' => 'textbox',
51
+		], ];
52
+	}
53 53
 }
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -11,36 +11,36 @@
 block discarded – undo
11 11
     {
12 12
         return [[
13 13
             'type' => 'container',
14
-            'html' => '<p class="strong">'.esc_html__('All settings are optional.', 'site-reviews').'</p>',
14
+            'html' => '<p class="strong">'.esc_html__( 'All settings are optional.', 'site-reviews' ).'</p>',
15 15
         ], [
16
-            'label' => esc_html__('Title', 'site-reviews'),
16
+            'label' => esc_html__( 'Title', 'site-reviews' ),
17 17
             'name' => 'title',
18
-            'tooltip' => __('Enter a custom shortcode heading.', 'site-reviews'),
18
+            'tooltip' => __( 'Enter a custom shortcode heading.', 'site-reviews' ),
19 19
             'type' => 'textbox',
20 20
         ], [
21
-            'label' => esc_html__('Description', 'site-reviews'),
21
+            'label' => esc_html__( 'Description', 'site-reviews' ),
22 22
             'minHeight' => 60,
23 23
             'minWidth' => 240,
24 24
             'multiline' => true,
25 25
             'name' => 'description',
26
-            'tooltip' => __('Enter a custom shortcode description.', 'site-reviews'),
26
+            'tooltip' => __( 'Enter a custom shortcode description.', 'site-reviews' ),
27 27
             'type' => 'textbox',
28 28
         ],
29
-        $this->getCategories(__('Automatically assign a category to reviews submitted with this shortcode.', 'site-reviews')),
29
+        $this->getCategories( __( 'Automatically assign a category to reviews submitted with this shortcode.', 'site-reviews' ) ),
30 30
         [
31
-            'label' => esc_html__('Assign To', 'site-reviews'),
31
+            'label' => esc_html__( 'Assign To', 'site-reviews' ),
32 32
             'name' => 'assign_to',
33
-            'tooltip' => __('Assign submitted reviews to a custom page/post ID. You can also enter "post_id" to assign reviews to the ID of the current page.', 'site-reviews'),
33
+            'tooltip' => __( 'Assign submitted reviews to a custom page/post ID. You can also enter "post_id" to assign reviews to the ID of the current page.', 'site-reviews' ),
34 34
             'type' => 'textbox',
35 35
         ], [
36
-            'label' => esc_html__('Classes', 'site-reviews'),
36
+            'label' => esc_html__( 'Classes', 'site-reviews' ),
37 37
             'name' => 'class',
38
-            'tooltip' => __('Add custom CSS classes to the shortcode.', 'site-reviews'),
38
+            'tooltip' => __( 'Add custom CSS classes to the shortcode.', 'site-reviews' ),
39 39
             'type' => 'textbox',
40 40
         ], [
41 41
             'columns' => 2,
42 42
             'items' => $this->getHideOptions(),
43
-            'label' => esc_html__('Hide', 'site-reviews'),
43
+            'label' => esc_html__( 'Hide', 'site-reviews' ),
44 44
             'layout' => 'grid',
45 45
             'spacing' => 5,
46 46
             'type' => 'container',
Please login to merge, or discard this patch.
plugin/Shortcodes/SiteReviewsSummaryPopup.php 2 patches
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -4,49 +4,49 @@
 block discarded – undo
4 4
 
5 5
 class SiteReviewsSummaryPopup extends SiteReviewsPopup
6 6
 {
7
-    /**
8
-     * @return array
9
-     */
10
-    public function fields()
11
-    {
12
-        return [[
13
-            'html' => sprintf('<p class="strong">%s</p>', esc_html__('All settings are optional.', 'site-reviews')),
14
-            'minWidth' => 320,
15
-            'type' => 'container',
16
-        ], [
17
-            'label' => esc_html__('Title', 'site-reviews'),
18
-            'name' => 'title',
19
-            'tooltip' => __('Enter a custom shortcode heading.', 'site-reviews'),
20
-            'type' => 'textbox',
21
-        ],
22
-        $this->getTypes(__('Which type of review would you like to use?', 'site-reviews')),
23
-        $this->getCategories(__('Limit reviews to this category.', 'site-reviews')),
24
-        [
25
-            'label' => esc_html__('Assigned To', 'site-reviews'),
26
-            'name' => 'assigned_to',
27
-            'tooltip' => __('Limit reviews to those assigned to this post ID (separate multiple IDs with a comma). You can also enter "post_id" to use the ID of the current page, or "parent_id" to use the ID of the parent page.', 'site-reviews'),
28
-            'type' => 'textbox',
29
-        ], [
30
-            'label' => esc_html__('Schema', 'site-reviews'),
31
-            'name' => 'schema',
32
-            'options' => [
33
-                'true' => esc_html__('Enable rich snippets', 'site-reviews'),
34
-                'false' => esc_html__('Disable rich snippets', 'site-reviews'),
35
-            ],
36
-            'tooltip' => __('Rich snippets are disabled by default.', 'site-reviews'),
37
-            'type' => 'listbox',
38
-        ], [
39
-            'label' => esc_html__('Classes', 'site-reviews'),
40
-            'name' => 'class',
41
-            'tooltip' => __('Add custom CSS classes to the shortcode.', 'site-reviews'),
42
-            'type' => 'textbox',
43
-        ], [
44
-            'columns' => 2,
45
-            'items' => $this->getHideOptions(),
46
-            'label' => esc_html__('Hide', 'site-reviews'),
47
-            'layout' => 'grid',
48
-            'spacing' => 5,
49
-            'type' => 'container',
50
-        ], ];
51
-    }
7
+	/**
8
+	 * @return array
9
+	 */
10
+	public function fields()
11
+	{
12
+		return [[
13
+			'html' => sprintf('<p class="strong">%s</p>', esc_html__('All settings are optional.', 'site-reviews')),
14
+			'minWidth' => 320,
15
+			'type' => 'container',
16
+		], [
17
+			'label' => esc_html__('Title', 'site-reviews'),
18
+			'name' => 'title',
19
+			'tooltip' => __('Enter a custom shortcode heading.', 'site-reviews'),
20
+			'type' => 'textbox',
21
+		],
22
+		$this->getTypes(__('Which type of review would you like to use?', 'site-reviews')),
23
+		$this->getCategories(__('Limit reviews to this category.', 'site-reviews')),
24
+		[
25
+			'label' => esc_html__('Assigned To', 'site-reviews'),
26
+			'name' => 'assigned_to',
27
+			'tooltip' => __('Limit reviews to those assigned to this post ID (separate multiple IDs with a comma). You can also enter "post_id" to use the ID of the current page, or "parent_id" to use the ID of the parent page.', 'site-reviews'),
28
+			'type' => 'textbox',
29
+		], [
30
+			'label' => esc_html__('Schema', 'site-reviews'),
31
+			'name' => 'schema',
32
+			'options' => [
33
+				'true' => esc_html__('Enable rich snippets', 'site-reviews'),
34
+				'false' => esc_html__('Disable rich snippets', 'site-reviews'),
35
+			],
36
+			'tooltip' => __('Rich snippets are disabled by default.', 'site-reviews'),
37
+			'type' => 'listbox',
38
+		], [
39
+			'label' => esc_html__('Classes', 'site-reviews'),
40
+			'name' => 'class',
41
+			'tooltip' => __('Add custom CSS classes to the shortcode.', 'site-reviews'),
42
+			'type' => 'textbox',
43
+		], [
44
+			'columns' => 2,
45
+			'items' => $this->getHideOptions(),
46
+			'label' => esc_html__('Hide', 'site-reviews'),
47
+			'layout' => 'grid',
48
+			'spacing' => 5,
49
+			'type' => 'container',
50
+		], ];
51
+	}
52 52
 }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -10,40 +10,40 @@
 block discarded – undo
10 10
     public function fields()
11 11
     {
12 12
         return [[
13
-            'html' => sprintf('<p class="strong">%s</p>', esc_html__('All settings are optional.', 'site-reviews')),
13
+            'html' => sprintf( '<p class="strong">%s</p>', esc_html__( 'All settings are optional.', 'site-reviews' ) ),
14 14
             'minWidth' => 320,
15 15
             'type' => 'container',
16 16
         ], [
17
-            'label' => esc_html__('Title', 'site-reviews'),
17
+            'label' => esc_html__( 'Title', 'site-reviews' ),
18 18
             'name' => 'title',
19
-            'tooltip' => __('Enter a custom shortcode heading.', 'site-reviews'),
19
+            'tooltip' => __( 'Enter a custom shortcode heading.', 'site-reviews' ),
20 20
             'type' => 'textbox',
21 21
         ],
22
-        $this->getTypes(__('Which type of review would you like to use?', 'site-reviews')),
23
-        $this->getCategories(__('Limit reviews to this category.', 'site-reviews')),
22
+        $this->getTypes( __( 'Which type of review would you like to use?', 'site-reviews' ) ),
23
+        $this->getCategories( __( 'Limit reviews to this category.', 'site-reviews' ) ),
24 24
         [
25
-            'label' => esc_html__('Assigned To', 'site-reviews'),
25
+            'label' => esc_html__( 'Assigned To', 'site-reviews' ),
26 26
             'name' => 'assigned_to',
27
-            'tooltip' => __('Limit reviews to those assigned to this post ID (separate multiple IDs with a comma). You can also enter "post_id" to use the ID of the current page, or "parent_id" to use the ID of the parent page.', 'site-reviews'),
27
+            'tooltip' => __( 'Limit reviews to those assigned to this post ID (separate multiple IDs with a comma). You can also enter "post_id" to use the ID of the current page, or "parent_id" to use the ID of the parent page.', 'site-reviews' ),
28 28
             'type' => 'textbox',
29 29
         ], [
30
-            'label' => esc_html__('Schema', 'site-reviews'),
30
+            'label' => esc_html__( 'Schema', 'site-reviews' ),
31 31
             'name' => 'schema',
32 32
             'options' => [
33
-                'true' => esc_html__('Enable rich snippets', 'site-reviews'),
34
-                'false' => esc_html__('Disable rich snippets', 'site-reviews'),
33
+                'true' => esc_html__( 'Enable rich snippets', 'site-reviews' ),
34
+                'false' => esc_html__( 'Disable rich snippets', 'site-reviews' ),
35 35
             ],
36
-            'tooltip' => __('Rich snippets are disabled by default.', 'site-reviews'),
36
+            'tooltip' => __( 'Rich snippets are disabled by default.', 'site-reviews' ),
37 37
             'type' => 'listbox',
38 38
         ], [
39
-            'label' => esc_html__('Classes', 'site-reviews'),
39
+            'label' => esc_html__( 'Classes', 'site-reviews' ),
40 40
             'name' => 'class',
41
-            'tooltip' => __('Add custom CSS classes to the shortcode.', 'site-reviews'),
41
+            'tooltip' => __( 'Add custom CSS classes to the shortcode.', 'site-reviews' ),
42 42
             'type' => 'textbox',
43 43
         ], [
44 44
             'columns' => 2,
45 45
             'items' => $this->getHideOptions(),
46
-            'label' => esc_html__('Hide', 'site-reviews'),
46
+            'label' => esc_html__( 'Hide', 'site-reviews' ),
47 47
             'layout' => 'grid',
48 48
             'spacing' => 5,
49 49
             'type' => 'container',
Please login to merge, or discard this patch.
plugin/Shortcodes/SiteReviewsShortcode.php 2 patches
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -4,17 +4,17 @@
 block discarded – undo
4 4
 
5 5
 class SiteReviewsShortcode extends Shortcode
6 6
 {
7
-    protected function hideOptions()
8
-    {
9
-        return [
10
-            'title' => __('Hide the title', 'site-reviews'),
11
-            'rating' => __('Hide the rating', 'site-reviews'),
12
-            'date' => __('Hide the date', 'site-reviews'),
13
-            'assigned_to' => __('Hide the assigned to link (if shown)', 'site-reviews'),
14
-            'content' => __('Hide the content', 'site-reviews'),
15
-            'avatar' => __('Hide the avatar (if shown)', 'site-reviews'),
16
-            'author' => __('Hide the author', 'site-reviews'),
17
-            'response' => __('Hide the response', 'site-reviews'),
18
-        ];
19
-    }
7
+	protected function hideOptions()
8
+	{
9
+		return [
10
+			'title' => __('Hide the title', 'site-reviews'),
11
+			'rating' => __('Hide the rating', 'site-reviews'),
12
+			'date' => __('Hide the date', 'site-reviews'),
13
+			'assigned_to' => __('Hide the assigned to link (if shown)', 'site-reviews'),
14
+			'content' => __('Hide the content', 'site-reviews'),
15
+			'avatar' => __('Hide the avatar (if shown)', 'site-reviews'),
16
+			'author' => __('Hide the author', 'site-reviews'),
17
+			'response' => __('Hide the response', 'site-reviews'),
18
+		];
19
+	}
20 20
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -7,14 +7,14 @@
 block discarded – undo
7 7
     protected function hideOptions()
8 8
     {
9 9
         return [
10
-            'title' => __('Hide the title', 'site-reviews'),
11
-            'rating' => __('Hide the rating', 'site-reviews'),
12
-            'date' => __('Hide the date', 'site-reviews'),
13
-            'assigned_to' => __('Hide the assigned to link (if shown)', 'site-reviews'),
14
-            'content' => __('Hide the content', 'site-reviews'),
15
-            'avatar' => __('Hide the avatar (if shown)', 'site-reviews'),
16
-            'author' => __('Hide the author', 'site-reviews'),
17
-            'response' => __('Hide the response', 'site-reviews'),
10
+            'title' => __( 'Hide the title', 'site-reviews' ),
11
+            'rating' => __( 'Hide the rating', 'site-reviews' ),
12
+            'date' => __( 'Hide the date', 'site-reviews' ),
13
+            'assigned_to' => __( 'Hide the assigned to link (if shown)', 'site-reviews' ),
14
+            'content' => __( 'Hide the content', 'site-reviews' ),
15
+            'avatar' => __( 'Hide the avatar (if shown)', 'site-reviews' ),
16
+            'author' => __( 'Hide the author', 'site-reviews' ),
17
+            'response' => __( 'Hide the response', 'site-reviews' ),
18 18
         ];
19 19
     }
20 20
 }
Please login to merge, or discard this patch.
plugin/Shortcodes/SiteReviewsSummaryShortcode.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -4,14 +4,14 @@
 block discarded – undo
4 4
 
5 5
 class SiteReviewsSummaryShortcode extends Shortcode
6 6
 {
7
-    protected function hideOptions()
8
-    {
9
-        return [
10
-            'rating' => __('Hide the rating', 'site-reviews'),
11
-            'stars' => __('Hide the stars', 'site-reviews'),
12
-            'summary' => __('Hide the summary', 'site-reviews'),
13
-            'bars' => __('Hide the percentage bars', 'site-reviews'),
14
-            'if_empty' => __('Hide if no reviews are found', 'site-reviews'),
15
-        ];
16
-    }
7
+	protected function hideOptions()
8
+	{
9
+		return [
10
+			'rating' => __('Hide the rating', 'site-reviews'),
11
+			'stars' => __('Hide the stars', 'site-reviews'),
12
+			'summary' => __('Hide the summary', 'site-reviews'),
13
+			'bars' => __('Hide the percentage bars', 'site-reviews'),
14
+			'if_empty' => __('Hide if no reviews are found', 'site-reviews'),
15
+		];
16
+	}
17 17
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,11 +7,11 @@
 block discarded – undo
7 7
     protected function hideOptions()
8 8
     {
9 9
         return [
10
-            'rating' => __('Hide the rating', 'site-reviews'),
11
-            'stars' => __('Hide the stars', 'site-reviews'),
12
-            'summary' => __('Hide the summary', 'site-reviews'),
13
-            'bars' => __('Hide the percentage bars', 'site-reviews'),
14
-            'if_empty' => __('Hide if no reviews are found', 'site-reviews'),
10
+            'rating' => __( 'Hide the rating', 'site-reviews' ),
11
+            'stars' => __( 'Hide the stars', 'site-reviews' ),
12
+            'summary' => __( 'Hide the summary', 'site-reviews' ),
13
+            'bars' => __( 'Hide the percentage bars', 'site-reviews' ),
14
+            'if_empty' => __( 'Hide if no reviews are found', 'site-reviews' ),
15 15
         ];
16 16
     }
17 17
 }
Please login to merge, or discard this patch.