Passed
Push — develop ( a83a93...617375 )
by Paul
02:59
created
src/Helpers/Template.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -23,15 +23,15 @@  discard block
 block discarded – undo
23 23
 	{
24 24
 		$template = UtilityFacade::startWith( 'templates/', $slug );
25 25
 		$templates = ["$template.php"];
26
-		if( !empty( $name )) {
26
+		if( !empty( $name ) ) {
27 27
 			$fileName = basename( $template );
28 28
 			$filePath = UtilityFacade::trimRight( $template, $fileName );
29
-			array_unshift( $templates, sprintf( '%s/%s.php', $filePath.$name, $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 ));
31
+		$templates = array_unique( apply_filters( "castor/templates/$slug", $templates, $name ) );
32 32
 		$template = locate_template( $templates );
33
-		if( empty( $template )) {
34
-			if( file_exists( "$slug.php" )) {
33
+		if( empty( $template ) ) {
34
+			if( file_exists( "$slug.php" ) ) {
35 35
 				return "$slug.php";
36 36
 			}
37 37
 			LogFacade::debug( "$slug not found." );
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	 */
48 48
 	public function load( $slug, $name = '' )
49 49
 	{
50
-		if( !empty(( $template = $this->get( $slug, $name )))) {
50
+		if( !empty( ( $template = $this->get( $slug, $name ) ) ) ) {
51 51
 			DevelopmentFacade::storeTemplatePath( $template );
52 52
 			load_template( $template, false );
53 53
 		}
@@ -69,6 +69,6 @@  discard block
 block discarded – undo
69 69
 	public function setLayout( $template )
70 70
 	{
71 71
 		$this->template = UtilityFacade::trimRight( $template, '.php' );
72
-		return $this->get( apply_filters( 'castor/templates/layout', 'layouts/default' ));
72
+		return $this->get( apply_filters( 'castor/templates/layout', 'layouts/default' ) );
73 73
 	}
74 74
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,8 +6,7 @@
 block discarded – undo
6 6
 use GeminiLabs\Castor\Facades\Log as LogFacade;
7 7
 use GeminiLabs\Castor\Facades\Utility as UtilityFacade;
8 8
 
9
-class Template
10
-{
9
+class Template {
11 10
 	/**
12 11
 	 * @var string
13 12
 	 */
Please login to merge, or discard this patch.
src/Helpers/Log.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 	 */
152 152
 	protected function interpolate( $message, array $context = [] )
153 153
 	{
154
-		if( is_array( $message )) {
154
+		if( is_array( $message ) ) {
155 155
 			return htmlspecialchars( print_r( $message, true ), ENT_QUOTES, 'UTF-8' );
156 156
 		}
157 157
 		$replace = [];
@@ -159,10 +159,10 @@  discard block
 block discarded – undo
159 159
 			if( is_object( $val ) && get_class( $val ) === 'DateTime' ) {
160 160
 				$val = $val->format( 'Y-m-d H:i:s' );
161 161
 			}
162
-			else if( is_object( $val ) || is_array( $val )) {
162
+			else if( is_object( $val ) || is_array( $val ) ) {
163 163
 				$val = json_encode( $val );
164 164
 			}
165
-			else if( is_resource( $val )) {
165
+			else if( is_resource( $val ) ) {
166 166
 				$val = (string) $val;
167 167
 			}
168 168
 			$replace['{'.$key.'}'] = $val;
@@ -178,13 +178,13 @@  discard block
 block discarded – undo
178 178
 	 */
179 179
 	protected function log( $level, $message, array $context = [] )
180 180
 	{
181
-		if( !in_array( $level, (new ReflectionClass( __NAMESPACE__.'\Log' ))->getConstants(), true )
181
+		if( !in_array( $level, ( new ReflectionClass( __NAMESPACE__.'\Log' ) )->getConstants(), true )
182 182
 			|| !DevelopmentFacade::isDev()
183 183
 		)return;
184
-		$date = get_date_from_gmt( gmdate('Y-m-d H:i:s') );
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 );
187
-		$entry = "[$date] $level: $message" . PHP_EOL;
188
-		file_put_contents( $this->file, $entry, FILE_APPEND|LOCK_EX );
187
+		$entry = "[$date] $level: $message".PHP_EOL;
188
+		file_put_contents( $this->file, $entry, FILE_APPEND | LOCK_EX );
189 189
 	}
190 190
 }
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -5,8 +5,7 @@  discard block
 block discarded – undo
5 5
 use GeminiLabs\Castor\Facades\Development as DevelopmentFacade;
6 6
 use ReflectionClass;
7 7
 
8
-class Log
9
-{
8
+class Log {
10 9
 	const EMERGENCY = 'emergency';
11 10
 	const ALERT = 'alert';
12 11
 	const CRITICAL  = 'critical';
@@ -180,7 +179,9 @@  discard block
 block discarded – undo
180 179
 	{
181 180
 		if( !in_array( $level, (new ReflectionClass( __NAMESPACE__.'\Log' ))->getConstants(), true )
182 181
 			|| !DevelopmentFacade::isDev()
183
-		)return;
182
+		) {
183
+			return;
184
+		}
184 185
 		$date = get_date_from_gmt( gmdate('Y-m-d H:i:s') );
185 186
 		$level = strtoupper( $level );
186 187
 		$message = $this->interpolate( $message, $context );
Please login to merge, or discard this patch.