Completed
Branch master (344633)
by Paul
02:17
created
src/Helpers/Development.php 2 patches
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -9,25 +9,25 @@  discard block
 block discarded – undo
9 9
 	public function capture()
10 10
 	{
11 11
 		ob_start();
12
-		call_user_func_array( [$this, 'print'], func_get_args() );
12
+		call_user_func_array([$this, 'print'], func_get_args());
13 13
 		return ob_get_clean();
14 14
 	}
15 15
 
16 16
 	public function className()
17 17
 	{
18
-		return $this->isDev() && in_array( DEV, ['css', true] )
18
+		return $this->isDev() && in_array(DEV, ['css', true])
19 19
 			? 'dev'
20 20
 			: '';
21 21
 	}
22 22
 
23
-	public function debug( $value )
23
+	public function debug($value)
24 24
 	{
25
-		$this->print( $value );
25
+		$this->print($value);
26 26
 	}
27 27
 
28 28
 	public function isDev()
29 29
 	{
30
-		return defined( 'DEV' ) && !!DEV && WP_ENV == 'development';
30
+		return defined('DEV') && !!DEV && WP_ENV == 'development';
31 31
 	}
32 32
 
33 33
 	public function isProduction()
@@ -35,48 +35,48 @@  discard block
 block discarded – undo
35 35
 		return WP_ENV == 'production';
36 36
 	}
37 37
 
38
-	public function print( $value )
38
+	public function print($value)
39 39
 	{
40 40
 		$args = func_num_args();
41 41
 
42
-		if( $args == 1 ) {
43
-			printf( '<div class="print__r"><pre>%s</pre></div>',
44
-				htmlspecialchars( print_r( $value, true ), ENT_QUOTES, 'UTF-8' )
42
+		if ($args == 1) {
43
+			printf('<div class="print__r"><pre>%s</pre></div>',
44
+				htmlspecialchars(print_r($value, true), ENT_QUOTES, 'UTF-8')
45 45
 			);
46 46
 		}
47
-		else if( $args > 1 ) {
47
+		else if ($args > 1) {
48 48
 			echo '<div class="print__r_group">';
49
-			foreach( func_get_args() as $param ) {
50
-				$this->print( $param );
49
+			foreach (func_get_args() as $param) {
50
+				$this->print($param);
51 51
 			}
52 52
 			echo '</div>';
53 53
 		}
54 54
 	}
55 55
 
56
-	public function printFiltersFor( $hook = '' )
56
+	public function printFiltersFor($hook = '')
57 57
 	{
58 58
 		global $wp_filter;
59
-		if( empty( $hook ) || !isset( $wp_filter[$hook] ))return;
60
-		$this->print( $wp_filter[ $hook ] );
59
+		if (empty($hook) || !isset($wp_filter[$hook]))return;
60
+		$this->print($wp_filter[$hook]);
61 61
 	}
62 62
 
63 63
 	public function printTemplatePaths()
64 64
 	{
65
-		if( $this->isDev() && ( DEV == 'templates' || DEV === true )) {
66
-			$templates = array_keys( array_flip( $this->templatePaths ));
67
-			$templates = array_map( function( $key, $value ) {
68
-				return sprintf( '[%s] => %s', $key, $value );
69
-			}, array_keys( $templates ), $templates );
65
+		if ($this->isDev() && (DEV == 'templates' || DEV === true)) {
66
+			$templates = array_keys(array_flip($this->templatePaths));
67
+			$templates = array_map(function($key, $value) {
68
+				return sprintf('[%s] => %s', $key, $value);
69
+			}, array_keys($templates), $templates);
70 70
 
71
-			$this->print( implode( "\n", $templates ));
71
+			$this->print(implode("\n", $templates));
72 72
 		}
73 73
 	}
74 74
 
75
-	public function storeTemplatePath( $template )
75
+	public function storeTemplatePath($template)
76 76
 	{
77
-		if( is_string( $template )) {
78
-			$themeName = basename( strstr( $template, '/templates/', true ));
79
-			$this->templatePaths[] = $themeName . strstr( $template, '/templates/' );
77
+		if (is_string($template)) {
78
+			$themeName = basename(strstr($template, '/templates/', true));
79
+			$this->templatePaths[] = $themeName . strstr($template, '/templates/');
80 80
 		}
81 81
 	}
82 82
 }
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -43,8 +43,7 @@  discard block
 block discarded – undo
43 43
 			printf( '<div class="print__r"><pre>%s</pre></div>',
44 44
 				htmlspecialchars( print_r( $value, true ), ENT_QUOTES, 'UTF-8' )
45 45
 			);
46
-		}
47
-		else if( $args > 1 ) {
46
+		} else if( $args > 1 ) {
48 47
 			echo '<div class="print__r_group">';
49 48
 			foreach( func_get_args() as $param ) {
50 49
 				$this->print( $param );
@@ -56,7 +55,9 @@  discard block
 block discarded – undo
56 55
 	public function printFiltersFor( $hook = '' )
57 56
 	{
58 57
 		global $wp_filter;
59
-		if( empty( $hook ) || !isset( $wp_filter[$hook] ))return;
58
+		if( empty( $hook ) || !isset( $wp_filter[$hook] )) {
59
+			return;
60
+		}
60 61
 		$this->print( $wp_filter[ $hook ] );
61 62
 	}
62 63
 
Please login to merge, or discard this patch.
src/Controller.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -12,29 +12,29 @@  discard block
 block discarded – undo
12 12
 {
13 13
 	public function afterSetupTheme()
14 14
 	{
15
-		add_theme_support( 'customize-selective-refresh-widgets' );
16
-		add_theme_support( 'html5', ['caption', 'comment-form', 'comment-list', 'gallery', 'search-form'] );
17
-		add_theme_support( 'post-thumbnails' );
18
-		add_theme_support( 'soil-clean-up' );
19
-		add_theme_support( 'soil-jquery-cdn' );
20
-		add_theme_support( 'soil-nav-walker' );
21
-		add_theme_support( 'soil-nice-search' );
22
-		add_theme_support( 'soil-relative-urls' );
23
-		add_theme_support( 'title-tag' );
24
-		add_editor_style( Theme::assetUri( 'css/editor.css' ));
25
-		load_theme_textdomain( 'castor', Theme::paths( 'dir.template' ) . '/languages' );
26
-		register_nav_menu( 'main_menu', __( 'Main Menu', 'castor' ));
15
+		add_theme_support('customize-selective-refresh-widgets');
16
+		add_theme_support('html5', ['caption', 'comment-form', 'comment-list', 'gallery', 'search-form']);
17
+		add_theme_support('post-thumbnails');
18
+		add_theme_support('soil-clean-up');
19
+		add_theme_support('soil-jquery-cdn');
20
+		add_theme_support('soil-nav-walker');
21
+		add_theme_support('soil-nice-search');
22
+		add_theme_support('soil-relative-urls');
23
+		add_theme_support('title-tag');
24
+		add_editor_style(Theme::assetUri('css/editor.css'));
25
+		load_theme_textdomain('castor', Theme::paths('dir.template') . '/languages');
26
+		register_nav_menu('main_menu', __('Main Menu', 'castor'));
27 27
 	}
28 28
 
29 29
 	/**
30 30
 	 * @return string
31 31
 	 * @filter template_include
32 32
 	 */
33
-	public function filterTemplate( $template )
33
+	public function filterTemplate($template)
34 34
 	{
35
-		if( is_string( $template )) {
36
-			$template = Template::setLayout( $template );
37
-			Development::storeTemplatePath( $template );
35
+		if (is_string($template)) {
36
+			$template = Template::setLayout($template);
37
+			Development::storeTemplatePath($template);
38 38
 		}
39 39
 		return $template;
40 40
 	}
@@ -43,33 +43,33 @@  discard block
 block discarded – undo
43 43
 	 * @return array
44 44
 	 * @filter {$type}_template_hierarchy
45 45
 	 */
46
-	public function filterTemplateHierarchy( array $templates )
46
+	public function filterTemplateHierarchy(array $templates)
47 47
 	{
48
-		return array_map( function( $template ) {
49
-			return Utility::startWith( 'templates/', $template );
50
-		}, $templates );
48
+		return array_map(function($template) {
49
+			return Utility::startWith('templates/', $template);
50
+		}, $templates);
51 51
 	}
52 52
 
53 53
 	public function registerAssets()
54 54
 	{
55
-		wp_enqueue_style( 'castor/main.css', Theme::assetUri( 'css/main.css' ), [], null );
56
-		wp_enqueue_script( 'castor/main.js', Theme::assetUri( 'js/main.js' ), [], null, true );
55
+		wp_enqueue_style('castor/main.css', Theme::assetUri('css/main.css'), [], null);
56
+		wp_enqueue_script('castor/main.js', Theme::assetUri('js/main.js'), [], null, true);
57 57
 	}
58 58
 
59
-	public function registerCustomizer( WP_Customize_Manager $manager )
59
+	public function registerCustomizer(WP_Customize_Manager $manager)
60 60
 	{
61
-		$manager->get_setting( 'blogname' )->transport = 'postMessage';
62
-		$manager->selective_refresh->add_partial( 'blogname', [
61
+		$manager->get_setting('blogname')->transport = 'postMessage';
62
+		$manager->selective_refresh->add_partial('blogname', [
63 63
 			'selector'        => '.brand',
64 64
 			'render_callback' => function() {
65
-				bloginfo( 'name' );
65
+				bloginfo('name');
66 66
 			},
67 67
 		]);
68 68
 	}
69 69
 
70 70
 	public function registerCustomizerAssets()
71 71
 	{
72
-		wp_enqueue_script( 'castor/customizer.js', Theme::assetUri( 'js/customizer.js' ), ['customize-preview'], null, true );
72
+		wp_enqueue_script('castor/customizer.js', Theme::assetUri('js/customizer.js'), ['customize-preview'], null, true);
73 73
 	}
74 74
 
75 75
 	public function registerSidebars()
@@ -83,12 +83,12 @@  discard block
 block discarded – undo
83 83
 
84 84
 		register_sidebar([
85 85
 			'id'   => 'sidebar-primary',
86
-			'name' => __( 'Primary Sidebar', 'castor' ),
87
-		] + $defaults );
86
+			'name' => __('Primary Sidebar', 'castor'),
87
+		] + $defaults);
88 88
 
89 89
 		register_sidebar([
90 90
 			'id'   => 'sidebar-footer',
91
-			'name' => __( 'Footer Sidebar', 'castor' ),
92
-		] + $defaults );
91
+			'name' => __('Footer Sidebar', 'castor'),
92
+		] + $defaults);
93 93
 	}
94 94
 }
Please login to merge, or discard this patch.
src/AliasLoader.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	 */
26 26
 	protected $registered = false;
27 27
 
28
-	private function __construct( array $aliases )
28
+	private function __construct(array $aliases)
29 29
 	{
30 30
 		$this->aliases = $aliases;
31 31
 	}
@@ -38,13 +38,13 @@  discard block
 block discarded – undo
38 38
 	 *
39 39
 	 * @return AliasLoader
40 40
 	 */
41
-	public static function getInstance( array $aliases = [] )
41
+	public static function getInstance(array $aliases = [])
42 42
 	{
43
-		if( is_null( static::$instance )) {
44
-			return static::$instance = new static( $aliases );
43
+		if (is_null(static::$instance)) {
44
+			return static::$instance = new static($aliases);
45 45
 		}
46 46
 
47
-		$aliases = array_merge( static::$instance->aliases, $aliases );
47
+		$aliases = array_merge(static::$instance->aliases, $aliases);
48 48
 
49 49
 		static::$instance->aliases = $aliases;
50 50
 
@@ -58,10 +58,10 @@  discard block
 block discarded – undo
58 58
 	 *
59 59
 	 * @return bool|null
60 60
 	 */
61
-	public function load( $alias )
61
+	public function load($alias)
62 62
 	{
63
-		if( isset( $this->aliases[$alias] )) {
64
-			return class_alias( $this->aliases[$alias], $alias );
63
+		if (isset($this->aliases[$alias])) {
64
+			return class_alias($this->aliases[$alias], $alias);
65 65
 		}
66 66
 	}
67 67
 
@@ -72,8 +72,8 @@  discard block
 block discarded – undo
72 72
 	 */
73 73
 	public function register()
74 74
 	{
75
-		if( !$this->registered ) {
76
-			spl_autoload_register( [$this, 'load'], true, true );
75
+		if (!$this->registered) {
76
+			spl_autoload_register([$this, 'load'], true, true);
77 77
 			$this->registered = true;
78 78
 		}
79 79
 	}
Please login to merge, or discard this patch.