Completed
Push — develop ( 4145c9...286694 )
by Paul
04:35
created
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.
src/Controller.php 1 patch
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -16,24 +16,24 @@  discard block
 block discarded – undo
16 16
 	 */
17 17
 	public function afterSetupTheme()
18 18
 	{
19
-		add_editor_style( Theme::assetUri( 'css/editor.css' ));
20
-		add_theme_support( 'customize-selective-refresh-widgets' );
21
-		add_theme_support( 'html5', ['caption', 'comment-form', 'comment-list', 'gallery', 'search-form'] );
22
-		add_theme_support( 'post-thumbnails' );
23
-		add_theme_support( 'soil-clean-up' );
24
-		add_theme_support( 'soil-jquery-cdn' );
25
-		add_theme_support( 'soil-nav-walker' );
26
-		add_theme_support( 'soil-nice-search' );
27
-		add_theme_support( 'soil-relative-urls' );
28
-		add_theme_support( 'title-tag' );
29
-		load_theme_textdomain( 'castor', Theme::paths( 'dir.template' ) . '/languages' );
30
-
31
-		$menus = apply_filters( 'castor/register/nav_menus', [
32
-			'main_menu' => __( 'Main Menu', 'castor' ),
19
+		add_editor_style(Theme::assetUri('css/editor.css'));
20
+		add_theme_support('customize-selective-refresh-widgets');
21
+		add_theme_support('html5', ['caption', 'comment-form', 'comment-list', 'gallery', 'search-form']);
22
+		add_theme_support('post-thumbnails');
23
+		add_theme_support('soil-clean-up');
24
+		add_theme_support('soil-jquery-cdn');
25
+		add_theme_support('soil-nav-walker');
26
+		add_theme_support('soil-nice-search');
27
+		add_theme_support('soil-relative-urls');
28
+		add_theme_support('title-tag');
29
+		load_theme_textdomain('castor', Theme::paths('dir.template') . '/languages');
30
+
31
+		$menus = apply_filters('castor/register/nav_menus', [
32
+			'main_menu' => __('Main Menu', 'castor'),
33 33
 		]);
34 34
 
35
-		foreach( $menus as $location => $description ) {
36
-			register_nav_menu( $location, $description );
35
+		foreach ($menus as $location => $description) {
36
+			register_nav_menu($location, $description);
37 37
 		}
38 38
 	}
39 39
 
@@ -41,12 +41,12 @@  discard block
 block discarded – undo
41 41
 	 * @return array
42 42
 	 * @filter body_class
43 43
 	 */
44
-	public function filterBodyClasses( array $classes )
44
+	public function filterBodyClasses(array $classes)
45 45
 	{
46
-		if( Theme::displaySidebar() ) {
46
+		if (Theme::displaySidebar()) {
47 47
 			$classes[] = 'has-sidebar';
48 48
 		}
49
-		return array_keys( array_flip( $classes ));
49
+		return array_keys(array_flip($classes));
50 50
 	}
51 51
 
52 52
 	/**
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	 */
56 56
 	public function filterLoginTitle()
57 57
 	{
58
-		return get_bloginfo( 'name' );
58
+		return get_bloginfo('name');
59 59
 	}
60 60
 
61 61
 	/**
@@ -64,18 +64,18 @@  discard block
 block discarded – undo
64 64
 	 */
65 65
 	public function filterLoginUrl()
66 66
 	{
67
-		return get_bloginfo( 'url' );
67
+		return get_bloginfo('url');
68 68
 	}
69 69
 
70 70
 	/**
71 71
 	 * @return string
72 72
 	 * @filter template_include
73 73
 	 */
74
-	public function filterTemplate( $template )
74
+	public function filterTemplate($template)
75 75
 	{
76
-		if( is_string( $template )) {
77
-			$template = Template::setLayout( $template );
78
-			Development::storeTemplatePath( $template );
76
+		if (is_string($template)) {
77
+			$template = Template::setLayout($template);
78
+			Development::storeTemplatePath($template);
79 79
 		}
80 80
 		return $template;
81 81
 	}
@@ -84,11 +84,11 @@  discard block
 block discarded – undo
84 84
 	 * @return array
85 85
 	 * @filter {$type}_template_hierarchy
86 86
 	 */
87
-	public function filterTemplateHierarchy( array $templates )
87
+	public function filterTemplateHierarchy(array $templates)
88 88
 	{
89
-		return array_map( function( $template ) {
90
-			return Utility::startWith( 'templates/', $template );
91
-		}, $templates );
89
+		return array_map(function($template) {
90
+			return Utility::startWith('templates/', $template);
91
+		}, $templates);
92 92
 	}
93 93
 
94 94
 	/**
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
 	 */
99 99
 	public function loadAdminFavicon()
100 100
 	{
101
-		if( file_exists( Theme::assetPath( 'favicon/favicon-admin.ico' ))) {
102
-			printf( '<link rel="shortcut icon" href="%s">', Theme::assetUri( 'favicon/favicon-admin.ico' ));
101
+		if (file_exists(Theme::assetPath('favicon/favicon-admin.ico'))) {
102
+			printf('<link rel="shortcut icon" href="%s">', Theme::assetUri('favicon/favicon-admin.ico'));
103 103
 		}
104 104
 	}
105 105
 
@@ -109,8 +109,8 @@  discard block
 block discarded – undo
109 109
 	 */
110 110
 	public function login()
111 111
 	{
112
-		if( file_exists( Theme::assetPath( 'css/login.css' ))) {
113
-			printf( '<link rel="stylesheet" href="%s">', Theme::assetUri( 'css/login.css' ));
112
+		if (file_exists(Theme::assetPath('css/login.css'))) {
113
+			printf('<link rel="stylesheet" href="%s">', Theme::assetUri('css/login.css'));
114 114
 		}
115 115
 	}
116 116
 
@@ -120,17 +120,17 @@  discard block
 block discarded – undo
120 120
 	 */
121 121
 	public function registerAdminAssets()
122 122
 	{
123
-		if( file_exists( Theme::assetPath( 'css/admin.css' ))) {
124
-			wp_enqueue_style( 'castor/admin.css',
125
-				Theme::assetUri( 'css/admin.css' ),
126
-				apply_filters( 'castor/enqueue/admin/css/deps', [] ),
123
+		if (file_exists(Theme::assetPath('css/admin.css'))) {
124
+			wp_enqueue_style('castor/admin.css',
125
+				Theme::assetUri('css/admin.css'),
126
+				apply_filters('castor/enqueue/admin/css/deps', []),
127 127
 				null
128 128
 			);
129 129
 		}
130
-		if( file_exists( Theme::assetPath( 'css/admin.js' ))) {
131
-			wp_enqueue_script( 'castor/admin.js',
132
-				Theme::assetUri( 'js/admin.js' ),
133
-				apply_filters( 'castor/enqueue/admin/js/deps', [] ),
130
+		if (file_exists(Theme::assetPath('css/admin.js'))) {
131
+			wp_enqueue_script('castor/admin.js',
132
+				Theme::assetUri('js/admin.js'),
133
+				apply_filters('castor/enqueue/admin/js/deps', []),
134 134
 				null,
135 135
 				true
136 136
 			);
@@ -143,20 +143,20 @@  discard block
 block discarded – undo
143 143
 	 */
144 144
 	public function registerAssets()
145 145
 	{
146
-		wp_enqueue_style( 'castor/main.css',
147
-			Theme::assetUri( 'css/main.css' ),
148
-			apply_filters( 'castor/enqueue/css/deps', [] ),
146
+		wp_enqueue_style('castor/main.css',
147
+			Theme::assetUri('css/main.css'),
148
+			apply_filters('castor/enqueue/css/deps', []),
149 149
 			null
150 150
 		);
151
-		wp_enqueue_script( 'castor/main.js',
152
-			Theme::assetUri( 'js/main.js' ),
153
-			apply_filters( 'castor/enqueue/js/deps', [] ),
151
+		wp_enqueue_script('castor/main.js',
152
+			Theme::assetUri('js/main.js'),
153
+			apply_filters('castor/enqueue/js/deps', []),
154 154
 			null,
155 155
 			true
156 156
 		);
157
-		wp_localize_script( 'castor/main.js', apply_filters( 'castor/enqueue/js/localize/variable', 'globals' ),
158
-			apply_filters( 'castor/enqueue/js/localize/variables', [
159
-				'ajax' => admin_url( 'admin-ajax.php' ),
157
+		wp_localize_script('castor/main.js', apply_filters('castor/enqueue/js/localize/variable', 'globals'),
158
+			apply_filters('castor/enqueue/js/localize/variables', [
159
+				'ajax' => admin_url('admin-ajax.php'),
160 160
 			])
161 161
 		);
162 162
 	}
@@ -165,13 +165,13 @@  discard block
 block discarded – undo
165 165
 	 * @return void
166 166
 	 * @action customize_register
167 167
 	 */
168
-	public function registerCustomizer( WP_Customize_Manager $manager )
168
+	public function registerCustomizer(WP_Customize_Manager $manager)
169 169
 	{
170
-		$manager->get_setting( 'blogname' )->transport = 'postMessage';
171
-		$manager->selective_refresh->add_partial( 'blogname', [
170
+		$manager->get_setting('blogname')->transport = 'postMessage';
171
+		$manager->selective_refresh->add_partial('blogname', [
172 172
 			'selector'        => '.brand',
173 173
 			'render_callback' => function() {
174
-				bloginfo( 'name' );
174
+				bloginfo('name');
175 175
 			},
176 176
 		]);
177 177
 	}
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 	 */
183 183
 	public function registerCustomizerAssets()
184 184
 	{
185
-		wp_enqueue_script( 'castor/customizer.js', Theme::assetUri( 'js/customizer.js' ), ['customize-preview'], null, true );
185
+		wp_enqueue_script('castor/customizer.js', Theme::assetUri('js/customizer.js'), ['customize-preview'], null, true);
186 186
 	}
187 187
 
188 188
 	/**
@@ -191,23 +191,23 @@  discard block
 block discarded – undo
191 191
 	 */
192 192
 	public function registerSidebars()
193 193
 	{
194
-		$defaults = apply_filters( 'castor/register/sidebars/defaults', [
194
+		$defaults = apply_filters('castor/register/sidebars/defaults', [
195 195
 			'before_widget' => '<div class="widget %1$s %2$s">',
196 196
 			'after_widget'  => '</div>',
197 197
 			'before_title'  => '<h4>',
198 198
 			'after_title'   => '</h4>',
199 199
 		]);
200 200
 
201
-		$sidebars = apply_filters( 'castor/register/sidebars', [
202
-			'sidebar-primary' => __( 'Primary Sidebar', 'castor' ),
203
-			'sidebar-footer'  => __( 'Footer Widgets', 'castor' ),
201
+		$sidebars = apply_filters('castor/register/sidebars', [
202
+			'sidebar-primary' => __('Primary Sidebar', 'castor'),
203
+			'sidebar-footer'  => __('Footer Widgets', 'castor'),
204 204
 		]);
205 205
 
206
-		foreach( $sidebars as $id => $name ) {
206
+		foreach ($sidebars as $id => $name) {
207 207
 			register_sidebar([
208 208
 				'id'   => $id,
209 209
 				'name' => $name,
210
-			] + $defaults );
210
+			] + $defaults);
211 211
 		}
212 212
 	}
213 213
 }
Please login to merge, or discard this patch.
src/Facades/Log.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 Log 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\Log::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\Log::class;
17
+	}
18 18
 }
Please login to merge, or discard this patch.