Passed
Push — develop ( 13c238...e8e299 )
by Paul
04:28
created
src/Helpers/Theme.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
     public $archiveMeta;
8 8
     public $postMeta;
9 9
 
10
-    public function __construct(ArchiveMeta $archiveMeta, PostMeta $postMeta)
10
+    public function __construct( ArchiveMeta $archiveMeta, PostMeta $postMeta )
11 11
     {
12 12
         $this->archiveMeta = $archiveMeta;
13 13
         $this->postMeta = $postMeta;
@@ -18,9 +18,9 @@  discard block
 block discarded – undo
18 18
      *
19 19
      * @return string
20 20
      */
21
-    public function assetPath($asset)
21
+    public function assetPath( $asset )
22 22
     {
23
-        return $this->paths('dir.stylesheet').'assets/'.$asset;
23
+        return $this->paths( 'dir.stylesheet' ).'assets/'.$asset;
24 24
     }
25 25
 
26 26
     /**
@@ -28,9 +28,9 @@  discard block
 block discarded – undo
28 28
      *
29 29
      * @return string
30 30
      */
31
-    public function assetUri($asset)
31
+    public function assetUri( $asset )
32 32
     {
33
-        return $this->paths('uri.stylesheet').'assets/'.$asset;
33
+        return $this->paths( 'uri.stylesheet' ).'assets/'.$asset;
34 34
     }
35 35
 
36 36
     /**
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
      */
39 39
     public function copyright()
40 40
     {
41
-        return __('Copyright', 'castor').' © '.date('Y').', '.get_bloginfo('name');
41
+        return __( 'Copyright', 'castor' ).' © '.date( 'Y' ).', '.get_bloginfo( 'name' );
42 42
     }
43 43
 
44 44
     /**
@@ -52,9 +52,9 @@  discard block
 block discarded – undo
52 52
             is_single(),
53 53
         ];
54 54
 
55
-        $display = in_array(true, $conditions);
55
+        $display = in_array( true, $conditions );
56 56
 
57
-        return apply_filters('castor/display/sidebar', $display);
57
+        return apply_filters( 'castor/display/sidebar', $display );
58 58
     }
59 59
 
60 60
     /**
@@ -62,9 +62,9 @@  discard block
 block discarded – undo
62 62
      *
63 63
      * @return string
64 64
      */
65
-    public function imagePath($asset)
65
+    public function imagePath( $asset )
66 66
     {
67
-        return $this->assetPath(castor_app()->imgDir.$asset);
67
+        return $this->assetPath( castor_app()->imgDir.$asset );
68 68
     }
69 69
 
70 70
     /**
@@ -72,18 +72,18 @@  discard block
 block discarded – undo
72 72
      *
73 73
      * @return string
74 74
      */
75
-    public function imageUri($asset)
75
+    public function imageUri( $asset )
76 76
     {
77
-        return $this->assetUri(castor_app()->imgDir.$asset);
77
+        return $this->assetUri( castor_app()->imgDir.$asset );
78 78
     }
79 79
 
80 80
     public function pageTitle()
81 81
     {
82
-        foreach (['is_404', 'is_archive', 'is_home', 'is_page', 'is_search'] as $bool) {
83
-            if (!$bool()) {
82
+        foreach( ['is_404', 'is_archive', 'is_home', 'is_page', 'is_search'] as $bool ) {
83
+            if( !$bool() ) {
84 84
                 continue;
85 85
             }
86
-            $method = sprintf('get%sTitle', ucfirst(str_replace('is_', '', $bool)));
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,46 +119,46 @@  discard block
 block discarded – undo
119 119
      * @param string $class
120 120
      * @return string|null
121 121
      */
122
-    public function svg($path = null, $class = '')
122
+    public function svg( $path = null, $class = '' )
123 123
     {
124
-        if (!file_exists($this->imagePath($path))) {
124
+        if( !file_exists( $this->imagePath( $path ) ) ) {
125 125
             return;
126 126
         }
127
-        $svg = file_get_contents($this->imagePath($path));
127
+        $svg = file_get_contents( $this->imagePath( $path ) );
128 128
         $pattern = '/(<svg.+)( class=[\'\"](|[^\'\"]+)[\'\"])(>.+)/i';
129
-        if (1 === preg_match($pattern, $svg, $matches)) {
129
+        if( 1 === preg_match( $pattern, $svg, $matches ) ) {
130 130
             $class .= ' '.$matches[3];
131
-            $svg = preg_filter($pattern, '$1$4', $svg);
131
+            $svg = preg_filter( $pattern, '$1$4', $svg );
132 132
         }
133
-        return str_replace('<svg', '<svg class="'.trim($class).'"', $svg);
133
+        return str_replace( '<svg', '<svg class="'.trim( $class ).'"', $svg );
134 134
     }
135 135
 
136 136
     protected function get404Title()
137 137
     {
138
-        return __('Not Found', 'castor');
138
+        return __( 'Not Found', 'castor' );
139 139
     }
140 140
 
141 141
     protected function getArchiveTitle()
142 142
     {
143
-        return $this->archiveMeta->get('title', get_the_archive_title(), get_query_var('post_type'));
143
+        return $this->archiveMeta->get( 'title', get_the_archive_title(), get_query_var( 'post_type' ) );
144 144
     }
145 145
 
146 146
     protected function getHomeTitle()
147 147
     {
148
-        return ($home = (string) get_option('page_for_posts'))
149
-            ? get_the_title($home)
148
+        return ( $home = (string) get_option( 'page_for_posts' ) )
149
+            ? get_the_title( $home )
150 150
             : get_the_archive_title();
151 151
     }
152 152
 
153 153
     protected function getPageTitle()
154 154
     {
155
-        return $this->postMeta->get('title', [
155
+        return $this->postMeta->get( 'title', [
156 156
             'fallback' => get_the_title(),
157
-        ]);
157
+        ] );
158 158
     }
159 159
 
160 160
     protected function getSearchTitle()
161 161
     {
162
-        return sprintf(__('Search Results for %s', 'castor'), get_search_query());
162
+        return sprintf( __( 'Search Results for %s', 'castor' ), get_search_query() );
163 163
     }
164 164
 }
Please login to merge, or discard this patch.
src/Helpers/Development.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
     protected $utility;
10 10
 
11
-    public function __construct(Utility $utility)
11
+    public function __construct( Utility $utility )
12 12
     {
13 13
         $this->utility = $utility;
14 14
     }
@@ -16,23 +16,23 @@  discard block
 block discarded – undo
16 16
     public function capture()
17 17
     {
18 18
         ob_start();
19
-        call_user_func_array([$this, 'printF'], func_get_args());
19
+        call_user_func_array( [$this, 'printF'], func_get_args() );
20 20
         return ob_get_clean();
21 21
     }
22 22
 
23
-    public function className($override = 'dev')
23
+    public function className( $override = 'dev' )
24 24
     {
25 25
         return $this->isDev() ? $override : '';
26 26
     }
27 27
 
28 28
     public function debug()
29 29
     {
30
-        call_user_func_array([$this, 'printF'], func_get_args());
30
+        call_user_func_array( [$this, 'printF'], func_get_args() );
31 31
     }
32 32
 
33 33
     public function isDev()
34 34
     {
35
-        return defined('DEV') && (bool) DEV && WP_ENV == 'development';
35
+        return defined( 'DEV' ) && (bool) DEV && WP_ENV == 'development';
36 36
     }
37 37
 
38 38
     public function isProduction()
@@ -40,27 +40,27 @@  discard block
 block discarded – undo
40 40
         return WP_ENV == 'production';
41 41
     }
42 42
 
43
-    public function printFiltersFor($hook = '')
43
+    public function printFiltersFor( $hook = '' )
44 44
     {
45 45
         global $wp_filter;
46
-        if (empty($hook) || !isset($wp_filter[$hook])) {
46
+        if( empty( $hook ) || !isset( $wp_filter[$hook] ) ) {
47 47
             return;
48 48
         }
49
-        $this->printF($wp_filter[$hook]);
49
+        $this->printF( $wp_filter[$hook] );
50 50
     }
51 51
 
52 52
     public function printTemplatePaths()
53 53
     {
54
-        $templates = array_map(function ($key, $value) {
55
-            return sprintf('[%s] => %s', $key, $value);
56
-        }, array_keys($this->templatePaths), $this->templatePaths);
57
-        $this->printF(implode("\n", $templates));
54
+        $templates = array_map( function( $key, $value ) {
55
+            return sprintf( '[%s] => %s', $key, $value );
56
+        }, array_keys( $this->templatePaths ), $this->templatePaths );
57
+        $this->printF( implode( "\n", $templates ) );
58 58
     }
59 59
 
60
-    public function storeTemplatePath($template)
60
+    public function storeTemplatePath( $template )
61 61
     {
62
-        if (is_string($template)) {
63
-            $this->templatePaths[] = $this->utility->trimLeft($template, trailingslashit(WP_CONTENT_DIR));
62
+        if( is_string( $template ) ) {
63
+            $this->templatePaths[] = $this->utility->trimLeft( $template, trailingslashit( WP_CONTENT_DIR ) );
64 64
         }
65 65
     }
66 66
 
@@ -68,14 +68,14 @@  discard block
 block discarded – undo
68 68
     {
69 69
         $args = func_num_args();
70 70
 
71
-        if (1 == $args) {
72
-            printf('<div class="print__r"><pre>%s</pre></div>',
73
-                htmlspecialchars(print_r(func_get_arg(0), true), ENT_QUOTES, 'UTF-8')
71
+        if( 1 == $args ) {
72
+            printf( '<div class="print__r"><pre>%s</pre></div>',
73
+                htmlspecialchars( print_r( func_get_arg( 0 ), true ), ENT_QUOTES, 'UTF-8' )
74 74
             );
75
-        } elseif ($args > 1) {
75
+        } elseif( $args > 1 ) {
76 76
             echo '<div class="print__r_group">';
77
-            foreach (func_get_args() as $value) {
78
-                $this->printF($value);
77
+            foreach( func_get_args() as $value ) {
78
+                $this->printF( $value );
79 79
             }
80 80
             echo '</div>';
81 81
         }
Please login to merge, or discard this patch.