Completed
Push — develop ( d494ed...7721c5 )
by Paul
02:24
created
src/Video.php 2 patches
Spacing   +21 added lines, -21 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, Oembed $oembed, PostMeta $postmeta, Theme $theme, Utility $utility )
22
+	public function __construct(Image $image, Oembed $oembed, PostMeta $postmeta, Theme $theme, Utility $utility)
23 23
 	{
24 24
 		$this->image    = $image;
25 25
 		$this->oembed   = $oembed;
@@ -28,16 +28,16 @@  discard block
 block discarded – undo
28 28
 		$this->utility  = $utility;
29 29
 	}
30 30
 
31
-	public function get( array $args = [] )
31
+	public function get(array $args = [])
32 32
 	{
33
-		$args = $this->normalize( $args );
34
-		$this->video = $this->oembed->request( $args['url'], $args['player'] );
33
+		$args = $this->normalize($args);
34
+		$this->video = $this->oembed->request($args['url'], $args['player']);
35 35
 		return $this;
36 36
 	}
37 37
 
38 38
 	public function render()
39 39
 	{
40
-		if( !isset( $this->video->html ))return;
40
+		if (!isset($this->video->html))return;
41 41
 		return sprintf(
42 42
 			'<div class="video embed">%s%s</div>',
43 43
 			$this->renderScreenshot(),
@@ -55,37 +55,37 @@  discard block
 block discarded – undo
55 55
 				'<a href="%s" class="video-play-btn">%s</a>' .
56 56
 			'</div>',
57 57
 			$this->args['url'],
58
-			$this->theme->svg( 'play.svg' )
58
+			$this->theme->svg('play.svg')
59 59
 		);
60 60
 	}
61 61
 
62 62
 	public function renderScreenshot()
63 63
 	{
64
-		if( !$this->args['image'] )return;
65
-		return sprintf( '<div class="video-screenshot" style="background-image: url(%s)">%s</div>',
64
+		if (!$this->args['image'])return;
65
+		return sprintf('<div class="video-screenshot" style="background-image: url(%s)">%s</div>',
66 66
 			$this->args['image'],
67 67
 			$this->renderPlayButton()
68 68
 		);
69 69
 	}
70 70
 
71
-	protected function setImage( $image )
71
+	protected function setImage($image)
72 72
 	{
73
-		$image = $this->image->get( $image )->image;
74
-		$this->args['image'] = isset( $image->large )
73
+		$image = $this->image->get($image)->image;
74
+		$this->args['image'] = isset($image->large)
75 75
 			? $image->large['url']
76 76
 			: null;
77 77
 	}
78 78
 
79
-	protected function setUrl( $url )
79
+	protected function setUrl($url)
80 80
 	{
81
-		$this->args['url'] = !filter_var( $url, FILTER_VALIDATE_URL )
82
-			? $this->postmeta->get( $url )
81
+		$this->args['url'] = !filter_var($url, FILTER_VALIDATE_URL)
82
+			? $this->postmeta->get($url)
83 83
 			: $url;
84 84
 	}
85 85
 
86
-	protected function normalize( $args )
86
+	protected function normalize($args)
87 87
 	{
88
-		if( is_string( $args )) {
88
+		if (is_string($args)) {
89 89
 			$args = ['url' => $args];
90 90
 		}
91 91
 
@@ -95,12 +95,12 @@  discard block
 block discarded – undo
95 95
 			'image'  => '', // string || int
96 96
 			'player' => '', // string || array
97 97
 			'url'    => '', // string
98
-		], $args );
98
+		], $args);
99 99
 
100
-		foreach( $this->args as $key => $value ) {
101
-			$method = $this->utility->buildMethodName( $key, 'set' );
102
-			if( !method_exists( $this, $method ))continue;
103
-			call_user_func([ $this, $method ], $value );
100
+		foreach ($this->args as $key => $value) {
101
+			$method = $this->utility->buildMethodName($key, 'set');
102
+			if (!method_exists($this, $method))continue;
103
+			call_user_func([$this, $method], $value);
104 104
 		}
105 105
 		return $this->args;
106 106
 	}
Please login to merge, or discard this patch.
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -37,7 +37,9 @@  discard block
 block discarded – undo
37 37
 
38 38
 	public function render()
39 39
 	{
40
-		if( !isset( $this->video->html ))return;
40
+		if( !isset( $this->video->html )) {
41
+			return;
42
+		}
41 43
 		return sprintf(
42 44
 			'<div class="video embed">%s%s</div>',
43 45
 			$this->renderScreenshot(),
@@ -61,7 +63,9 @@  discard block
 block discarded – undo
61 63
 
62 64
 	public function renderScreenshot()
63 65
 	{
64
-		if( !$this->args['image'] )return;
66
+		if( !$this->args['image'] ) {
67
+			return;
68
+		}
65 69
 		return sprintf( '<div class="video-screenshot" style="background-image: url(%s)">%s</div>',
66 70
 			$this->args['image'],
67 71
 			$this->renderPlayButton()
@@ -99,7 +103,9 @@  discard block
 block discarded – undo
99 103
 
100 104
 		foreach( $this->args as $key => $value ) {
101 105
 			$method = $this->utility->buildMethodName( $key, 'set' );
102
-			if( !method_exists( $this, $method ))continue;
106
+			if( !method_exists( $this, $method )) {
107
+				continue;
108
+			}
103 109
 			call_user_func([ $this, $method ], $value );
104 110
 		}
105 111
 		return $this->args;
Please login to merge, or discard this patch.
src/Helpers/Media.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 	protected $image;
14 14
 	protected $video;
15 15
 
16
-	public function __construct( Gallery $gallery, Image $image, Video $video )
16
+	public function __construct(Gallery $gallery, Image $image, Video $video)
17 17
 	{
18 18
 		$this->gallery = $gallery;
19 19
 		$this->image   = $image;
@@ -26,18 +26,18 @@  discard block
 block discarded – undo
26 26
 	 * @return string|void
27 27
 	 * @throws BadMethodCallException
28 28
 	 */
29
-	public function __call( $name, array $args )
29
+	public function __call($name, array $args)
30 30
 	{
31
-		$mediaType = $this->validateMethod( $name );
32
-		if( !$mediaType ) {
33
-			throw new BadMethodCallException( sprintf( 'Not a valid method: %s', $name ));
31
+		$mediaType = $this->validateMethod($name);
32
+		if (!$mediaType) {
33
+			throw new BadMethodCallException(sprintf('Not a valid method: %s', $name));
34 34
 		}
35
-		if( !count( $args )) {
36
-			throw new BadMethodCallException( sprintf( 'Missing arguments for: %s', $name ));
35
+		if (!count($args)) {
36
+			throw new BadMethodCallException(sprintf('Missing arguments for: %s', $name));
37 37
 		}
38
-		return !empty( $args[1] )
39
-			? $this->$mediaType->get( $args[0] )->render( $args[1] )
40
-			: $this->$mediaType->get( $args[0] )->render();
38
+		return !empty($args[1])
39
+			? $this->$mediaType->get($args[0])->render($args[1])
40
+			: $this->$mediaType->get($args[0])->render();
41 41
 	}
42 42
 
43 43
 	/**
@@ -46,10 +46,10 @@  discard block
 block discarded – undo
46 46
 	 *
47 47
 	 * @return mixed
48 48
 	 */
49
-	public function get( $name, $args = [] )
49
+	public function get($name, $args = [])
50 50
 	{
51
-		if( $mediaType = $this->validateMethod( $name )) {
52
-			return $this->$mediaType->get( $args )->$mediaType;
51
+		if ($mediaType = $this->validateMethod($name)) {
52
+			return $this->$mediaType->get($args)->$mediaType;
53 53
 		}
54 54
 	}
55 55
 
@@ -58,12 +58,12 @@  discard block
 block discarded – undo
58 58
 	 *
59 59
 	 * @return string|false
60 60
 	 */
61
-	protected function validateMethod( $name )
61
+	protected function validateMethod($name)
62 62
 	{
63
-		foreach( [$name, strtolower( substr( $name, 3 ))] as $method ) {
64
-			if( in_array( $method, ['gallery', 'image', 'video'] )
65
-				&& property_exists( $this, $method )
66
-				&& is_object( $this->$method )) {
63
+		foreach ([$name, strtolower(substr($name, 3))] as $method) {
64
+			if (in_array($method, ['gallery', 'image', 'video'])
65
+				&& property_exists($this, $method)
66
+				&& is_object($this->$method)) {
67 67
 				return $method;
68 68
 			}
69 69
 		}
Please login to merge, or discard this patch.
src/Helpers/PostMeta.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 
5 5
 class PostMeta
6 6
 {
7
-	public function get( $value, array $args = [] )
7
+	public function get($value, array $args = [])
8 8
 	{
9 9
 		$defaults = [
10 10
 			'ID'       => get_the_ID(),
@@ -13,15 +13,15 @@  discard block
 block discarded – undo
13 13
 			'prefix'   => 'pollux_',
14 14
 		];
15 15
 
16
-		$args = shortcode_atts( $defaults, $args );
16
+		$args = shortcode_atts($defaults, $args);
17 17
 
18
-		if( !empty( $value ) && $value[0] == '_' && !empty( $args['prefix'] )) {
19
-			$args['prefix'] = sprintf( '_%s', rtrim( $args['prefix'], '_' ));
18
+		if (!empty($value) && $value[0] == '_' && !empty($args['prefix'])) {
19
+			$args['prefix'] = sprintf('_%s', rtrim($args['prefix'], '_'));
20 20
 		}
21 21
 
22
-		$metaValue = get_post_meta( $args['ID'], $args['prefix'] . $value, $args['single'] );
22
+		$metaValue = get_post_meta($args['ID'], $args['prefix'] . $value, $args['single']);
23 23
 
24
-		return empty( $metaValue )
24
+		return empty($metaValue)
25 25
 			? $args['fallback']
26 26
 			: $metaValue;
27 27
 	}
Please login to merge, or discard this patch.
src/Image.php 2 patches
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 	protected $postmeta;
13 13
 	protected $utility;
14 14
 
15
-	public function __construct( PostMeta $postmeta, Utility $utility )
15
+	public function __construct(PostMeta $postmeta, Utility $utility)
16 16
 	{
17 17
 		$this->postmeta = $postmeta;
18 18
 		$this->utility  = $utility;
@@ -23,41 +23,41 @@  discard block
 block discarded – undo
23 23
 	 *
24 24
 	 * @return null|object
25 25
 	 */
26
-	public function get( $attachment )
26
+	public function get($attachment)
27 27
 	{
28
-		if( !( $attachment = $this->normalize( $attachment )))return;
29
-		if( $thumbnail = wp_get_attachment_image_src( $attachment, 'thumbnail' )) {
30
-			$medium = $this->normalizeSrc( wp_get_attachment_image_src( $attachment, 'medium' ), $thumbnail );
31
-			$large = $this->normalizeSrc( wp_get_attachment_image_src( $attachment, 'large' ), $medium );
28
+		if (!($attachment = $this->normalize($attachment)))return;
29
+		if ($thumbnail = wp_get_attachment_image_src($attachment, 'thumbnail')) {
30
+			$medium = $this->normalizeSrc(wp_get_attachment_image_src($attachment, 'medium'), $thumbnail);
31
+			$large = $this->normalizeSrc(wp_get_attachment_image_src($attachment, 'large'), $medium);
32 32
 
33 33
 			$this->image = (object) [
34
-				'alt'       => wp_strip_all_tags( get_post_meta( $attachment, '_wp_attachment_image_alt', true ), true ),
35
-				'caption'   => wp_get_attachment_caption( $attachment ),
36
-				'copyright' => wp_strip_all_tags( get_post_meta( $attachment, '_copyright', true ), true ),
34
+				'alt'       => wp_strip_all_tags(get_post_meta($attachment, '_wp_attachment_image_alt', true), true),
35
+				'caption'   => wp_get_attachment_caption($attachment),
36
+				'copyright' => wp_strip_all_tags(get_post_meta($attachment, '_copyright', true), true),
37 37
 				'ID'        => $attachment,
38 38
 				'large'     => $large,
39 39
 				'medium'    => $medium,
40
-				'permalink' => get_attachment_link( $attachment ),
41
-				'thumbnail' => $this->normalizeSrc( $thumbnail ),
40
+				'permalink' => get_attachment_link($attachment),
41
+				'thumbnail' => $this->normalizeSrc($thumbnail),
42 42
 			];
43 43
 		}
44 44
 		return $this;
45 45
 	}
46 46
 
47
-	public function render( $size = 'large' )
47
+	public function render($size = 'large')
48 48
 	{
49
-		return wp_get_attachment_image( $this->image->ID, $size );
49
+		return wp_get_attachment_image($this->image->ID, $size);
50 50
 	}
51 51
 
52
-	protected function normalize( $attachmentId )
52
+	protected function normalize($attachmentId)
53 53
 	{
54
-		if( !filter_var( $attachmentId, FILTER_VALIDATE_INT )) {
55
-			$attachmentId = $this->postmeta->get( $attachmentId );
54
+		if (!filter_var($attachmentId, FILTER_VALIDATE_INT)) {
55
+			$attachmentId = $this->postmeta->get($attachmentId);
56 56
 		}
57 57
 
58
-		$attachment = get_post( $attachmentId );
58
+		$attachment = get_post($attachmentId);
59 59
 
60
-		if( !$attachmentId || !$attachment || $attachment->post_type != 'attachment' )return;
60
+		if (!$attachmentId || !$attachment || $attachment->post_type != 'attachment')return;
61 61
 
62 62
 		return $attachment->ID;
63 63
 	}
@@ -67,9 +67,9 @@  discard block
 block discarded – undo
67 67
 	 *
68 68
 	 * @return array
69 69
 	 */
70
-	protected function normalizeSrc( array $image, $fallback = false )
70
+	protected function normalizeSrc(array $image, $fallback = false)
71 71
 	{
72
-		if( is_array( $fallback ) && count( array_diff( $image, $fallback )) < 2 ) {
72
+		if (is_array($fallback) && count(array_diff($image, $fallback)) < 2) {
73 73
 			$image = $fallback;
74 74
 		}
75 75
 		return [
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,7 +25,9 @@  discard block
 block discarded – undo
25 25
 	 */
26 26
 	public function get( $attachment )
27 27
 	{
28
-		if( !( $attachment = $this->normalize( $attachment )))return;
28
+		if( !( $attachment = $this->normalize( $attachment ))) {
29
+			return;
30
+		}
29 31
 		if( $thumbnail = wp_get_attachment_image_src( $attachment, 'thumbnail' )) {
30 32
 			$medium = $this->normalizeSrc( wp_get_attachment_image_src( $attachment, 'medium' ), $thumbnail );
31 33
 			$large = $this->normalizeSrc( wp_get_attachment_image_src( $attachment, 'large' ), $medium );
@@ -57,7 +59,9 @@  discard block
 block discarded – undo
57 59
 
58 60
 		$attachment = get_post( $attachmentId );
59 61
 
60
-		if( !$attachmentId || !$attachment || $attachment->post_type != 'attachment' )return;
62
+		if( !$attachmentId || !$attachment || $attachment->post_type != 'attachment' ) {
63
+			return;
64
+		}
61 65
 
62 66
 		return $attachment->ID;
63 67
 	}
Please login to merge, or discard this patch.
src/Gallery.php 2 patches
Spacing   +63 added lines, -63 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,20 +52,20 @@  discard block
 block discarded – undo
52 52
 	 */
53 53
 	public function render()
54 54
 	{
55
-		$images = array_reduce( $this->gallery->posts, function( $images, $attachment ) {
56
-			return $images . $this->renderImage( $attachment );
55
+		$images = array_reduce($this->gallery->posts, function($images, $attachment) {
56
+			return $images . $this->renderImage($attachment);
57 57
 		});
58
-		return sprintf( '<div class="gallery-images" itemscope itemtype="http://schema.org/ImageGallery">%s</div>', $images );
58
+		return sprintf('<div class="gallery-images" itemscope itemtype="http://schema.org/ImageGallery">%s</div>', $images);
59 59
 	}
60 60
 
61 61
 	/**
62 62
 	 * @return null|string
63 63
 	 */
64
-	public function renderImage( WP_Post $attachment )
64
+	public function renderImage(WP_Post $attachment)
65 65
 	{
66
-		$image = $this->image->get( $attachment->ID )->image;
66
+		$image = $this->image->get($attachment->ID)->image;
67 67
 
68
-		if( !$image )return;
68
+		if (!$image)return;
69 69
 		return sprintf(
70 70
 			'<figure class="gallery-image" data-w="%s" data-h="%s" data-ps=\'%s\' itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject">' .
71 71
 				'%s<figcaption itemprop="caption description">' .
@@ -74,8 +74,8 @@  discard block
 block discarded – undo
74 74
 			'</figure>',
75 75
 			$image->thumbnail['width'],
76 76
 			$image->thumbnail['height'],
77
-			$this->getPhotoswipeData( $image ),
78
-			$this->renderImageTag( $image ),
77
+			$this->getPhotoswipeData($image),
78
+			$this->renderImageTag($image),
79 79
 			$image->caption,
80 80
 			$image->copyright
81 81
 		);
@@ -86,13 +86,13 @@  discard block
 block discarded – undo
86 86
 	 */
87 87
 	public function renderPagination()
88 88
 	{
89
-		if( !$this->args['pagination'] )return;
89
+		if (!$this->args['pagination'])return;
90 90
 		return paginate_links([
91
-			'before_page_number' => '<span class="screen-reader-text">' . __( 'Page', 'castor' ) . ' </span>',
91
+			'before_page_number' => '<span class="screen-reader-text">' . __('Page', 'castor') . ' </span>',
92 92
 			'current'            => $this->gallery->query['paged'],
93 93
 			'mid_size'           => 1,
94
-			'next_text'          => __( 'Next', 'castor' ),
95
-			'prev_text'          => __( 'Previous', 'castor' ),
94
+			'next_text'          => __('Next', 'castor'),
95
+			'prev_text'          => __('Previous', 'castor'),
96 96
 			'total'              => $this->gallery->max_num_pages,
97 97
 		]);
98 98
 	}
@@ -103,14 +103,14 @@  discard block
 block discarded – undo
103 103
 	 *
104 104
 	 * @return bool
105 105
 	 */
106
-	protected function getBoolValue( $key, $value = null )
106
+	protected function getBoolValue($key, $value = null)
107 107
 	{
108
-		$bool = $this->getValue( $key, $value );
108
+		$bool = $this->getValue($key, $value);
109 109
 
110
-		if( is_null( filter_var( $bool, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE ))) {
111
-			$bool = $this->postmeta->get( $bool );
110
+		if (is_null(filter_var($bool, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE))) {
111
+			$bool = $this->postmeta->get($bool);
112 112
 		}
113
-		return wp_validate_boolean( $bool );
113
+		return wp_validate_boolean($bool);
114 114
 	}
115 115
 
116 116
 	/**
@@ -118,15 +118,15 @@  discard block
 block discarded – undo
118 118
 	 *
119 119
 	 * @return int
120 120
 	 */
121
-	protected function getGalleryArg( $value = null )
121
+	protected function getGalleryArg($value = null)
122 122
 	{
123
-		$gallery = $this->getValue( 'gallery', $value );
123
+		$gallery = $this->getValue('gallery', $value);
124 124
 
125
-		if( !is_numeric( $gallery ) && is_string( $gallery )) {
126
-			$gallery = intval( $this->postmeta->get( $gallery ));
125
+		if (!is_numeric($gallery) && is_string($gallery)) {
126
+			$gallery = intval($this->postmeta->get($gallery));
127 127
 		}
128
-		return !is_null( get_post( $gallery ))
129
-			? intval( $gallery )
128
+		return !is_null(get_post($gallery))
129
+			? intval($gallery)
130 130
 			: 0;
131 131
 	}
132 132
 
@@ -135,14 +135,14 @@  discard block
 block discarded – undo
135 135
 	 *
136 136
 	 * @return int
137 137
 	 */
138
-	protected function getImagesPerPageArg( $value = null )
138
+	protected function getImagesPerPageArg($value = null)
139 139
 	{
140
-		$perPage = $this->getValue( 'images_per_page', $value );
140
+		$perPage = $this->getValue('images_per_page', $value);
141 141
 
142
-		if( !is_numeric( $perPage ) && is_string( $perPage )) {
143
-			$perPage = $this->postmeta->get( $perPage );
142
+		if (!is_numeric($perPage) && is_string($perPage)) {
143
+			$perPage = $this->postmeta->get($perPage);
144 144
 		}
145
-		return !!intval( $perPage )
145
+		return !!intval($perPage)
146 146
 			? $perPage
147 147
 			: -1;
148 148
 	}
@@ -152,9 +152,9 @@  discard block
 block discarded – undo
152 152
 	 *
153 153
 	 * @return bool
154 154
 	 */
155
-	protected function getLazyloadArg( $value = null )
155
+	protected function getLazyloadArg($value = null)
156 156
 	{
157
-		return $this->getBoolValue( 'lazyload', $value );
157
+		return $this->getBoolValue('lazyload', $value);
158 158
 	}
159 159
 
160 160
 	/**
@@ -162,18 +162,18 @@  discard block
 block discarded – undo
162 162
 	 *
163 163
 	 * @return array
164 164
 	 */
165
-	protected function getMediaArg( $value = null )
165
+	protected function getMediaArg($value = null)
166 166
 	{
167
-		$media = $this->getValue( 'media', $value );
167
+		$media = $this->getValue('media', $value);
168 168
 
169
-		if( is_string( $media )) {
170
-			$media = $this->postmeta->get( $media, [
169
+		if (is_string($media)) {
170
+			$media = $this->postmeta->get($media, [
171 171
 				'ID'     => $this->getGalleryArg(),
172 172
 				'single' => false,
173 173
 			]);
174 174
 		}
175
-		return is_array( $media )
176
-			? wp_parse_id_list( $media )
175
+		return is_array($media)
176
+			? wp_parse_id_list($media)
177 177
 			: [];
178 178
 	}
179 179
 
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 	 */
183 183
 	protected function getPaged()
184 184
 	{
185
-		return intval( get_query_var(( is_front_page() ? 'page' : 'paged' ))) ?: 1;
185
+		return intval(get_query_var((is_front_page() ? 'page' : 'paged'))) ?: 1;
186 186
 	}
187 187
 
188 188
 	/**
@@ -190,9 +190,9 @@  discard block
 block discarded – undo
190 190
 	 *
191 191
 	 * @return bool
192 192
 	 */
193
-	protected function getPaginationArg( $value = null )
193
+	protected function getPaginationArg($value = null)
194 194
 	{
195
-		return $this->getBoolValue( 'pagination', $value );
195
+		return $this->getBoolValue('pagination', $value);
196 196
 	}
197 197
 
198 198
 	/**
@@ -200,17 +200,17 @@  discard block
 block discarded – undo
200 200
 	 *
201 201
 	 * @return bool
202 202
 	 */
203
-	protected function getPermalinksArg( $value = null )
203
+	protected function getPermalinksArg($value = null)
204 204
 	{
205
-		return $this->getBoolValue( 'permalinks', $value );
205
+		return $this->getBoolValue('permalinks', $value);
206 206
 	}
207 207
 
208 208
 	/**
209 209
 	 * @return string
210 210
 	 */
211
-	protected function getPhotoswipeData( $image )
211
+	protected function getPhotoswipeData($image)
212 212
 	{
213
-		return sprintf( '{"l":{"src":"%s","w":%d,"h":%d},"m":{"src":"%s","w":%d,"h":%d}}',
213
+		return sprintf('{"l":{"src":"%s","w":%d,"h":%d},"m":{"src":"%s","w":%d,"h":%d}}',
214 214
 			$image->large['url'],
215 215
 			$image->large['width'],
216 216
 			$image->large['height'],
@@ -226,9 +226,9 @@  discard block
 block discarded – undo
226 226
 	 *
227 227
 	 * @return mixed
228 228
 	 */
229
-	protected function getValue( $key, $value = null )
229
+	protected function getValue($key, $value = null)
230 230
 	{
231
-		if( is_null( $value ) && isset( $this->args[$key] )) {
231
+		if (is_null($value) && isset($this->args[$key])) {
232 232
 			$value = $this->args[$key];
233 233
 		}
234 234
 		return $value;
@@ -237,23 +237,23 @@  discard block
 block discarded – undo
237 237
 	/**
238 238
 	 * @return array
239 239
 	 */
240
-	protected function normalizeArgs( array $args = [] )
240
+	protected function normalizeArgs(array $args = [])
241 241
 	{
242 242
 		$defaults = [
243
-			'gallery',         // (string) meta_key | (int) post_id
244
-			'lazyload',        // (string) meta_key | (bool)
245
-			'media',           // (string) meta_key | (array) post_ids
246
-			'pagination',      // (string) meta_key | (bool)
243
+			'gallery', // (string) meta_key | (int) post_id
244
+			'lazyload', // (string) meta_key | (bool)
245
+			'media', // (string) meta_key | (array) post_ids
246
+			'pagination', // (string) meta_key | (bool)
247 247
 			'images_per_page', // (string) meta_key | (int) number
248
-			'permalinks',      // (string) meta_key | (bool)
248
+			'permalinks', // (string) meta_key | (bool)
249 249
 		];
250 250
 
251
-		$this->args = shortcode_atts( array_combine( $defaults, $defaults ), $args );
251
+		$this->args = shortcode_atts(array_combine($defaults, $defaults), $args);
252 252
 
253
-		array_walk( $this->args, function( &$value, $key ) {
254
-			$method = $this->utility->buildMethodName( $key . '_arg' );
255
-			if( method_exists( $this, $method )) {
256
-				$value = call_user_func([ $this, $method ], $value );
253
+		array_walk($this->args, function(&$value, $key) {
254
+			$method = $this->utility->buildMethodName($key . '_arg');
255
+			if (method_exists($this, $method)) {
256
+				$value = call_user_func([$this, $method], $value);
257 257
 			}
258 258
 		});
259 259
 
@@ -265,20 +265,20 @@  discard block
 block discarded – undo
265 265
 	 *
266 266
 	 * @return null|string
267 267
 	 */
268
-	protected function renderImageTag( $image )
268
+	protected function renderImageTag($image)
269 269
 	{
270 270
 		$imgSrc = $this->getLazyloadArg()
271
-			? $this->theme->imageUri( 'blank.gif' )
271
+			? $this->theme->imageUri('blank.gif')
272 272
 			: $image->thumbnail['url'];
273 273
 
274
-		$imgTag = sprintf( '<img src="%s" data-src="%s" itemprop="thumbnail" alt="%s"/>',
274
+		$imgTag = sprintf('<img src="%s" data-src="%s" itemprop="thumbnail" alt="%s"/>',
275 275
 			$imgSrc,
276 276
 			$image->thumbnail['url'],
277 277
 			$image->alt
278 278
 		);
279 279
 
280 280
 		return $this->getPermalinksArg()
281
-			? sprintf( '<a href="%s" itemprop="contentUrl">%s</a>', $image->permalink, $imgTag )
281
+			? sprintf('<a href="%s" itemprop="contentUrl">%s</a>', $image->permalink, $imgTag)
282 282
 			: $imgTag;
283 283
 	}
284 284
 }
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -65,7 +65,9 @@  discard block
 block discarded – undo
65 65
 	{
66 66
 		$image = $this->image->get( $attachment->ID )->image;
67 67
 
68
-		if( !$image )return;
68
+		if( !$image ) {
69
+			return;
70
+		}
69 71
 		return sprintf(
70 72
 			'<figure class="gallery-image" data-w="%s" data-h="%s" data-ps=\'%s\' itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject">' .
71 73
 				'%s<figcaption itemprop="caption description">' .
@@ -86,7 +88,9 @@  discard block
 block discarded – undo
86 88
 	 */
87 89
 	public function renderPagination()
88 90
 	{
89
-		if( !$this->args['pagination'] )return;
91
+		if( !$this->args['pagination'] ) {
92
+			return;
93
+		}
90 94
 		return paginate_links([
91 95
 			'before_page_number' => '<span class="screen-reader-text">' . __( 'Page', 'castor' ) . ' </span>',
92 96
 			'current'            => $this->gallery->query['paged'],
Please login to merge, or discard this patch.