Completed
Push — develop ( 4145c9...286694 )
by Paul
04:35
created
src/Application.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@
 block discarded – undo
76 76
 	}
77 77
 
78 78
 	/**
79
-	 * @return array
79
+	 * @return string[]
80 80
 	 */
81 81
 	protected function getTemplateTypes()
82 82
 	{
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -12,36 +12,36 @@  discard block
 block discarded – undo
12 12
 
13 13
 	public function __construct()
14 14
 	{
15
-		$this->assets = sprintf( '%s/assets/', dirname( __DIR__ ));
15
+		$this->assets = sprintf('%s/assets/', dirname(__DIR__));
16 16
 		Facade::clearResolvedInstances();
17
-		Facade::setFacadeApplication( $this );
17
+		Facade::setFacadeApplication($this);
18 18
 		$this->registerAliases();
19 19
 		$this->registerBindings();
20 20
 	}
21 21
 
22 22
 	public function init()
23 23
 	{
24
-		$controller = $this->make( 'Controller' );
24
+		$controller = $this->make('Controller');
25 25
 
26 26
 		// Action hooks
27
-		add_action( 'after_setup_theme',      [$controller, 'afterSetupTheme'], 20 );
28
-		add_action( 'login_head',             [$controller, 'loadAdminFavicon'] );
29
-		add_action( 'admin_head',             [$controller, 'loadAdminFavicon'] );
30
-		add_action( 'login_head',             [$controller, 'login'] );
31
-		add_action( 'admin_enqueue_scripts',  [$controller, 'registerAdminAssets'] );
32
-		add_action( 'wp_enqueue_scripts',     [$controller, 'registerAssets'] );
33
-		add_action( 'customize_register',     [$controller, 'registerCustomizer'] );
34
-		add_action( 'customize_preview_init', [$controller, 'registerCustomizerAssets'] );
35
-		add_action( 'widgets_init',           [$controller, 'registerSidebars'] );
27
+		add_action('after_setup_theme', [$controller, 'afterSetupTheme'], 20);
28
+		add_action('login_head', [$controller, 'loadAdminFavicon']);
29
+		add_action('admin_head', [$controller, 'loadAdminFavicon']);
30
+		add_action('login_head', [$controller, 'login']);
31
+		add_action('admin_enqueue_scripts', [$controller, 'registerAdminAssets']);
32
+		add_action('wp_enqueue_scripts', [$controller, 'registerAssets']);
33
+		add_action('customize_register', [$controller, 'registerCustomizer']);
34
+		add_action('customize_preview_init', [$controller, 'registerCustomizerAssets']);
35
+		add_action('widgets_init', [$controller, 'registerSidebars']);
36 36
 
37 37
 		// Filter hooks
38
-		add_filter( 'body_class',             [$controller, 'filterBodyClasses'] );
39
-		add_filter( 'template_include',       [$controller, 'filterTemplate'] );
40
-		add_filter( 'login_headertitle',      [$controller, 'filterLoginTitle'] );
41
-		add_filter( 'login_headerurl',        [$controller, 'filterLoginUrl'] );
38
+		add_filter('body_class', [$controller, 'filterBodyClasses']);
39
+		add_filter('template_include', [$controller, 'filterTemplate']);
40
+		add_filter('login_headertitle', [$controller, 'filterLoginTitle']);
41
+		add_filter('login_headerurl', [$controller, 'filterLoginUrl']);
42 42
 
43
-		foreach( $this->getTemplateTypes() as $type ) {
44
-			add_filter( "{$type}_template_hierarchy", [$controller, 'filterTemplateHierarchy'] );
43
+		foreach ($this->getTemplateTypes() as $type) {
44
+			add_filter("{$type}_template_hierarchy", [$controller, 'filterTemplateHierarchy']);
45 45
 		}
46 46
 	}
47 47
 
@@ -61,8 +61,8 @@  discard block
 block discarded – undo
61 61
 			'Theme'       => Facades\Theme::class,
62 62
 			'Utility'     => Facades\Utility::class,
63 63
 		];
64
-		$aliases = apply_filters( 'castor/register/aliases', $aliases );
65
-		AliasLoader::getInstance( $aliases )->register();
64
+		$aliases = apply_filters('castor/register/aliases', $aliases);
65
+		AliasLoader::getInstance($aliases)->register();
66 66
 	}
67 67
 
68 68
 	/**
@@ -70,8 +70,8 @@  discard block
 block discarded – undo
70 70
 	 */
71 71
 	public function registerBindings()
72 72
 	{
73
-		$this->bind( Helpers\Log::class, function( $app ) {
74
-			return new Helpers\Log( trailingslashit( get_stylesheet_directory() ).'castor-debug.log' );
73
+		$this->bind(Helpers\Log::class, function($app) {
74
+			return new Helpers\Log(trailingslashit(get_stylesheet_directory()) . 'castor-debug.log');
75 75
 		});
76 76
 	}
77 77
 
Please login to merge, or discard this patch.
src/Helpers/Log.php 3 patches
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,6 +18,9 @@  discard block
 block discarded – undo
18 18
 	protected $file;
19 19
 	protected $log;
20 20
 
21
+	/**
22
+	 * @param string $filename
23
+	 */
21 24
 	public function __construct( $filename )
22 25
 	{
23 26
 		$this->file = $filename;
@@ -170,7 +173,7 @@  discard block
 block discarded – undo
170 173
 	}
171 174
 
172 175
 	/**
173
-	 * @param mixed $level
176
+	 * @param string $level
174 177
 	 * @param string $message
175 178
 	 * @param array $context
176 179
 	 * @return void
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( $array, true ), ENT_QUOTES, 'UTF-8' );
153
+		if (is_array($message)) {
154
+			return htmlspecialchars(print_r($array, 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.
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.
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/Development.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -10,33 +10,33 @@  discard block
 block discarded – undo
10 10
 
11 11
 	protected $utility;
12 12
 
13
-	public function __construct( Utility $utility )
13
+	public function __construct(Utility $utility)
14 14
 	{
15
-		$this->utility  = $utility;
15
+		$this->utility = $utility;
16 16
 	}
17 17
 
18 18
 	public function capture()
19 19
 	{
20 20
 		ob_start();
21
-		call_user_func_array( [$this, 'printF'], func_get_args() );
21
+		call_user_func_array([$this, 'printF'], func_get_args());
22 22
 		return ob_get_clean();
23 23
 	}
24 24
 
25 25
 	public function className()
26 26
 	{
27
-		return $this->isDev() && in_array( DEV, ['css', true], true )
27
+		return $this->isDev() && in_array(DEV, ['css', true], true)
28 28
 			? 'dev'
29 29
 			: '';
30 30
 	}
31 31
 
32 32
 	public function debug()
33 33
 	{
34
-		call_user_func_array( [$this, 'printF'], func_get_args() );
34
+		call_user_func_array([$this, 'printF'], func_get_args());
35 35
 	}
36 36
 
37 37
 	public function isDev()
38 38
 	{
39
-		return defined( 'DEV' ) && !!DEV && WP_ENV == 'development';
39
+		return defined('DEV') && !!DEV && WP_ENV == 'development';
40 40
 	}
41 41
 
42 42
 	public function isProduction()
@@ -44,27 +44,27 @@  discard block
 block discarded – undo
44 44
 		return WP_ENV == 'production';
45 45
 	}
46 46
 
47
-	public function printFiltersFor( $hook = '' )
47
+	public function printFiltersFor($hook = '')
48 48
 	{
49 49
 		global $wp_filter;
50
-		if( empty( $hook ) || !isset( $wp_filter[$hook] ))return;
51
-		$this->printF( $wp_filter[ $hook ] );
50
+		if (empty($hook) || !isset($wp_filter[$hook]))return;
51
+		$this->printF($wp_filter[$hook]);
52 52
 	}
53 53
 
54 54
 	public function printTemplatePaths()
55 55
 	{
56
-		if( $this->isDev() && ( DEV == 'templates' || DEV === true )) {
57
-			$templates = array_map( function( $key, $value ) {
58
-				return sprintf( '[%s] => %s', $key, $value );
59
-			}, array_keys( $this->templatePaths ), $this->templatePaths );
60
-			$this->printF( implode( "\n", $templates ));
56
+		if ($this->isDev() && (DEV == 'templates' || DEV === true)) {
57
+			$templates = array_map(function($key, $value) {
58
+				return sprintf('[%s] => %s', $key, $value);
59
+			}, array_keys($this->templatePaths), $this->templatePaths);
60
+			$this->printF(implode("\n", $templates));
61 61
 		}
62 62
 	}
63 63
 
64
-	public function storeTemplatePath( $template )
64
+	public function storeTemplatePath($template)
65 65
 	{
66
-		if( is_string( $template )) {
67
-			$this->templatePaths[] = $this->utility->trimLeft( $template, trailingslashit( WP_CONTENT_DIR ));
66
+		if (is_string($template)) {
67
+			$this->templatePaths[] = $this->utility->trimLeft($template, trailingslashit(WP_CONTENT_DIR));
68 68
 		}
69 69
 	}
70 70
 
@@ -72,15 +72,15 @@  discard block
 block discarded – undo
72 72
 	{
73 73
 		$args = func_num_args();
74 74
 
75
-		if( $args == 1 ) {
76
-			printf( '<div class="print__r"><pre>%s</pre></div>',
77
-				htmlspecialchars( print_r( func_get_arg(0), true ), ENT_QUOTES, 'UTF-8' )
75
+		if ($args == 1) {
76
+			printf('<div class="print__r"><pre>%s</pre></div>',
77
+				htmlspecialchars(print_r(func_get_arg(0), true), ENT_QUOTES, 'UTF-8')
78 78
 			);
79 79
 		}
80
-		else if( $args > 1 ) {
80
+		else if ($args > 1) {
81 81
 			echo '<div class="print__r_group">';
82
-			foreach( func_get_args() as $value ) {
83
-				$this->printF( $value );
82
+			foreach (func_get_args() as $value) {
83
+				$this->printF($value);
84 84
 			}
85 85
 			echo '</div>';
86 86
 		}
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/Theme.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 	public $archiveMeta;
10 10
 	public $postMeta;
11 11
 
12
-	public function __construct( ArchiveMeta $archiveMeta, PostMeta $postMeta )
12
+	public function __construct(ArchiveMeta $archiveMeta, PostMeta $postMeta)
13 13
 	{
14 14
 		$this->archiveMeta = $archiveMeta;
15 15
 		$this->postMeta = $postMeta;
@@ -20,9 +20,9 @@  discard block
 block discarded – undo
20 20
 	 *
21 21
 	 * @return string
22 22
 	 */
23
-	public function assetPath( $asset )
23
+	public function assetPath($asset)
24 24
 	{
25
-		return $this->paths( 'dir.stylesheet' ) . 'assets/' . $asset;
25
+		return $this->paths('dir.stylesheet') . 'assets/' . $asset;
26 26
 	}
27 27
 
28 28
 	/**
@@ -30,9 +30,9 @@  discard block
 block discarded – undo
30 30
 	 *
31 31
 	 * @return string
32 32
 	 */
33
-	public function assetUri( $asset )
33
+	public function assetUri($asset)
34 34
 	{
35
-		return $this->paths( 'uri.stylesheet' ) . 'assets/' . $asset;
35
+		return $this->paths('uri.stylesheet') . 'assets/' . $asset;
36 36
 	}
37 37
 
38 38
 	/**
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	 */
41 41
 	public function copyright()
42 42
 	{
43
-		return __( 'Copyright', 'castor' ) . ' &copy; ' . date( 'Y' ) . ', ' . get_bloginfo( 'name' );
43
+		return __('Copyright', 'castor') . ' &copy; ' . date('Y') . ', ' . get_bloginfo('name');
44 44
 	}
45 45
 
46 46
 	/**
@@ -54,9 +54,9 @@  discard block
 block discarded – undo
54 54
 			is_single(),
55 55
 		];
56 56
 
57
-		$display = in_array( true, $conditions );
57
+		$display = in_array(true, $conditions);
58 58
 
59
-		return apply_filters( 'castor/display/sidebar', $display );
59
+		return apply_filters('castor/display/sidebar', $display);
60 60
 	}
61 61
 
62 62
 	/**
@@ -64,9 +64,9 @@  discard block
 block discarded – undo
64 64
 	 *
65 65
 	 * @return string
66 66
 	 */
67
-	public function imagePath( $asset )
67
+	public function imagePath($asset)
68 68
 	{
69
-		return $this->paths( 'dir.stylesheet' ) . 'assets/img/' . $asset;
69
+		return $this->paths('dir.stylesheet') . 'assets/img/' . $asset;
70 70
 	}
71 71
 
72 72
 	/**
@@ -74,16 +74,16 @@  discard block
 block discarded – undo
74 74
 	 *
75 75
 	 * @return string
76 76
 	 */
77
-	public function imageUri( $asset )
77
+	public function imageUri($asset)
78 78
 	{
79
-		return $this->paths( 'uri.stylesheet' ) . 'assets/img/' . $asset;
79
+		return $this->paths('uri.stylesheet') . 'assets/img/' . $asset;
80 80
 	}
81 81
 
82 82
 	public function pageTitle()
83 83
 	{
84
-		foreach( ['is_404', 'is_archive', 'is_home', 'is_page', 'is_search'] as $bool ) {
85
-			if( !$bool() )continue;
86
-			$method = sprintf( 'get%sTitle', ucfirst( str_replace( 'is_', '', $bool )));
84
+		foreach (['is_404', 'is_archive', 'is_home', 'is_page', 'is_search'] as $bool) {
85
+			if (!$bool())continue;
86
+			$method = sprintf('get%sTitle', ucfirst(str_replace('is_', '', $bool)));
87 87
 			return $this->$method();
88 88
 		}
89 89
 
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	 *
96 96
 	 * @return array|string
97 97
 	 */
98
-	public function paths( $path = null )
98
+	public function paths($path = null)
99 99
 	{
100 100
 		$paths = [
101 101
 			'dir.stylesheet' => get_stylesheet_directory(),
@@ -105,12 +105,12 @@  discard block
 block discarded – undo
105 105
 			'uri.template'   => get_template_directory_uri(),
106 106
 		];
107 107
 
108
-		if( is_null( $path )) {
108
+		if (is_null($path)) {
109 109
 			return $paths;
110 110
 		}
111 111
 
112
-		return array_key_exists( $path, $paths )
113
-			? trailingslashit( $paths[$path] )
112
+		return array_key_exists($path, $paths)
113
+			? trailingslashit($paths[$path])
114 114
 			: '';
115 115
 	}
116 116
 
@@ -119,39 +119,39 @@  discard block
 block discarded – undo
119 119
 	 *
120 120
 	 * @return string|null
121 121
 	 */
122
-	public function svg( $path = null )
122
+	public function svg($path = null)
123 123
 	{
124
-		if( file_exists( $this->imagePath( $path ))) {
125
-			return file_get_contents( $this->imagePath( $path ));
124
+		if (file_exists($this->imagePath($path))) {
125
+			return file_get_contents($this->imagePath($path));
126 126
 		}
127 127
 	}
128 128
 
129 129
 	protected function get404Title()
130 130
 	{
131
-		return __( 'Not Found', 'castor' );
131
+		return __('Not Found', 'castor');
132 132
 	}
133 133
 
134 134
 	protected function getArchiveTitle()
135 135
 	{
136
-		return $this->archiveMeta->get( 'title', get_the_archive_title(), get_query_var( 'post_type' ));
136
+		return $this->archiveMeta->get('title', get_the_archive_title(), get_query_var('post_type'));
137 137
 	}
138 138
 
139 139
 	protected function getHomeTitle()
140 140
 	{
141
-		return ( $home = get_option( 'page_for_posts', true ))
142
-			? get_the_title( $home )
143
-			: __( 'Latest Posts', 'castor' );
141
+		return ($home = get_option('page_for_posts', true))
142
+			? get_the_title($home)
143
+			: __('Latest Posts', 'castor');
144 144
 	}
145 145
 
146 146
 	protected function getPageTitle()
147 147
 	{
148
-		return $this->postMeta->get( 'title', [
148
+		return $this->postMeta->get('title', [
149 149
 			'fallback' => get_the_title(),
150 150
 		]);
151 151
 	}
152 152
 
153 153
 	protected function getSearchTitle()
154 154
 	{
155
-		return sprintf( __( 'Search Results for %s', 'castor' ), get_search_query() );
155
+		return sprintf(__('Search Results for %s', 'castor'), get_search_query());
156 156
 	}
157 157
 }
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.
src/Helpers/Utility.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -7,22 +7,22 @@  discard block
 block discarded – undo
7 7
 	/**
8 8
 	 * @return string
9 9
 	 */
10
-	public function buildAttributes( array $atts = [] )
10
+	public function buildAttributes(array $atts = [])
11 11
 	{
12 12
 		$attributes = [];
13
-		foreach( $atts as $key => $value ) {
14
-			$attributes[] = sprintf( '%s="%s"', $key, $value );
13
+		foreach ($atts as $key => $value) {
14
+			$attributes[] = sprintf('%s="%s"', $key, $value);
15 15
 		}
16
-		return implode( ' ', $attributes );
16
+		return implode(' ', $attributes);
17 17
 	}
18 18
 
19 19
 	/**
20 20
 	 * @return string
21 21
 	 */
22
-	public function buildAttributesFor( $tag, array $atts = [] )
22
+	public function buildAttributesFor($tag, array $atts = [])
23 23
 	{
24 24
 		return $this->buildAttributes(
25
-			wp_parse_args( $atts, apply_filters( "castor/render/$tag/attributes", [] ))
25
+			wp_parse_args($atts, apply_filters("castor/render/$tag/attributes", []))
26 26
 		);
27 27
 	}
28 28
 
@@ -32,13 +32,13 @@  discard block
 block discarded – undo
32 32
 	 *
33 33
 	 * @return string
34 34
 	 */
35
-	public function buildClassName( $name, $path = '' )
35
+	public function buildClassName($name, $path = '')
36 36
 	{
37
-		$className = array_map( 'ucfirst', array_map( 'strtolower', preg_split( '/[-_]/', $name )));
38
-		$className = implode( '', $className );
37
+		$className = array_map('ucfirst', array_map('strtolower', preg_split('/[-_]/', $name)));
38
+		$className = implode('', $className);
39 39
 
40
-		return !empty( $path )
41
-			? str_replace( '\\\\', '\\', sprintf( '%s\%s', $path, $className ))
40
+		return !empty($path)
41
+			? str_replace('\\\\', '\\', sprintf('%s\%s', $path, $className))
42 42
 			: $className;
43 43
 	}
44 44
 
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
 	 *
49 49
 	 * @return string
50 50
 	 */
51
-	public function buildMethodName( $name, $prefix = 'get' )
51
+	public function buildMethodName($name, $prefix = 'get')
52 52
 	{
53
-		return lcfirst( $this->buildClassName( $prefix . '-' . $name ));
53
+		return lcfirst($this->buildClassName($prefix . '-' . $name));
54 54
 	}
55 55
 
56 56
 	/**
@@ -59,9 +59,9 @@  discard block
 block discarded – undo
59 59
 	 *
60 60
 	 * @return bool
61 61
 	 */
62
-	public function contains( $needle, $haystack )
62
+	public function contains($needle, $haystack)
63 63
 	{
64
-		strpos( $haystack, $needle ) !== false;
64
+		strpos($haystack, $needle) !== false;
65 65
 	}
66 66
 
67 67
 	/**
@@ -71,9 +71,9 @@  discard block
 block discarded – undo
71 71
 	 *
72 72
 	 * @return string
73 73
 	 */
74
-	public function endWith( $suffix, $string, $unique = true )
74
+	public function endWith($suffix, $string, $unique = true)
75 75
 	{
76
-		return $unique && $this->endsWith( $suffix, $string )
76
+		return $unique && $this->endsWith($suffix, $string)
77 77
 			? $string
78 78
 			: $string . $suffix;
79 79
 	}
@@ -84,11 +84,11 @@  discard block
 block discarded – undo
84 84
 	 *
85 85
 	 * @return string
86 86
 	 */
87
-	public function endsWith( $needle, $haystack )
87
+	public function endsWith($needle, $haystack)
88 88
 	{
89
-		$length = strlen( $needle );
89
+		$length = strlen($needle);
90 90
 		return $length != 0
91
-			? substr( $haystack, -$length ) === $needle
91
+			? substr($haystack, -$length) === $needle
92 92
 			: true;
93 93
 	}
94 94
 
@@ -98,12 +98,12 @@  discard block
 block discarded – undo
98 98
 	 *
99 99
 	 * @return void
100 100
 	 */
101
-	public function printTag( $tag, $value, array $attributes = [] )
101
+	public function printTag($tag, $value, array $attributes = [])
102 102
 	{
103
-		$attributes = $this->buildAttributesFor( $tag, $attributes );
103
+		$attributes = $this->buildAttributesFor($tag, $attributes);
104 104
 
105
-		printf( '<%s>%s</%s>',
106
-			rtrim( sprintf( '%s %s', $tag, $attributes )),
105
+		printf('<%s>%s</%s>',
106
+			rtrim(sprintf('%s %s', $tag, $attributes)),
107 107
 			$value,
108 108
 			$tag
109 109
 		);
@@ -116,9 +116,9 @@  discard block
 block discarded – undo
116 116
 	 *
117 117
 	 * @return string
118 118
 	 */
119
-	public function startWith( $prefix, $string, $unique = true )
119
+	public function startWith($prefix, $string, $unique = true)
120 120
 	{
121
-		return $unique && $this->startsWith( $prefix, $string )
121
+		return $unique && $this->startsWith($prefix, $string)
122 122
 			? $string
123 123
 			: $prefix . $string;
124 124
 	}
@@ -129,9 +129,9 @@  discard block
 block discarded – undo
129 129
 	 *
130 130
 	 * @return string
131 131
 	 */
132
-	public function startsWith( $needle, $haystack )
132
+	public function startsWith($needle, $haystack)
133 133
 	{
134
-		return substr( $haystack, 0, strlen( $needle )) === $needle;
134
+		return substr($haystack, 0, strlen($needle)) === $needle;
135 135
 	}
136 136
 
137 137
 	/**
@@ -139,12 +139,12 @@  discard block
 block discarded – undo
139 139
 	 *
140 140
 	 * @return array
141 141
 	 */
142
-	public function toArray( $value )
142
+	public function toArray($value)
143 143
 	{
144
-		if( is_string( $value )) {
145
-			$value = trim( $value );
144
+		if (is_string($value)) {
145
+			$value = trim($value);
146 146
 		}
147
-		return array_filter((array) $value );
147
+		return array_filter((array) $value);
148 148
 	}
149 149
 
150 150
 	/**
@@ -154,11 +154,11 @@  discard block
 block discarded – undo
154 154
 	 *
155 155
 	 * @return string
156 156
 	 */
157
-	public function trimLeft( $string, $needle, $caseSensitive = true )
157
+	public function trimLeft($string, $needle, $caseSensitive = true)
158 158
 	{
159 159
 		$strPos = $caseSensitive ? "strpos" : "stripos";
160
-		if( $strPos( $string, $needle ) === 0 ) {
161
-			$string = substr( $string, strlen( $needle ));
160
+		if ($strPos($string, $needle) === 0) {
161
+			$string = substr($string, strlen($needle));
162 162
 		}
163 163
 		return $string;
164 164
 	}
@@ -170,11 +170,11 @@  discard block
 block discarded – undo
170 170
 	 *
171 171
 	 * @return string
172 172
 	 */
173
-	public function trimRight( $string, $needle, $caseSensitive = true )
173
+	public function trimRight($string, $needle, $caseSensitive = true)
174 174
 	{
175 175
 		$strPos = $caseSensitive ? "strpos" : "stripos";
176
-		if( $strPos( $string, $needle, strlen( $string ) - strlen( $needle )) !== false ) {
177
-			$string = substr( $string, 0, -strlen( $needle ));
176
+		if ($strPos($string, $needle, strlen($string) - strlen($needle)) !== false) {
177
+			$string = substr($string, 0, -strlen($needle));
178 178
 		}
179 179
 		return $string;
180 180
 	}
Please login to merge, or discard this patch.