Completed
Push — develop ( 286694...b23320 )
by Paul
03:10
created
src/Facades/ArchiveMeta.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -6,13 +6,13 @@
 block discarded – undo
6 6
 
7 7
 class ArchiveMeta extends Facade
8 8
 {
9
-    /**
10
-     * Get the fully qualified class name of the component.
11
-     *
12
-     * @return string
13
-     */
14
-    protected static function getFacadeAccessor()
15
-    {
16
-        return \GeminiLabs\Castor\Helpers\ArchiveMeta::class;
17
-    }
9
+	/**
10
+	 * Get the fully qualified class name of the component.
11
+	 *
12
+	 * @return string
13
+	 */
14
+	protected static function getFacadeAccessor()
15
+	{
16
+		return \GeminiLabs\Castor\Helpers\ArchiveMeta::class;
17
+	}
18 18
 }
Please login to merge, or discard this patch.
src/Helpers/ArchiveMeta.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 
20 20
 	public function __construct()
21 21
 	{
22
-		$this->options = get_option( apply_filters( 'pollux/archives/id', 'pollux_archives' ), [] );
22
+		$this->options = get_option(apply_filters('pollux/archives/id', 'pollux_archives'), []);
23 23
 	}
24 24
 
25 25
 	/**
@@ -28,9 +28,9 @@  discard block
 block discarded – undo
28 28
 	 * @param string $group
29 29
 	 * @return mixed
30 30
 	 */
31
-	public function get( $key = '', $fallback = null, $group = '' )
31
+	public function get($key = '', $fallback = null, $group = '')
32 32
 	{
33
-		return parent::get( $group, $key, $fallback );
33
+		return parent::get($group, $key, $fallback);
34 34
 	}
35 35
 
36 36
 	/**
Please login to merge, or discard this patch.
src/Helpers/PostMeta.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -14,18 +14,18 @@  discard block
 block discarded – undo
14 14
 	 * @param string $metaKey
15 15
 	 * @return mixed
16 16
 	 */
17
-	public function get( $metaKey, array $args = [] )
17
+	public function get($metaKey, array $args = [])
18 18
 	{
19
-		if( empty( $metaKey ))return;
19
+		if (empty($metaKey))return;
20 20
 
21
-		$args = $this->normalize( $args );
22
-		$metaKey = $this->buildMetaKey( $metaKey, $args['prefix'] );
23
-		$metaValue = get_post_meta( $args['id'], $metaKey, $args['single'] );
21
+		$args = $this->normalize($args);
22
+		$metaKey = $this->buildMetaKey($metaKey, $args['prefix']);
23
+		$metaValue = get_post_meta($args['id'], $metaKey, $args['single']);
24 24
 
25
-		if( is_string( $metaValue )) {
26
-			$metaValue = trim( $metaValue );
25
+		if (is_string($metaValue)) {
26
+			$metaValue = trim($metaValue);
27 27
 		}
28
-		return empty( $metaValue )
28
+		return empty($metaValue)
29 29
 			? $args['fallback']
30 30
 			: $metaValue;
31 31
 	}
@@ -35,24 +35,24 @@  discard block
 block discarded – undo
35 35
 	 * @param string $prefix
36 36
 	 * @return string
37 37
 	 */
38
-	protected function buildMetaKey( $metaKey, $prefix )
38
+	protected function buildMetaKey($metaKey, $prefix)
39 39
 	{
40
-		return ( substr( $metaKey, 0, 1 ) == '_' && !empty( $prefix ))
41
-			? sprintf( '_%s%s', rtrim( $prefix, '_' ), $metaKey )
40
+		return (substr($metaKey, 0, 1) == '_' && !empty($prefix))
41
+			? sprintf('_%s%s', rtrim($prefix, '_'), $metaKey)
42 42
 			: $prefix . $metaKey;
43 43
 	}
44 44
 
45 45
 	/**
46 46
 	 * @return array
47 47
 	 */
48
-	protected function normalize( array $args )
48
+	protected function normalize(array $args)
49 49
 	{
50 50
 		$defaults = [
51 51
 			'id'       => get_the_ID(),
52 52
 			'fallback' => '',
53 53
 			'single'   => true,
54
-			'prefix'   => apply_filters( 'pollux/prefix', 'pollux_' ),
54
+			'prefix'   => apply_filters('pollux/prefix', 'pollux_'),
55 55
 		];
56
-		return shortcode_atts( $defaults, array_change_key_case( $args ));
56
+		return shortcode_atts($defaults, array_change_key_case($args));
57 57
 	}
58 58
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,9 @@
 block discarded – undo
16 16
 	 */
17 17
 	public function get( $metaKey, array $args = [] )
18 18
 	{
19
-		if( empty( $metaKey ))return;
19
+		if( empty( $metaKey )) {
20
+			return;
21
+		}
20 22
 
21 23
 		$args = $this->normalize( $args );
22 24
 		$metaKey = $this->buildMetaKey( $metaKey, $args['prefix'] );
Please login to merge, or discard this patch.
src/Helpers/Media.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	protected $image;
22 22
 	protected $video;
23 23
 
24
-	public function __construct( Gallery $gallery, Image $image, Video $video )
24
+	public function __construct(Gallery $gallery, Image $image, Video $video)
25 25
 	{
26 26
 		$this->gallery = $gallery;
27 27
 		$this->image   = $image;
@@ -33,17 +33,17 @@  discard block
 block discarded – undo
33 33
 	 * @return string|void
34 34
 	 * @throws BadMethodCallException
35 35
 	 */
36
-	public function __call( $name, array $args )
36
+	public function __call($name, array $args)
37 37
 	{
38
-		$mediaType = $this->validateMethod( $name );
39
-		$args = $this->validateArgs( $args, $mediaType );
38
+		$mediaType = $this->validateMethod($name);
39
+		$args = $this->validateArgs($args, $mediaType);
40 40
 
41
-		if( str_replace( $mediaType, '', strtolower( $name ))) {
42
-			return $this->$mediaType->get( $args[0] )->$mediaType;
41
+		if (str_replace($mediaType, '', strtolower($name))) {
42
+			return $this->$mediaType->get($args[0])->$mediaType;
43 43
 		}
44
-		return !empty( $args[1] )
45
-			? $this->$mediaType->get( $args[0] )->render( $args[1] )
46
-			: $this->$mediaType->get( $args[0] )->render();
44
+		return !empty($args[1])
45
+			? $this->$mediaType->get($args[0])->render($args[1])
46
+			: $this->$mediaType->get($args[0])->render();
47 47
 	}
48 48
 
49 49
 	/**
@@ -52,10 +52,10 @@  discard block
 block discarded – undo
52 52
 	 * @return mixed
53 53
 	 * @throws BadMethodCallException
54 54
 	 */
55
-	public function get( $name, $args = [] )
55
+	public function get($name, $args = [])
56 56
 	{
57
-		$mediaType = $this->validateMethod( $name );
58
-		return $this->$mediaType->get( $args )->$mediaType;
57
+		$mediaType = $this->validateMethod($name);
58
+		return $this->$mediaType->get($args)->$mediaType;
59 59
 	}
60 60
 
61 61
 	/**
@@ -63,15 +63,15 @@  discard block
 block discarded – undo
63 63
 	 * @return array
64 64
 	 * @throws BadMethodCallException
65 65
 	 */
66
-	protected function validateArgs( array $args, $name )
66
+	protected function validateArgs(array $args, $name)
67 67
 	{
68
-		if( !count( $args ) && $name == 'image' ) {
68
+		if (!count($args) && $name == 'image') {
69 69
 			$args[] = get_post_thumbnail_id();
70 70
 		}
71
-		if( count( $args )) {
71
+		if (count($args)) {
72 72
 			return $args;
73 73
 		}
74
-		throw new BadMethodCallException( sprintf( 'Missing arguments for: %s', $name ));
74
+		throw new BadMethodCallException(sprintf('Missing arguments for: %s', $name));
75 75
 	}
76 76
 
77 77
 	/**
@@ -79,13 +79,13 @@  discard block
 block discarded – undo
79 79
 	 * @return string|false
80 80
 	 * @throws BadMethodCallException
81 81
 	 */
82
-	protected function validateMethod( $name )
82
+	protected function validateMethod($name)
83 83
 	{
84
-		foreach( [$name, strtolower( substr( $name, 3 ))] as $method ) {
85
-			if( property_exists( $this, $method ) && is_object( $this->$method )) {
84
+		foreach ([$name, strtolower(substr($name, 3))] as $method) {
85
+			if (property_exists($this, $method) && is_object($this->$method)) {
86 86
 				return $method;
87 87
 			}
88 88
 		}
89
-		throw new BadMethodCallException( sprintf( 'Not a valid method: %s', $name ));
89
+		throw new BadMethodCallException(sprintf('Not a valid method: %s', $name));
90 90
 	}
91 91
 }
Please login to merge, or discard this patch.
src/Gallery.php 2 patches
Spacing   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 	protected $theme;
20 20
 	protected $utility;
21 21
 
22
-	public function __construct( Image $image, PostMeta $postmeta, Theme $theme, Utility $utility )
22
+	public function __construct(Image $image, PostMeta $postmeta, Theme $theme, Utility $utility)
23 23
 	{
24 24
 		$this->image    = $image;
25 25
 		$this->postmeta = $postmeta;
@@ -30,9 +30,9 @@  discard block
 block discarded – undo
30 30
 	/**
31 31
 	 * @return WP_Query
32 32
 	 */
33
-	public function get( array $args = [] )
33
+	public function get(array $args = [])
34 34
 	{
35
-		$this->normalizeArgs( $args );
35
+		$this->normalizeArgs($args);
36 36
 
37 37
 		$this->gallery = new WP_Query([
38 38
 			'orderby'        => 'post__in',
@@ -52,11 +52,11 @@  discard block
 block discarded – undo
52 52
 	 */
53 53
 	public function render()
54 54
 	{
55
-		if( empty( $this->args['media'] ))return;
56
-		$images = array_reduce( $this->gallery->posts, function( $images, $attachment ) {
57
-			return $images . $this->renderImage( $attachment );
55
+		if (empty($this->args['media']))return;
56
+		$images = array_reduce($this->gallery->posts, function($images, $attachment) {
57
+			return $images . $this->renderImage($attachment);
58 58
 		});
59
-		return sprintf( '<div class="gallery-images" itemscope itemtype="http://schema.org/ImageGallery">%s</div>%s',
59
+		return sprintf('<div class="gallery-images" itemscope itemtype="http://schema.org/ImageGallery">%s</div>%s',
60 60
 			$images,
61 61
 			$this->renderPagination()
62 62
 		);
@@ -65,20 +65,20 @@  discard block
 block discarded – undo
65 65
 	/**
66 66
 	 * @return null|string
67 67
 	 */
68
-	public function renderImage( WP_Post $attachment )
68
+	public function renderImage(WP_Post $attachment)
69 69
 	{
70
-		$image = $this->image->get( $attachment->ID )->image;
70
+		$image = $this->image->get($attachment->ID)->image;
71 71
 
72
-		if( !$image )return;
72
+		if (!$image)return;
73 73
 		return sprintf(
74 74
 			'<figure class="gallery-image" data-w="%s" data-h="%s" data-ps=\'%s\' itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject">' .
75 75
 				'%s%s' .
76 76
 			'</figure>',
77 77
 			$image->thumbnail['width'],
78 78
 			$image->thumbnail['height'],
79
-			$this->getPhotoswipeData( $image ),
80
-			$this->renderImageTag( $image ),
81
-			$this->renderImageCaption( $image )
79
+			$this->getPhotoswipeData($image),
80
+			$this->renderImageTag($image),
81
+			$this->renderImageCaption($image)
82 82
 		);
83 83
 	}
84 84
 
@@ -87,13 +87,13 @@  discard block
 block discarded – undo
87 87
 	 */
88 88
 	public function renderPagination()
89 89
 	{
90
-		if( !$this->args['pagination'] )return;
90
+		if (!$this->args['pagination'])return;
91 91
 		return paginate_links([
92
-			'before_page_number' => '<span class="screen-reader-text">' . __( 'Page', 'castor' ) . ' </span>',
92
+			'before_page_number' => '<span class="screen-reader-text">' . __('Page', 'castor') . ' </span>',
93 93
 			'current'            => $this->gallery->query['paged'],
94 94
 			'mid_size'           => 1,
95
-			'next_text'          => __( 'Next', 'castor' ),
96
-			'prev_text'          => __( 'Previous', 'castor' ),
95
+			'next_text'          => __('Next', 'castor'),
96
+			'prev_text'          => __('Previous', 'castor'),
97 97
 			'total'              => $this->gallery->max_num_pages,
98 98
 		]);
99 99
 	}
@@ -104,14 +104,14 @@  discard block
 block discarded – undo
104 104
 	 *
105 105
 	 * @return bool
106 106
 	 */
107
-	protected function getBoolValue( $key, $value = null )
107
+	protected function getBoolValue($key, $value = null)
108 108
 	{
109
-		$bool = $this->getValue( $key, $value );
109
+		$bool = $this->getValue($key, $value);
110 110
 
111
-		if( is_null( filter_var( $bool, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE ))) {
112
-			$bool = $this->postmeta->get( $bool );
111
+		if (is_null(filter_var($bool, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE))) {
112
+			$bool = $this->postmeta->get($bool);
113 113
 		}
114
-		return wp_validate_boolean( $bool );
114
+		return wp_validate_boolean($bool);
115 115
 	}
116 116
 
117 117
 	/**
@@ -119,15 +119,15 @@  discard block
 block discarded – undo
119 119
 	 *
120 120
 	 * @return int
121 121
 	 */
122
-	protected function getGalleryArg( $value = null )
122
+	protected function getGalleryArg($value = null)
123 123
 	{
124
-		$gallery = $this->getValue( 'gallery', $value );
124
+		$gallery = $this->getValue('gallery', $value);
125 125
 
126
-		if( !is_numeric( $gallery ) && is_string( $gallery )) {
127
-			$gallery = intval( $this->postmeta->get( $gallery ));
126
+		if (!is_numeric($gallery) && is_string($gallery)) {
127
+			$gallery = intval($this->postmeta->get($gallery));
128 128
 		}
129
-		return !is_null( get_post( $gallery ))
130
-			? intval( $gallery )
129
+		return !is_null(get_post($gallery))
130
+			? intval($gallery)
131 131
 			: 0;
132 132
 	}
133 133
 
@@ -136,14 +136,14 @@  discard block
 block discarded – undo
136 136
 	 *
137 137
 	 * @return int
138 138
 	 */
139
-	protected function getImagesPerPageArg( $value = null )
139
+	protected function getImagesPerPageArg($value = null)
140 140
 	{
141
-		$perPage = $this->getValue( 'images_per_page', $value );
141
+		$perPage = $this->getValue('images_per_page', $value);
142 142
 
143
-		if( !is_numeric( $perPage ) && is_string( $perPage )) {
144
-			$perPage = $this->postmeta->get( $perPage );
143
+		if (!is_numeric($perPage) && is_string($perPage)) {
144
+			$perPage = $this->postmeta->get($perPage);
145 145
 		}
146
-		return !!intval( $perPage )
146
+		return !!intval($perPage)
147 147
 			? $perPage
148 148
 			: -1;
149 149
 	}
@@ -153,9 +153,9 @@  discard block
 block discarded – undo
153 153
 	 *
154 154
 	 * @return bool
155 155
 	 */
156
-	protected function getLazyloadArg( $value = null )
156
+	protected function getLazyloadArg($value = null)
157 157
 	{
158
-		return $this->getBoolValue( 'lazyload', $value );
158
+		return $this->getBoolValue('lazyload', $value);
159 159
 	}
160 160
 
161 161
 	/**
@@ -163,18 +163,18 @@  discard block
 block discarded – undo
163 163
 	 *
164 164
 	 * @return array
165 165
 	 */
166
-	protected function getMediaArg( $value = null )
166
+	protected function getMediaArg($value = null)
167 167
 	{
168
-		$media = $this->getValue( 'media', $value );
168
+		$media = $this->getValue('media', $value);
169 169
 
170
-		if( is_string( $media )) {
171
-			$media = $this->postmeta->get( $media, [
170
+		if (is_string($media)) {
171
+			$media = $this->postmeta->get($media, [
172 172
 				'ID'     => $this->getGalleryArg(),
173 173
 				'single' => false,
174 174
 			]);
175 175
 		}
176
-		return is_array( $media )
177
-			? wp_parse_id_list( $media )
176
+		return is_array($media)
177
+			? wp_parse_id_list($media)
178 178
 			: [];
179 179
 	}
180 180
 
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 	 */
184 184
 	protected function getPaged()
185 185
 	{
186
-		return intval( get_query_var(( is_front_page() ? 'page' : 'paged' ))) ?: 1;
186
+		return intval(get_query_var((is_front_page() ? 'page' : 'paged'))) ?: 1;
187 187
 	}
188 188
 
189 189
 	/**
@@ -191,9 +191,9 @@  discard block
 block discarded – undo
191 191
 	 *
192 192
 	 * @return bool
193 193
 	 */
194
-	protected function getPaginationArg( $value = null )
194
+	protected function getPaginationArg($value = null)
195 195
 	{
196
-		return $this->getBoolValue( 'pagination', $value );
196
+		return $this->getBoolValue('pagination', $value);
197 197
 	}
198 198
 
199 199
 	/**
@@ -201,17 +201,17 @@  discard block
 block discarded – undo
201 201
 	 *
202 202
 	 * @return bool
203 203
 	 */
204
-	protected function getPermalinksArg( $value = null )
204
+	protected function getPermalinksArg($value = null)
205 205
 	{
206
-		return $this->getBoolValue( 'permalinks', $value );
206
+		return $this->getBoolValue('permalinks', $value);
207 207
 	}
208 208
 
209 209
 	/**
210 210
 	 * @return string
211 211
 	 */
212
-	protected function getPhotoswipeData( $image )
212
+	protected function getPhotoswipeData($image)
213 213
 	{
214
-		return sprintf( '{"l":{"src":"%s","w":%d,"h":%d},"m":{"src":"%s","w":%d,"h":%d}}',
214
+		return sprintf('{"l":{"src":"%s","w":%d,"h":%d},"m":{"src":"%s","w":%d,"h":%d}}',
215 215
 			$image->large['url'],
216 216
 			$image->large['width'],
217 217
 			$image->large['height'],
@@ -227,9 +227,9 @@  discard block
 block discarded – undo
227 227
 	 *
228 228
 	 * @return mixed
229 229
 	 */
230
-	protected function getValue( $key, $value = null )
230
+	protected function getValue($key, $value = null)
231 231
 	{
232
-		if( is_null( $value ) && isset( $this->args[$key] )) {
232
+		if (is_null($value) && isset($this->args[$key])) {
233 233
 			$value = $this->args[$key];
234 234
 		}
235 235
 		return $value;
@@ -238,23 +238,23 @@  discard block
 block discarded – undo
238 238
 	/**
239 239
 	 * @return array
240 240
 	 */
241
-	protected function normalizeArgs( array $args = [] )
241
+	protected function normalizeArgs(array $args = [])
242 242
 	{
243 243
 		$defaults = [
244
-			'gallery',         // (string) meta_key | (int) post_id
245
-			'lazyload',        // (string) meta_key | (bool)
246
-			'media',           // (string) meta_key | (array) post_ids
247
-			'pagination',      // (string) meta_key | (bool)
244
+			'gallery', // (string) meta_key | (int) post_id
245
+			'lazyload', // (string) meta_key | (bool)
246
+			'media', // (string) meta_key | (array) post_ids
247
+			'pagination', // (string) meta_key | (bool)
248 248
 			'images_per_page', // (string) meta_key | (int) number
249
-			'permalinks',      // (string) meta_key | (bool)
249
+			'permalinks', // (string) meta_key | (bool)
250 250
 		];
251 251
 
252
-		$this->args = shortcode_atts( array_combine( $defaults, $defaults ), $args );
252
+		$this->args = shortcode_atts(array_combine($defaults, $defaults), $args);
253 253
 
254
-		array_walk( $this->args, function( &$value, $key ) {
255
-			$method = $this->utility->buildMethodName( $key . '_arg' );
256
-			if( method_exists( $this, $method )) {
257
-				$value = call_user_func([ $this, $method ], $value );
254
+		array_walk($this->args, function(&$value, $key) {
255
+			$method = $this->utility->buildMethodName($key . '_arg');
256
+			if (method_exists($this, $method)) {
257
+				$value = call_user_func([$this, $method], $value);
258 258
 			}
259 259
 		});
260 260
 
@@ -265,33 +265,33 @@  discard block
 block discarded – undo
265 265
 	 * @param object $image
266 266
 	 * @return null|string
267 267
 	 */
268
-	protected function renderImageCaption( $image )
268
+	protected function renderImageCaption($image)
269 269
 	{
270
-		if( !empty( $image->copyright )) {
271
-			$image->caption .= sprintf( ' <span itemprop="copyrightHolder">%s</span>', $image->copyright );
270
+		if (!empty($image->copyright)) {
271
+			$image->caption .= sprintf(' <span itemprop="copyrightHolder">%s</span>', $image->copyright);
272 272
 		}
273
-		if( empty( $image->caption ))return;
274
-		return sprintf( '<figcaption itemprop="caption description">%s</figcaption>', $image->caption );
273
+		if (empty($image->caption))return;
274
+		return sprintf('<figcaption itemprop="caption description">%s</figcaption>', $image->caption);
275 275
 	}
276 276
 
277 277
 	/**
278 278
 	 * @param object $image
279 279
 	 * @return null|string
280 280
 	 */
281
-	protected function renderImageTag( $image )
281
+	protected function renderImageTag($image)
282 282
 	{
283 283
 		$imgSrc = $this->getLazyloadArg()
284
-			? $this->theme->imageUri( 'blank.gif' )
284
+			? $this->theme->imageUri('blank.gif')
285 285
 			: $image->thumbnail['url'];
286 286
 
287
-		$imgTag = sprintf( '<img src="%s" data-src="%s" itemprop="thumbnail" alt="%s"/>',
287
+		$imgTag = sprintf('<img src="%s" data-src="%s" itemprop="thumbnail" alt="%s"/>',
288 288
 			$imgSrc,
289 289
 			$image->thumbnail['url'],
290 290
 			$image->alt
291 291
 		);
292 292
 
293 293
 		return $this->getPermalinksArg()
294
-			? sprintf( '<a href="%s" itemprop="contentUrl">%s</a>', $image->permalink, $imgTag )
294
+			? sprintf('<a href="%s" itemprop="contentUrl">%s</a>', $image->permalink, $imgTag)
295 295
 			: $imgTag;
296 296
 	}
297 297
 }
Please login to merge, or discard this patch.
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -52,7 +52,9 @@  discard block
 block discarded – undo
52 52
 	 */
53 53
 	public function render()
54 54
 	{
55
-		if( empty( $this->args['media'] ))return;
55
+		if( empty( $this->args['media'] )) {
56
+			return;
57
+		}
56 58
 		$images = array_reduce( $this->gallery->posts, function( $images, $attachment ) {
57 59
 			return $images . $this->renderImage( $attachment );
58 60
 		});
@@ -69,7 +71,9 @@  discard block
 block discarded – undo
69 71
 	{
70 72
 		$image = $this->image->get( $attachment->ID )->image;
71 73
 
72
-		if( !$image )return;
74
+		if( !$image ) {
75
+			return;
76
+		}
73 77
 		return sprintf(
74 78
 			'<figure class="gallery-image" data-w="%s" data-h="%s" data-ps=\'%s\' itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject">' .
75 79
 				'%s%s' .
@@ -87,7 +91,9 @@  discard block
 block discarded – undo
87 91
 	 */
88 92
 	public function renderPagination()
89 93
 	{
90
-		if( !$this->args['pagination'] )return;
94
+		if( !$this->args['pagination'] ) {
95
+			return;
96
+		}
91 97
 		return paginate_links([
92 98
 			'before_page_number' => '<span class="screen-reader-text">' . __( 'Page', 'castor' ) . ' </span>',
93 99
 			'current'            => $this->gallery->query['paged'],
@@ -270,7 +276,9 @@  discard block
 block discarded – undo
270 276
 		if( !empty( $image->copyright )) {
271 277
 			$image->caption .= sprintf( ' <span itemprop="copyrightHolder">%s</span>', $image->copyright );
272 278
 		}
273
-		if( empty( $image->caption ))return;
279
+		if( empty( $image->caption )) {
280
+			return;
281
+		}
274 282
 		return sprintf( '<figcaption itemprop="caption description">%s</figcaption>', $image->caption );
275 283
 	}
276 284
 
Please login to merge, or discard this patch.
src/Helpers/Log.php 2 patches
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -157,11 +157,9 @@  discard block
 block discarded – undo
157 157
 		foreach( $context as $key => $val ) {
158 158
 			if( is_object( $val ) && get_class( $val ) === 'DateTime' ) {
159 159
 				$val = $val->format( 'Y-m-d H:i:s' );
160
-			}
161
-			else if( is_object( $val ) || is_array( $val )) {
160
+			} else if( is_object( $val ) || is_array( $val )) {
162 161
 				$val = json_encode( $val );
163
-			}
164
-			else if( is_resource( $val )) {
162
+			} else if( is_resource( $val )) {
165 163
 				$val = (string) $val;
166 164
 			}
167 165
 			$replace['{'.$key.'}'] = $val;
@@ -180,7 +178,9 @@  discard block
 block discarded – undo
180 178
 		if( !defined( 'CASTOR_DEBUG' )
181 179
 			|| CASTOR_DEBUG !== true
182 180
 			|| !in_array( $level, (new ReflectionClass( __NAMESPACE__.'\Log' ))->getConstants(), true )
183
-		)return;
181
+		) {
182
+			return;
183
+		}
184 184
 		$date = get_date_from_gmt( gmdate('Y-m-d H:i:s') );
185 185
 		$level = strtoupper( $level );
186 186
 		$message = $this->interpolate( $message, $context );
Please login to merge, or discard this patch.
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -18,11 +18,11 @@  discard block
 block discarded – undo
18 18
 	protected $file;
19 19
 	protected $log;
20 20
 
21
-	public function __construct( $filename )
21
+	public function __construct($filename)
22 22
 	{
23 23
 		$this->file = $filename;
24
-		$this->log = file_exists( $filename )
25
-			? file_get_contents( $filename )
24
+		$this->log = file_exists($filename)
25
+			? file_get_contents($filename)
26 26
 			: '';
27 27
 	}
28 28
 
@@ -40,9 +40,9 @@  discard block
 block discarded – undo
40 40
 	 * @param array $context
41 41
 	 * @return void
42 42
 	 */
43
-	public function alert( $message, array $context = [] )
43
+	public function alert($message, array $context = [])
44 44
 	{
45
-		$this->log( static::ALERT, $message, $context );
45
+		$this->log(static::ALERT, $message, $context);
46 46
 	}
47 47
 
48 48
 	/**
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	public function clear()
52 52
 	{
53 53
 		$this->log = '';
54
-		file_put_contents( $this->file, $this->log );
54
+		file_put_contents($this->file, $this->log);
55 55
 	}
56 56
 
57 57
 	/**
@@ -62,9 +62,9 @@  discard block
 block discarded – undo
62 62
 	 * @param array $context
63 63
 	 * @return void
64 64
 	 */
65
-	public function critical( $message, array $context = [] )
65
+	public function critical($message, array $context = [])
66 66
 	{
67
-		$this->log( static::CRITICAL, $message, $context );
67
+		$this->log(static::CRITICAL, $message, $context);
68 68
 	}
69 69
 
70 70
 	/**
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
 	 * @param array $context
75 75
 	 * @return void
76 76
 	 */
77
-	public function debug( $message, array $context = [] )
77
+	public function debug($message, array $context = [])
78 78
 	{
79
-		$this->log( static::DEBUG, $message, $context );
79
+		$this->log(static::DEBUG, $message, $context);
80 80
 	}
81 81
 
82 82
 	/**
@@ -86,9 +86,9 @@  discard block
 block discarded – undo
86 86
 	 * @param array $context
87 87
 	 * @return void
88 88
 	 */
89
-	public function emergency( $message, array $context = [] )
89
+	public function emergency($message, array $context = [])
90 90
 	{
91
-		$this->log( static::EMERGENCY, $message, $context );
91
+		$this->log(static::EMERGENCY, $message, $context);
92 92
 	}
93 93
 
94 94
 	/**
@@ -99,9 +99,9 @@  discard block
 block discarded – undo
99 99
 	 * @param array $context
100 100
 	 * @return void
101 101
 	 */
102
-	public function error( $message, array $context = [] )
102
+	public function error($message, array $context = [])
103 103
 	{
104
-		$this->log( static::ERROR, $message, $context );
104
+		$this->log(static::ERROR, $message, $context);
105 105
 	}
106 106
 
107 107
 	/**
@@ -112,9 +112,9 @@  discard block
 block discarded – undo
112 112
 	 * @param array $context
113 113
 	 * @return void
114 114
 	 */
115
-	public function info( $message, array $context = [] )
115
+	public function info($message, array $context = [])
116 116
 	{
117
-		$this->log( static::INFO, $message, $context );
117
+		$this->log(static::INFO, $message, $context);
118 118
 	}
119 119
 
120 120
 	/**
@@ -124,9 +124,9 @@  discard block
 block discarded – undo
124 124
 	 * @param array $context
125 125
 	 * @return void
126 126
 	 */
127
-	public function notice( $message, array $context = [] )
127
+	public function notice($message, array $context = [])
128 128
 	{
129
-		$this->log( static::NOTICE, $message, $context );
129
+		$this->log(static::NOTICE, $message, $context);
130 130
 	}
131 131
 
132 132
 	/**
@@ -138,9 +138,9 @@  discard block
 block discarded – undo
138 138
 	 * @param array $context
139 139
 	 * @return void
140 140
 	 */
141
-	public function warning( $message, array $context = [] )
141
+	public function warning($message, array $context = [])
142 142
 	{
143
-		$this->log( static::WARNING, $message, $context );
143
+		$this->log(static::WARNING, $message, $context);
144 144
 	}
145 145
 
146 146
 	/**
@@ -148,25 +148,25 @@  discard block
 block discarded – undo
148 148
 	 * @param array $context
149 149
 	 * @return array|string
150 150
 	 */
151
-	protected function interpolate( $message, array $context = [] )
151
+	protected function interpolate($message, array $context = [])
152 152
 	{
153
-		if( is_array( $message )) {
154
-			return htmlspecialchars( print_r( $message, true ), ENT_QUOTES, 'UTF-8' );
153
+		if (is_array($message)) {
154
+			return htmlspecialchars(print_r($message, true), ENT_QUOTES, 'UTF-8');
155 155
 		}
156 156
 		$replace = [];
157
-		foreach( $context as $key => $val ) {
158
-			if( is_object( $val ) && get_class( $val ) === 'DateTime' ) {
159
-				$val = $val->format( 'Y-m-d H:i:s' );
157
+		foreach ($context as $key => $val) {
158
+			if (is_object($val) && get_class($val) === 'DateTime') {
159
+				$val = $val->format('Y-m-d H:i:s');
160 160
 			}
161
-			else if( is_object( $val ) || is_array( $val )) {
162
-				$val = json_encode( $val );
161
+			else if (is_object($val) || is_array($val)) {
162
+				$val = json_encode($val);
163 163
 			}
164
-			else if( is_resource( $val )) {
164
+			else if (is_resource($val)) {
165 165
 				$val = (string) $val;
166 166
 			}
167
-			$replace['{'.$key.'}'] = $val;
167
+			$replace['{' . $key . '}'] = $val;
168 168
 		}
169
-		return strtr( $message, $replace );
169
+		return strtr($message, $replace);
170 170
 	}
171 171
 
172 172
 	/**
@@ -175,16 +175,16 @@  discard block
 block discarded – undo
175 175
 	 * @param array $context
176 176
 	 * @return void
177 177
 	 */
178
-	protected function log( $level, $message, array $context = [] )
178
+	protected function log($level, $message, array $context = [])
179 179
 	{
180
-		if( !defined( 'CASTOR_DEBUG' )
180
+		if (!defined('CASTOR_DEBUG')
181 181
 			|| CASTOR_DEBUG !== true
182
-			|| !in_array( $level, (new ReflectionClass( __NAMESPACE__.'\Log' ))->getConstants(), true )
182
+			|| !in_array($level, (new ReflectionClass(__NAMESPACE__ . '\Log'))->getConstants(), true)
183 183
 		)return;
184
-		$date = get_date_from_gmt( gmdate('Y-m-d H:i:s') );
185
-		$level = strtoupper( $level );
186
-		$message = $this->interpolate( $message, $context );
184
+		$date = get_date_from_gmt(gmdate('Y-m-d H:i:s'));
185
+		$level = strtoupper($level);
186
+		$message = $this->interpolate($message, $context);
187 187
 		$entry = "[$date] $level: $message" . PHP_EOL;
188
-		file_put_contents( $this->file, $entry, FILE_APPEND|LOCK_EX );
188
+		file_put_contents($this->file, $entry, FILE_APPEND | LOCK_EX);
189 189
 	}
190 190
 }
Please login to merge, or discard this patch.
src/Helpers/Render.php 2 patches
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 	public $theme;
15 15
 	public $utility;
16 16
 
17
-	public function __construct( Media $media, PostMeta $postmeta, Theme $theme, Utility $utility )
17
+	public function __construct(Media $media, PostMeta $postmeta, Theme $theme, Utility $utility)
18 18
 	{
19 19
 		$this->media    = $media;
20 20
 		$this->postmeta = $postmeta;
@@ -22,147 +22,147 @@  discard block
 block discarded – undo
22 22
 		$this->utility  = $utility;
23 23
 	}
24 24
 
25
-	public function blockquote( $metaKey = false, array $attributes = [] )
25
+	public function blockquote($metaKey = false, array $attributes = [])
26 26
 	{
27
-		if( $value = $this->postmeta->get( $metaKey )) {
28
-			$this->utility->printTag( 'blockquote', wp_strip_all_tags( $value ), $attributes );
27
+		if ($value = $this->postmeta->get($metaKey)) {
28
+			$this->utility->printTag('blockquote', wp_strip_all_tags($value), $attributes);
29 29
 		}
30 30
 	}
31 31
 
32
-	public function button( $postId = 0, $title = false, $passthrough = false )
32
+	public function button($postId = 0, $title = false, $passthrough = false)
33 33
 	{
34
-		if( $passthrough ) {
34
+		if ($passthrough) {
35 35
 			$url = $postId;
36 36
 		}
37
-		if( !isset( $url )) {
38
-			$url = get_permalink( $postId );
39
-			if( !$title ) {
40
-				$title = get_the_title( $postId );
37
+		if (!isset($url)) {
38
+			$url = get_permalink($postId);
39
+			if (!$title) {
40
+				$title = get_the_title($postId);
41 41
 			}
42 42
 		}
43
-		if( !$title || !$url )return;
44
-		printf( '<a href="%s" class="button"><span>%s</span></a>', $url, $title );
43
+		if (!$title || !$url)return;
44
+		printf('<a href="%s" class="button"><span>%s</span></a>', $url, $title);
45 45
 	}
46 46
 
47
-	public function buttons( $postIds = [] )
47
+	public function buttons($postIds = [])
48 48
 	{
49
-		foreach( (array) $postIds as $postId ) {
50
-			$this->button( $postId );
49
+		foreach ((array) $postIds as $postId) {
50
+			$this->button($postId);
51 51
 		}
52 52
 	}
53 53
 
54
-	public function content( $metaKey = false, $passthrough = false )
54
+	public function content($metaKey = false, $passthrough = false)
55 55
 	{
56
-		if( $passthrough ) {
56
+		if ($passthrough) {
57 57
 			$content = $metaKey;
58 58
 		}
59
-		if( !isset( $content )) {
59
+		if (!isset($content)) {
60 60
 			$content = $metaKey
61
-				? $this->postmeta->get( $metaKey )
61
+				? $this->postmeta->get($metaKey)
62 62
 				: get_the_content();
63 63
 		}
64
-		echo str_replace( ']]>', ']]&gt;', apply_filters( 'the_content', $content ));
64
+		echo str_replace(']]>', ']]&gt;', apply_filters('the_content', $content));
65 65
 	}
66 66
 
67
-	public function copyright( array $args = [] )
67
+	public function copyright(array $args = [])
68 68
 	{
69
-		extract( shortcode_atts([
70
-			'copyright' => sprintf( '<span>%s </span>&copy;', __( 'Copyright', 'castor' )),
71
-			'date' => date( 'Y' ),
72
-			'name' => get_bloginfo( 'name' ),
69
+		extract(shortcode_atts([
70
+			'copyright' => sprintf('<span>%s </span>&copy;', __('Copyright', 'castor')),
71
+			'date' => date('Y'),
72
+			'name' => get_bloginfo('name'),
73 73
 			'separator' => '&mdash;',
74
-		], $args ));
75
-		if( $separator ) {
74
+		], $args));
75
+		if ($separator) {
76 76
 			$separator .= ' ';
77 77
 		}
78
-		printf( '%s %s %s%s', $copyright, $date, $separator, $name );
78
+		printf('%s %s %s%s', $copyright, $date, $separator, $name);
79 79
 	}
80 80
 
81
-	public function featured( $args = [] )
81
+	public function featured($args = [])
82 82
 	{
83
-		$args = wp_parse_args( $args, [
83
+		$args = wp_parse_args($args, [
84 84
 			'class'  => 'featured',
85 85
 			'image'  => get_post_thumbnail_id(),
86 86
 			'player' => '',
87 87
 			'video'  => 'featured_video',
88 88
 		]);
89
-		$featuredHtml = $this->media->video( wp_parse_args( $args, [
89
+		$featuredHtml = $this->media->video(wp_parse_args($args, [
90 90
 			'url' => $args['video'],
91 91
 		]));
92
-		if( empty( $featuredHtml ) && $featuredImage = $this->media->getImage( $args['image'] )) {
92
+		if (empty($featuredHtml) && $featuredImage = $this->media->getImage($args['image'])) {
93 93
 			$featuredCaption = $featuredImage->caption
94
-				? sprintf( '<figcaption>%s</figcaption>', $featuredImage->caption )
94
+				? sprintf('<figcaption>%s</figcaption>', $featuredImage->caption)
95 95
 				: '';
96
-			$featuredHtml = sprintf( '<div class="featured-image"><img src="%s" alt="%s"></div>%s',
96
+			$featuredHtml = sprintf('<div class="featured-image"><img src="%s" alt="%s"></div>%s',
97 97
 				$featuredImage->large['url'],
98 98
 				$featuredImage->alt,
99 99
 				$featuredCaption
100 100
 			);
101 101
 		}
102
-		if( !empty( $featuredHtml )) {
103
-			printf( '<figure class="%s">%s</figure>', $args['class'], $featuredHtml );
102
+		if (!empty($featuredHtml)) {
103
+			printf('<figure class="%s">%s</figure>', $args['class'], $featuredHtml);
104 104
 		}
105 105
 	}
106 106
 
107
-	public function field( $name, array $args = [] )
107
+	public function field($name, array $args = [])
108 108
 	{
109 109
 	}
110 110
 
111
-	public function form( $name, array $args = [] )
111
+	public function form($name, array $args = [])
112 112
 	{
113 113
 	}
114 114
 
115
-	public function gallery( array $args = [] )
115
+	public function gallery(array $args = [])
116 116
 	{
117
-		echo $this->media->gallery( $args );
117
+		echo $this->media->gallery($args);
118 118
 	}
119 119
 
120
-	public function h1( $string, array $attributes = [] ) {
121
-		$this->utility->printTag( 'h1', wp_strip_all_tags( $string ), $attributes );
120
+	public function h1($string, array $attributes = []) {
121
+		$this->utility->printTag('h1', wp_strip_all_tags($string), $attributes);
122 122
 	}
123 123
 
124
-	public function h2( $string, array $attributes = [] ) {
125
-		$this->utility->printTag( 'h2', wp_strip_all_tags( $string ), $attributes );
124
+	public function h2($string, array $attributes = []) {
125
+		$this->utility->printTag('h2', wp_strip_all_tags($string), $attributes);
126 126
 	}
127 127
 
128
-	public function h3( $string, array $attributes = [] ) {
129
-		$this->utility->printTag( 'h3', wp_strip_all_tags( $string ), $attributes );
128
+	public function h3($string, array $attributes = []) {
129
+		$this->utility->printTag('h3', wp_strip_all_tags($string), $attributes);
130 130
 	}
131 131
 
132
-	public function h4( $string, array $attributes = [] ) {
133
-		$this->utility->printTag( 'h4', wp_strip_all_tags( $string ), $attributes );
132
+	public function h4($string, array $attributes = []) {
133
+		$this->utility->printTag('h4', wp_strip_all_tags($string), $attributes);
134 134
 	}
135 135
 
136
-	public function h5( $string, array $attributes = [] ) {
137
-		$this->utility->printTag( 'h5', wp_strip_all_tags( $string ), $attributes );
136
+	public function h5($string, array $attributes = []) {
137
+		$this->utility->printTag('h5', wp_strip_all_tags($string), $attributes);
138 138
 	}
139 139
 
140
-	public function h6( $string, array $attributes = [] ) {
141
-		$this->utility->printTag( 'h6', wp_strip_all_tags( $string ), $attributes );
140
+	public function h6($string, array $attributes = []) {
141
+		$this->utility->printTag('h6', wp_strip_all_tags($string), $attributes);
142 142
 	}
143 143
 
144
-	public function madeWithLove( $name )
144
+	public function madeWithLove($name)
145 145
 	{
146
-		printf( __( 'Made with %s by %s', 'castor' ),
147
-			file_get_contents( sprintf( '%simg/heart.svg', \GeminiLabs\Castor\Application::getInstance()->assets )),
146
+		printf(__('Made with %s by %s', 'castor'),
147
+			file_get_contents(sprintf('%simg/heart.svg', \GeminiLabs\Castor\Application::getInstance()->assets)),
148 148
 			$name
149 149
 		);
150 150
 	}
151 151
 
152
-	public function p( $string, array $attributes = [] ) {
153
-		$this->utility->printTag( 'p', wp_strip_all_tags( $string ), $attributes );
152
+	public function p($string, array $attributes = []) {
153
+		$this->utility->printTag('p', wp_strip_all_tags($string), $attributes);
154 154
 	}
155 155
 
156
-	public function title( $metaKey = false, array $attributes = [] )
156
+	public function title($metaKey = false, array $attributes = [])
157 157
 	{
158
-		$tag = apply_filters( 'castor/render/title/tag', 'h2' );
158
+		$tag = apply_filters('castor/render/title/tag', 'h2');
159 159
 		$value = $metaKey
160
-			? $this->postmeta->get( $metaKey )
160
+			? $this->postmeta->get($metaKey)
161 161
 			: $this->theme->pageTitle();
162 162
 
163
-		if( !$value )return;
163
+		if (!$value)return;
164 164
 
165
-		$this->utility->printTag( $tag, wp_strip_all_tags( $value ), $attributes );
165
+		$this->utility->printTag($tag, wp_strip_all_tags($value), $attributes);
166 166
 	}
167 167
 
168 168
 	/**
@@ -170,8 +170,8 @@  discard block
 block discarded – undo
170 170
 	 *
171 171
 	 * @return string|null
172 172
 	 */
173
-	public function video( $args )
173
+	public function video($args)
174 174
 	{
175
-		echo $this->media->video( $args );
175
+		echo $this->media->video($args);
176 176
 	}
177 177
 }
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,7 +40,9 @@  discard block
 block discarded – undo
40 40
 				$title = get_the_title( $postId );
41 41
 			}
42 42
 		}
43
-		if( !$title || !$url )return;
43
+		if( !$title || !$url ) {
44
+			return;
45
+		}
44 46
 		printf( '<a href="%s" class="button"><span>%s</span></a>', $url, $title );
45 47
 	}
46 48
 
@@ -160,7 +162,9 @@  discard block
 block discarded – undo
160 162
 			? $this->postmeta->get( $metaKey )
161 163
 			: $this->theme->pageTitle();
162 164
 
163
-		if( !$value )return;
165
+		if( !$value ) {
166
+			return;
167
+		}
164 168
 
165 169
 		$this->utility->printTag( $tag, wp_strip_all_tags( $value ), $attributes );
166 170
 	}
Please login to merge, or discard this patch.
src/Helpers/Template.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -19,22 +19,22 @@  discard block
 block discarded – undo
19 19
 	 *
20 20
 	 * @return string
21 21
 	 */
22
-	public function get( $slug, $name = '' )
22
+	public function get($slug, $name = '')
23 23
 	{
24
-		$template = Utility::startWith( 'templates/', $slug );
24
+		$template = Utility::startWith('templates/', $slug);
25 25
 		$templates = ["$template.php"];
26
-		if( !empty( $name )) {
27
-			$fileName = basename( $template );
28
-			$filePath = Utility::trimRight( $template, $fileName );
29
-			array_unshift( $templates, sprintf( '%s/%s.php', $filePath . $name, $fileName ));
26
+		if (!empty($name)) {
27
+			$fileName = basename($template);
28
+			$filePath = Utility::trimRight($template, $fileName);
29
+			array_unshift($templates, sprintf('%s/%s.php', $filePath . $name, $fileName));
30 30
 		}
31
-		$templates = array_unique( apply_filters( "castor/templates/$slug", $templates, $name ));
32
-		$template = locate_template( $templates );
33
-		if( empty( $template )) {
34
-			if( file_exists( "$slug.php" )) {
31
+		$templates = array_unique(apply_filters("castor/templates/$slug", $templates, $name));
32
+		$template = locate_template($templates);
33
+		if (empty($template)) {
34
+			if (file_exists("$slug.php")) {
35 35
 				return "$slug.php";
36 36
 			}
37
-			Log::debug( "$slug not found." );
37
+			Log::debug("$slug not found.");
38 38
 		}
39 39
 		return $template;
40 40
 	}
@@ -45,11 +45,11 @@  discard block
 block discarded – undo
45 45
 	 *
46 46
 	 * @return void
47 47
 	 */
48
-	public function load( $slug, $name = '' )
48
+	public function load($slug, $name = '')
49 49
 	{
50
-		if( !empty(( $template = $this->get( $slug, $name )))) {
51
-			Development::storeTemplatePath( $template );
52
-			load_template( $template, false );
50
+		if (!empty(($template = $this->get($slug, $name)))) {
51
+			Development::storeTemplatePath($template);
52
+			load_template($template, false);
53 53
 		}
54 54
 	}
55 55
 
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	 */
59 59
 	public function main()
60 60
 	{
61
-		$this->load( $this->template );
61
+		$this->load($this->template);
62 62
 	}
63 63
 
64 64
 	/**
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
 	 *
67 67
 	 * @return string|void
68 68
 	 */
69
-	public function setLayout( $template )
69
+	public function setLayout($template)
70 70
 	{
71
-		$this->template = Utility::trimRight( $template, '.php' );
72
-		return $this->get( apply_filters( 'castor/templates/layout', 'layouts/default' ));
71
+		$this->template = Utility::trimRight($template, '.php');
72
+		return $this->get(apply_filters('castor/templates/layout', 'layouts/default'));
73 73
 	}
74 74
 }
Please login to merge, or discard this patch.
src/Helpers/SiteMeta.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -17,39 +17,39 @@  discard block
 block discarded – undo
17 17
 
18 18
 	public function __construct()
19 19
 	{
20
-		$this->options = get_option( apply_filters( 'pollux/settings/id', 'pollux_settings' ), [] );
20
+		$this->options = get_option(apply_filters('pollux/settings/id', 'pollux_settings'), []);
21 21
 	}
22 22
 
23 23
 	/**
24 24
 	 * @param string $group
25 25
 	 * @return object|array|null
26 26
 	 */
27
-	public function __call( $group, $args )
27
+	public function __call($group, $args)
28 28
 	{
29
-		$args = array_pad( $args, 2, null );
29
+		$args = array_pad($args, 2, null);
30 30
 		$group = $this->$group;
31
-		if( is_object( $group )) {
31
+		if (is_object($group)) {
32 32
 			return $group;
33 33
 		}
34
-		return $this->get( $group, $args[0], $args[1] );
34
+		return $this->get($group, $args[0], $args[1]);
35 35
 	}
36 36
 
37 37
 	/**
38 38
 	 * @param string $group
39 39
 	 * @return object|array|null
40 40
 	 */
41
-	public function __get( $group )
41
+	public function __get($group)
42 42
 	{
43
-		if( $group == 'all' ) {
43
+		if ($group == 'all') {
44 44
 			return (object) $this->options;
45 45
 		}
46
-		if( empty( $group )) {
46
+		if (empty($group)) {
47 47
 			$group = $this->getDefaultGroup();
48 48
 		}
49
-		if( is_array( $group )) {
50
-			$group = reset( $group );
49
+		if (is_array($group)) {
50
+			$group = reset($group);
51 51
 		}
52
-		return isset( $this->options[$group] )
52
+		return isset($this->options[$group])
53 53
 			? $this->options[$group]
54 54
 			: null;
55 55
 	}
@@ -60,21 +60,21 @@  discard block
 block discarded – undo
60 60
 	 * @param mixed $fallback
61 61
 	 * @return mixed
62 62
 	 */
63
-	public function get( $group = '', $key = '', $fallback = null )
63
+	public function get($group = '', $key = '', $fallback = null)
64 64
 	{
65
-		if( func_num_args() < 1 ) {
65
+		if (func_num_args() < 1) {
66 66
 			return $this->all;
67 67
 		}
68
-		if( is_string( $group )) {
68
+		if (is_string($group)) {
69 69
 			$group = $this->$group;
70 70
 		}
71
-		if( !is_array( $group )) {
71
+		if (!is_array($group)) {
72 72
 			return $fallback;
73 73
 		}
74
-		if( is_null( $key )) {
74
+		if (is_null($key)) {
75 75
 			return $group;
76 76
 		}
77
-		return $this->getValue( $group, $key, $fallback );
77
+		return $this->getValue($group, $key, $fallback);
78 78
 	}
79 79
 
80 80
 	/**
@@ -90,12 +90,12 @@  discard block
 block discarded – undo
90 90
 	 * @param mixed $fallback
91 91
 	 * @return mixed
92 92
 	 */
93
-	protected function getValue( array $group, $key = '', $fallback )
93
+	protected function getValue(array $group, $key = '', $fallback)
94 94
 	{
95
-		if( empty( $key ) || !array_key_exists( $key, $group )) {
95
+		if (empty($key) || !array_key_exists($key, $group)) {
96 96
 			return $fallback;
97 97
 		}
98
-		return empty( $group[$key] ) && !is_null( $fallback )
98
+		return empty($group[$key]) && !is_null($fallback)
99 99
 			? $fallback
100 100
 			: $group[$key];
101 101
 	}
Please login to merge, or discard this patch.