GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — develop ( e54387...b62a26 )
by Lonnie
10s
created
myth/Forge/BaseGenerator.php 1 patch
Spacing   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 
80 80
 		    if (is_array($folders))
81 81
 		    {
82
-			    $this->module_path = $folders[0] . strtolower($module) .'/';
82
+			    $this->module_path = $folders[0].strtolower($module).'/';
83 83
 		    }
84 84
 		}
85 85
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
      * @param bool  $quiet      If true, models should accept default values.
102 102
      * @return mixed
103 103
      */
104
-    abstract function run($segments=[], $quiet=false);
104
+    abstract function run($segments = [], $quiet = false);
105 105
 
106 106
     //--------------------------------------------------------------------
107 107
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
      *
115 115
      * @return bool
116 116
      */
117
-    public function createFile($path, $contents=null, $overwrite=false, $perms=0644)
117
+    public function createFile($path, $contents = null, $overwrite = false, $perms = 0644)
118 118
     {
119 119
 	    $path = $this->sandbox($path);
120 120
 
@@ -123,8 +123,8 @@  discard block
 block discarded – undo
123 123
         // Does file already exist?
124 124
         if ($file_exists)
125 125
         {
126
-	        if (! $overwrite) {
127
-		        CLI::write( CLI::color("\t". strtolower(lang('exists')) .": ", 'blue') . str_replace(APPPATH, '', $path ) );
126
+	        if ( ! $overwrite) {
127
+		        CLI::write(CLI::color("\t".strtolower(lang('exists')).": ", 'blue').str_replace(APPPATH, '', $path));
128 128
 		        return true;
129 129
 	        }
130 130
 
@@ -136,27 +136,27 @@  discard block
 block discarded – undo
136 136
 		array_pop($segments);
137 137
 		$folder = implode('/', $segments);
138 138
 
139
-	    if (! is_dir($folder))
139
+	    if ( ! is_dir($folder))
140 140
 	    {
141 141
 		    $this->createDirectory($folder);
142 142
 	    }
143 143
 
144 144
         get_instance()->load->helper('file');
145 145
 
146
-        if (! write_file($path, $contents))
146
+        if ( ! write_file($path, $contents))
147 147
         {
148
-            throw new \RuntimeException( sprintf( lang('errors.writing_file'),  $path) );
148
+            throw new \RuntimeException(sprintf(lang('errors.writing_file'), $path));
149 149
         }
150 150
 
151 151
         chmod($path, $perms);
152 152
 
153 153
 	    if ($overwrite && $file_exists)
154 154
 	    {
155
-		    CLI::write( CLI::color("\t". strtolower( lang('overwrote') ) ." ", 'light_red') . str_replace(APPPATH, '', $path ) );
155
+		    CLI::write(CLI::color("\t".strtolower(lang('overwrote'))." ", 'light_red').str_replace(APPPATH, '', $path));
156 156
 	    }
157 157
 	    else
158 158
 	    {
159
-		    CLI::write( CLI::color("\t". strtolower( lang('created') ) ." ", 'yellow') . str_replace(APPPATH, '', $path ) );
159
+		    CLI::write(CLI::color("\t".strtolower(lang('created'))." ", 'yellow').str_replace(APPPATH, '', $path));
160 160
 	    }
161 161
 
162 162
         return $this;
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
      *
173 173
      * @return bool
174 174
      */
175
-    public function createDirectory($path, $perms=0755)
175
+    public function createDirectory($path, $perms = 0755)
176 176
     {
177 177
 	    $path = $this->sandbox($path);
178 178
 
@@ -181,9 +181,9 @@  discard block
 block discarded – undo
181 181
             return $this;
182 182
         }
183 183
 
184
-        if (! mkdir($path, $perms, true) )
184
+        if ( ! mkdir($path, $perms, true))
185 185
         {
186
-            throw new \RuntimeException( sprintf( lang('errors.creating_dir'), $path) );
186
+            throw new \RuntimeException(sprintf(lang('errors.creating_dir'), $path));
187 187
         }
188 188
 
189 189
         return $this;
@@ -200,11 +200,11 @@  discard block
 block discarded – undo
200 200
      *
201 201
      * @return bool
202 202
      */
203
-    public function copyFile($source, $destination, $overwrite=false)
203
+    public function copyFile($source, $destination, $overwrite = false)
204 204
     {
205 205
 	    $source = $this->sandbox($source);
206 206
 
207
-	    if (! file_exists($source))
207
+	    if ( ! file_exists($source))
208 208
 	    {
209 209
 		    return null;
210 210
 	    }
@@ -227,9 +227,9 @@  discard block
 block discarded – undo
227 227
      *
228 228
      * @return $this
229 229
      */
230
-    public function copyTemplate($template, $destination, $data=[], $overwrite=false)
230
+    public function copyTemplate($template, $destination, $data = [], $overwrite = false)
231 231
     {
232
-	    if (! is_array($data))
232
+	    if ( ! is_array($data))
233 233
 	    {
234 234
 		    $data = array($data);
235 235
 	    }
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
      *
260 260
      * @return $this
261 261
      */
262
-    public function injectIntoFile($path, $content, $options='append')
262
+    public function injectIntoFile($path, $content, $options = 'append')
263 263
     {
264 264
         $kit = new FileKit();
265 265
 
@@ -270,11 +270,11 @@  discard block
 block discarded – undo
270 270
         else if (is_array($options) && count($options))
271 271
         {
272 272
             $keys = array_keys($options);
273
-            $action = array_shift( $keys );
273
+            $action = array_shift($keys);
274 274
             $param = $options[$action];
275 275
         }
276 276
 
277
-        switch ( strtolower($action) )
277
+        switch (strtolower($action))
278 278
         {
279 279
             case 'prepend':
280 280
                 $success = $kit->prepend($path, $content);
@@ -299,11 +299,11 @@  discard block
 block discarded – undo
299 299
 
300 300
         if ($success)
301 301
         {
302
-            CLI::write( CLI::color("\t". strtolower( lang('modified') ) ." ", 'cyan') . str_replace(APPPATH, '', $path ) );
302
+            CLI::write(CLI::color("\t".strtolower(lang('modified'))." ", 'cyan').str_replace(APPPATH, '', $path));
303 303
         }
304 304
         else
305 305
         {
306
-            CLI::write( CLI::color("\t". strtolower( lang('error') ) ." ", 'light_red') . str_replace(APPPATH, '', $path ) );
306
+            CLI::write(CLI::color("\t".strtolower(lang('error'))." ", 'light_red').str_replace(APPPATH, '', $path));
307 307
         }
308 308
 
309 309
         return $this;
@@ -320,10 +320,10 @@  discard block
 block discarded – undo
320 320
 	 * @param $command
321 321
 	 * @param null $options
322 322
 	 */
323
-    public function generate($command, $options = '', $quiet=false)
323
+    public function generate($command, $options = '', $quiet = false)
324 324
     {
325 325
 		$orig_options = CLI::optionString();
326
-	    $options = $orig_options .' '. $options;
326
+	    $options = $orig_options.' '.$options;
327 327
 
328 328
 	    if ($quiet === true)
329 329
 	    {
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
 		    $options .= ' -overwrite';
336 336
 	    }
337 337
 
338
-	    passthru( "php sprint forge {$command} {$options}" );
338
+	    passthru("php sprint forge {$command} {$options}");
339 339
     }
340 340
 
341 341
     //--------------------------------------------------------------------
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
      *
349 349
      * @return \Myth\Forge\BaseGenerator
350 350
      */
351
-    public function route($left, $right, $options=[], $method='any')
351
+    public function route($left, $right, $options = [], $method = 'any')
352 352
     {
353 353
         $option_str = '[';
354 354
 
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
 
362 362
         $content = "\$routes->{$method}('{$left}', '{$right}', {$option_str});\n";
363 363
 
364
-        return $this->injectIntoFile(APPPATH .'config/routes.php', $content, ['after' => "// Auto-generated routes go here\n"]);
364
+        return $this->injectIntoFile(APPPATH.'config/routes.php', $content, ['after' => "// Auto-generated routes go here\n"]);
365 365
     }
366 366
     
367 367
     //--------------------------------------------------------------------
@@ -369,21 +369,21 @@  discard block
 block discarded – undo
369 369
     /**
370 370
      * Outputs the contents of the file in the template's source path.
371 371
      */
372
-    public function readme($file='readme.txt')
372
+    public function readme($file = 'readme.txt')
373 373
     {
374 374
 	    $name = str_replace('Generator', '', get_class($this));
375 375
 
376 376
 	    $path = $this->locateGenerator($name);
377 377
 
378
-        if (! file_exists($path . $file))
378
+        if ( ! file_exists($path.$file))
379 379
         {
380
-            CLI::error(sprintf( lang('forge.cant_find_readme'), $file) );
380
+            CLI::error(sprintf(lang('forge.cant_find_readme'), $file));
381 381
         }
382 382
 
383
-	    $contents = file_get_contents($path . $file);
383
+	    $contents = file_get_contents($path.$file);
384 384
 
385 385
         CLI::new_line(2);
386
-        CLI::write( CLI::wrap($contents), 'green' );
386
+        CLI::write(CLI::wrap($contents), 'green');
387 387
         CLI::new_line();
388 388
     }
389 389
 
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
      *
400 400
      * @return string The rendered template
401 401
      */
402
-    public function render($template_name, $data=[], $folder=null)
402
+    public function render($template_name, $data = [], $folder = null)
403 403
     {
404 404
         if (empty($this->themer))
405 405
         {
@@ -410,27 +410,27 @@  discard block
 block discarded – undo
410 410
 
411 411
         $output = null;
412 412
 
413
-	    $view = $template_name .'.tpl';
413
+	    $view = $template_name.'.tpl';
414 414
 
415 415
         $groups = config_item('forge.collections');
416 416
 
417
-	    $name = str_replace('Generator', '', get_class($this) );
417
+	    $name = str_replace('Generator', '', get_class($this));
418 418
 
419 419
         foreach ($groups as $group => $path)
420 420
         {
421
-	        $path = rtrim($path, '/ ') .'/';
421
+	        $path = rtrim($path, '/ ').'/';
422 422
 	        $folders = scandir($path);
423 423
 
424
-	        if (! $i = array_search(ucfirst($name), $folders))
424
+	        if ( ! $i = array_search(ucfirst($name), $folders))
425 425
 	        {
426 426
 		        continue;
427 427
 	        }
428 428
 
429
-	        $view = $folders[$i] . '/'. $view;
429
+	        $view = $folders[$i].'/'.$view;
430 430
 
431
-            if (realpath($path . $view .'.php'))
431
+            if (realpath($path.$view.'.php'))
432 432
             {
433
-                $output = $this->themer->display($group .':'. $view, $data);
433
+                $output = $this->themer->display($group.':'.$view, $data);
434 434
                 break;
435 435
             }
436 436
         }
@@ -461,24 +461,24 @@  discard block
 block discarded – undo
461 461
         $path = $this->normalizePath($path);
462 462
 
463 463
 		// If it's writing to BASEPATH - FIX IT
464
-		if (strpos($path, $this->normalizePath(BASEPATH) ) === 0)
464
+		if (strpos($path, $this->normalizePath(BASEPATH)) === 0)
465 465
 		{
466
-			return APPPATH . $path;
466
+			return APPPATH.$path;
467 467
 		}
468 468
 
469 469
 		// Exact match for FCPATH?
470
-		if (strpos($path, $this->normalizePath(FCPATH) ) === 0)
470
+		if (strpos($path, $this->normalizePath(FCPATH)) === 0)
471 471
 		{
472 472
 			return $path;
473 473
 		}
474 474
 
475 475
 		// Exact match for APPPATH?
476
-		if (strpos($path, $this->normalizePath(APPPATH) ) === 0)
476
+		if (strpos($path, $this->normalizePath(APPPATH)) === 0)
477 477
 		{
478 478
 			return $path;
479 479
 		}
480 480
 
481
-	    return APPPATH . $path;
481
+	    return APPPATH.$path;
482 482
 	}
483 483
 
484 484
 	//--------------------------------------------------------------------
@@ -493,12 +493,12 @@  discard block
 block discarded – undo
493 493
     {
494 494
         $themer_name = config_item('forge.themer');
495 495
 
496
-        if (! $themer_name)
496
+        if ( ! $themer_name)
497 497
         {
498
-            throw new \RuntimeException( lang('forge.no_themer') );
498
+            throw new \RuntimeException(lang('forge.no_themer'));
499 499
         }
500 500
 
501
-        $this->themer = new $themer_name( get_instance() );
501
+        $this->themer = new $themer_name(get_instance());
502 502
 
503 503
         // Register our paths with the themer
504 504
         $paths = config_item('forge.collections');
@@ -514,9 +514,9 @@  discard block
 block discarded – undo
514 514
 	{
515 515
 		$kit_name = config_item('theme.uikit');
516 516
 
517
-		if (! $kit_name)
517
+		if ( ! $kit_name)
518 518
 		{
519
-			throw new \RuntimeException( lang('forge.no_uikit') );
519
+			throw new \RuntimeException(lang('forge.no_uikit'));
520 520
 		}
521 521
 
522 522
 		$uikit = new $kit_name();
@@ -527,16 +527,16 @@  discard block
 block discarded – undo
527 527
 	//--------------------------------------------------------------------
528 528
 
529 529
 
530
-	protected function determineOutputPath($folder='')
530
+	protected function determineOutputPath($folder = '')
531 531
 	{
532
-		$path = APPPATH . $folder;
532
+		$path = APPPATH.$folder;
533 533
 
534
-		if (! empty($this->module_path))
534
+		if ( ! empty($this->module_path))
535 535
 		{
536
-			$path = $this->module_path . $folder;
536
+			$path = $this->module_path.$folder;
537 537
 		}
538 538
 
539
-		return rtrim($path, '/ ') .'/';
539
+		return rtrim($path, '/ ').'/';
540 540
 	}
541 541
 
542 542
 	//--------------------------------------------------------------------
@@ -552,22 +552,22 @@  discard block
 block discarded – undo
552 552
 	{
553 553
 		$collections = config_item('forge.collections');
554 554
 
555
-		if (! is_array($collections) || ! count($collections) )
555
+		if ( ! is_array($collections) || ! count($collections))
556 556
 		{
557
-			return CLI::error( lang('forge.no_collections') );
557
+			return CLI::error(lang('forge.no_collections'));
558 558
 		}
559 559
 
560 560
 		foreach ($collections as $alias => $path)
561 561
 		{
562
-			$path = rtrim($path, '/ ') .'/';
562
+			$path = rtrim($path, '/ ').'/';
563 563
 			$folders = scandir($path);
564 564
 
565
-			if (! $i = array_search(ucfirst($name), $folders))
565
+			if ( ! $i = array_search(ucfirst($name), $folders))
566 566
 			{
567 567
 				continue;
568 568
 			}
569 569
 
570
-			$this->gen_path = $path . $folders[$i] .'/';
570
+			$this->gen_path = $path.$folders[$i].'/';
571 571
 
572 572
 			return $this->gen_path;
573 573
 		}
@@ -584,9 +584,9 @@  discard block
 block discarded – undo
584 584
 	 *
585 585
 	 * @return string
586 586
 	 */
587
-	protected function stringify($array, $depth=0)
587
+	protected function stringify($array, $depth = 0)
588 588
 	{
589
-		if (! is_array($array))
589
+		if ( ! is_array($array))
590 590
 		{
591 591
 			return '';
592 592
 		}
@@ -606,9 +606,9 @@  discard block
 block discarded – undo
606 606
 
607 607
 		foreach ($array as $key => $value)
608 608
 		{
609
-			$str .= str_repeat("\t", $depth +1);
609
+			$str .= str_repeat("\t", $depth + 1);
610 610
 
611
-			if (! is_numeric($key))
611
+			if ( ! is_numeric($key))
612 612
 			{
613 613
 				$str .= "'{$key}' => ";
614 614
 			}
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
 			}
633 633
 		}
634 634
 
635
-		$str .= str_repeat("\t", $depth) ."],";
635
+		$str .= str_repeat("\t", $depth)."],";
636 636
 
637 637
 		return $str;
638 638
 	}
@@ -667,13 +667,13 @@  discard block
 block discarded – undo
667 667
         // Initialize testing variable
668 668
         $test = '';
669 669
 
670
-        foreach($segments as $segment)
670
+        foreach ($segments as $segment)
671 671
         {
672
-            if($segment != '.')
672
+            if ($segment != '.')
673 673
             {
674 674
                 $test = array_pop($parts);
675 675
 
676
-                if(is_null($test))
676
+                if (is_null($test))
677 677
                 {
678 678
                     $parts[] = $segment;
679 679
                 }
Please login to merge, or discard this patch.
myth/Forge/FileKit.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
         }
48 48
 
49 49
         // Ensure that $content has a newline at the end
50
-        $content = rtrim($content) ."\n";
50
+        $content = rtrim($content)."\n";
51 51
 
52 52
         $fh = fopen($file, 'a');
53 53
         $result = fwrite($fh, $content);
@@ -75,18 +75,18 @@  discard block
 block discarded – undo
75 75
         }
76 76
 
77 77
         // Ensure that $content has a newline at the end
78
-        $content = rtrim($content) ."\n";
78
+        $content = rtrim($content)."\n";
79 79
 
80 80
         $file_contents = file_get_contents($file);
81 81
 
82 82
         if ($file_contents === false)
83 83
         {
84
-            throw new \RuntimeException( sprintf(lang('errors.reading_file'), $file));
84
+            throw new \RuntimeException(sprintf(lang('errors.reading_file'), $file));
85 85
         }
86 86
 
87
-        $result = file_put_contents($file, $content . $file_contents);
87
+        $result = file_put_contents($file, $content.$file_contents);
88 88
 
89
-        return (bool)$result;
89
+        return (bool) $result;
90 90
     }
91 91
 
92 92
     //--------------------------------------------------------------------
@@ -108,13 +108,13 @@  discard block
 block discarded – undo
108 108
         }
109 109
 
110 110
         // Ensure that $content has a newline at the end
111
-        $content = rtrim($content) ."\n";
111
+        $content = rtrim($content)."\n";
112 112
 
113 113
         $lines = file($file);
114 114
 
115 115
         if ($lines === false)
116 116
         {
117
-            throw new \RuntimeException( sprintf( lang('errors.file_not_found'), $file ));
117
+            throw new \RuntimeException(sprintf(lang('errors.file_not_found'), $file));
118 118
         }
119 119
 
120 120
         // Where to insert the row.
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 
123 123
         foreach ($lines as $index => $line)
124 124
         {
125
-            if (strtolower($line) == strtolower($before) )
125
+            if (strtolower($line) == strtolower($before))
126 126
             {
127 127
                 $location = $index;
128 128
                 break;
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 
134 134
         $result = file_put_contents($file, $lines);
135 135
 
136
-        return (bool)$result;
136
+        return (bool) $result;
137 137
     }
138 138
 
139 139
     //--------------------------------------------------------------------
@@ -146,13 +146,13 @@  discard block
 block discarded – undo
146 146
         }
147 147
 
148 148
         // Ensure that $content has a newline at the end
149
-        $content = rtrim($content) ."\n";
149
+        $content = rtrim($content)."\n";
150 150
 
151 151
         $lines = file($file);
152 152
 
153 153
         if ($lines === false)
154 154
         {
155
-            throw new \RuntimeException( sprintf( lang('errors.file_not_found'), $file ) );
155
+            throw new \RuntimeException(sprintf(lang('errors.file_not_found'), $file));
156 156
         }
157 157
 
158 158
         // Where to insert the row.
@@ -160,18 +160,18 @@  discard block
 block discarded – undo
160 160
 
161 161
         foreach ($lines as $index => $line)
162 162
         {
163
-            if (strtolower($line) == strtolower($after) )
163
+            if (strtolower($line) == strtolower($after))
164 164
             {
165 165
                 $location = $index;
166 166
                 break;
167 167
             }
168 168
         }
169 169
 
170
-        array_splice($lines, $location +1, 0, $content);
170
+        array_splice($lines, $location + 1, 0, $content);
171 171
 
172 172
         $result = file_put_contents($file, $lines);
173 173
 
174
-        return (bool)$result;
174
+        return (bool) $result;
175 175
     }
176 176
 
177 177
     //--------------------------------------------------------------------
@@ -190,14 +190,14 @@  discard block
 block discarded – undo
190 190
 
191 191
         if ($file_contents === false)
192 192
         {
193
-            throw new \RuntimeException( sprintf( lang('errors.reading_file'), $file ) );
193
+            throw new \RuntimeException(sprintf(lang('errors.reading_file'), $file));
194 194
         }
195 195
 
196 196
         $file_contents = str_replace($search, $replace, $file_contents);
197 197
 
198 198
         $result = file_put_contents($file, $file_contents);
199 199
 
200
-        return (bool)$result;
200
+        return (bool) $result;
201 201
     }
202 202
 
203 203
     //--------------------------------------------------------------------
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 
217 217
         if ($file_contents === false)
218 218
         {
219
-            throw new \RuntimeException( sprintf( lang('errors.reading_file'), $file ) );
219
+            throw new \RuntimeException(sprintf(lang('errors.reading_file'), $file));
220 220
         }
221 221
 
222 222
         $file_contents = preg_replace($pattern, $replace, $file_contents);
@@ -224,12 +224,12 @@  discard block
 block discarded – undo
224 224
         $result = false;
225 225
 
226 226
         // Don't let us erase a file!
227
-        if (! empty($file_contents))
227
+        if ( ! empty($file_contents))
228 228
         {
229
-            $result = file_put_contents( $file, $file_contents );
229
+            $result = file_put_contents($file, $file_contents);
230 230
         }
231 231
 
232
-        return (bool)$result;
232
+        return (bool) $result;
233 233
     }
234 234
 
235 235
     //--------------------------------------------------------------------
Please login to merge, or discard this patch.
myth/Mail/BaseMailer.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
      * will use the system default.
65 65
      * @var null
66 66
      */
67
-    protected $service_name  = null;
67
+    protected $service_name = null;
68 68
 
69 69
     protected $service = null;
70 70
 
@@ -83,9 +83,9 @@  discard block
 block discarded – undo
83 83
      *
84 84
      * @param null $options
85 85
      */
86
-    public function __construct($options=null)
86
+    public function __construct($options = null)
87 87
     {
88
-        if (! empty($options))
88
+        if ( ! empty($options))
89 89
         {
90 90
             $this->setOptions($options);
91 91
         }
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
             {
108 108
                 if ($key == 'service')
109 109
                 {
110
-                    $this->service =& $value;
110
+                    $this->service = & $value;
111 111
                     continue;
112 112
                 }
113 113
 
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
      *
136 136
      * @return bool
137 137
      */
138
-    public function send($to, $subject, $data=[], $view=null)
138
+    public function send($to, $subject, $data = [], $view = null)
139 139
     {
140 140
         // Are we pretending to send?
141 141
         if (config_item('mail.pretend') === true)
@@ -156,8 +156,8 @@  discard block
 block discarded – undo
156 156
             $this->service->from($this->from);
157 157
         }
158 158
 
159
-        if (! empty($this->cc))         $this->service->cc($this->cc);
160
-        if (! empty($this->bcc))        $this->service->bcc($this->bcc);
159
+        if ( ! empty($this->cc))         $this->service->cc($this->cc);
160
+        if ( ! empty($this->bcc))        $this->service->bcc($this->bcc);
161 161
 
162 162
         if (is_array($this->reply_to)) {
163 163
             $this->service->reply_to($this->reply_to[0], $this->reply_to[1]);
@@ -172,20 +172,20 @@  discard block
 block discarded – undo
172 172
         // the debug_backtrace, though, to make it all function in the background.
173 173
         list(, $method) = debug_backtrace(false);
174 174
 
175
-        $view = 'emails/'. strtolower( (new \ReflectionClass($this))->getShortName() ) .'/'. $method['function'];
175
+        $view = 'emails/'.strtolower((new \ReflectionClass($this))->getShortName()).'/'.$method['function'];
176 176
 
177 177
         // Get our message's text and html versions based on which files exist...
178
-        $basepath = APPPATH .'views/'. $view;
178
+        $basepath = APPPATH.'views/'.$view;
179 179
 
180 180
         // Is a text version available?
181
-        if (file_exists($basepath .'.text.php'))
181
+        if (file_exists($basepath.'.text.php'))
182 182
         {
183
-            $text = $this->load->view($view .'.text.php', $data, true);
183
+            $text = $this->load->view($view.'.text.php', $data, true);
184 184
             $this->service->text_message($text);
185 185
         }
186 186
 
187 187
         // If an html version is around, we need to theme it out
188
-        if (file_exists($basepath .'.html.php'))
188
+        if (file_exists($basepath.'.html.php'))
189 189
         {
190 190
             $this->startThemer();
191 191
 
@@ -198,14 +198,14 @@  discard block
 block discarded – undo
198 198
             $this->themer->set($data);
199 199
 
200 200
             // Render the view into a var we can pass to the layout.
201
-            $content = $this->themer->display($view .'.html.php');
201
+            $content = $this->themer->display($view.'.html.php');
202 202
 
203 203
             $this->themer->set('content', $content);
204 204
 
205
-            $this->service->html_message( $this->themer->display($this->theme .':'. $layout) );
205
+            $this->service->html_message($this->themer->display($this->theme.':'.$layout));
206 206
         }
207 207
 
208
-        if (! $this->service->send() )
208
+        if ( ! $this->service->send())
209 209
         {
210 210
             // todo do something here
211 211
             return false;
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
      * @param string|array  $field
225 225
      * @param string        $value
226 226
      */
227
-    public function header($field, $value=null)
227
+    public function header($field, $value = null)
228 228
     {
229 229
         $this->startMailService();
230 230
 
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
      * @param string    $newname        If you'd like to rename the file for delivery
242 242
      * @param string    $mime           Custom defined mime type.
243 243
      */
244
-    public function attach($filename, $disposition=null, $newname=null, $mime=null)
244
+    public function attach($filename, $disposition = null, $newname = null, $mime = null)
245 245
     {
246 246
         $this->startMailService();
247 247
 
@@ -262,16 +262,16 @@  discard block
 block discarded – undo
262 262
     protected function startMailService()
263 263
     {
264 264
         // Only once!
265
-        if (! empty($this->service) && is_object($this->service))
265
+        if ( ! empty($this->service) && is_object($this->service))
266 266
         {
267 267
             return;
268 268
         }
269 269
 
270 270
         $service_name = ! empty($this->service_name) ? $this->service_name : config_item('mail.default_service');
271 271
 
272
-        if (! class_exists($service_name))
272
+        if ( ! class_exists($service_name))
273 273
         {
274
-            throw new \RuntimeException( sprintf( lang('mail.invalid_service'), $service_name) );
274
+            throw new \RuntimeException(sprintf(lang('mail.invalid_service'), $service_name));
275 275
         }
276 276
 
277 277
         $this->service = new $service_name();
@@ -290,12 +290,12 @@  discard block
 block discarded – undo
290 290
         $themer = config_item('active_themer');
291 291
 
292 292
         if (empty($themer)) {
293
-            throw new \RuntimeException( lang('no_themer') );
293
+            throw new \RuntimeException(lang('no_themer'));
294 294
         }
295 295
 
296 296
         if (empty($this->themer))
297 297
         {
298
-            $this->themer = new $themer( get_instance() );
298
+            $this->themer = new $themer(get_instance());
299 299
         }
300 300
 
301 301
         // Register our paths with the themer
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
         }
307 307
 
308 308
         // Set our default theme.
309
-        $this->themer->setDefaultTheme( 'email' );
309
+        $this->themer->setDefaultTheme('email');
310 310
     }
311 311
 
312 312
     //--------------------------------------------------------------------
Please login to merge, or discard this patch.
myth/Mail/CIMailService.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 
49 49
     public function __construct()
50 50
     {
51
-        $this->ci =& get_instance();
51
+        $this->ci = & get_instance();
52 52
 
53 53
         $this->ci->load->library('email');
54 54
     }
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
      *
64 64
      * @return mixed
65 65
      */
66
-    public function send($clear_after=true)
66
+    public function send($clear_after = true)
67 67
     {
68 68
         $this->ci->email->mailtype = $this->format;
69 69
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
      * @param string    $newname        If you'd like to rename the file for delivery
83 83
      * @param string    $mime           Custom defined mime type.
84 84
      */
85
-    public function attach($filename, $disposition=null, $newname=null, $mime=null)
85
+    public function attach($filename, $disposition = null, $newname = null, $mime = null)
86 86
     {
87 87
         $this->ci->email->attach($filename, $disposition, $newname, $mime);
88 88
     }
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
      * @param null $name
132 132
      * @return mixed
133 133
      */
134
-    public function from($email, $name=null)
134
+    public function from($email, $name = null)
135 135
     {
136 136
         $this->ci->email->from($email, $name);
137 137
 
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
      * @param $email
177 177
      * @return mixed
178 178
      */
179
-    public function reply_to($email, $name=null)
179
+    public function reply_to($email, $name = null)
180 180
     {
181 181
         $this->ci->email->reply_to($email, $name);
182 182
     }
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
      * @param bool $clear_attachments
255 255
      * @return mixed
256 256
      */
257
-    public function reset($clear_attachments=true)
257
+    public function reset($clear_attachments = true)
258 258
     {
259 259
         $this->ci->email->clear($clear_attachments);
260 260
 
Please login to merge, or discard this patch.
myth/Mail/LogMailService.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 
54 54
     public function __construct()
55 55
     {
56
-        $this->ci =& get_instance();
56
+        $this->ci = & get_instance();
57 57
 
58 58
         $this->ci->load->library('email');
59 59
     }
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
      *
72 72
      * @return mixed
73 73
      */
74
-    public function send($clear_after=true)
74
+    public function send($clear_after = true)
75 75
     {
76 76
 
77 77
         // Ensure we have enough data
@@ -79,21 +79,21 @@  discard block
 block discarded – undo
79 79
             (empty($this->html_message) && empty($this->text_message))
80 80
         )
81 81
         {
82
-            throw new \RuntimeException( lang('mail.invalid_log_data') );
82
+            throw new \RuntimeException(lang('mail.invalid_log_data'));
83 83
         }
84 84
 
85 85
         $symbols = ['#', '%', '&', '{', '}', '\\', '/', '<', '>', '*', '?', ' ', '$', '!', '\'', '"', ':', '@', '+', '`', '='];
86 86
 
87
-        $email = str_replace($symbols, '.', strtolower($this->to) );
87
+        $email = str_replace($symbols, '.', strtolower($this->to));
88 88
 
89
-        $filename = date('YmdHis_'). $email;
89
+        $filename = date('YmdHis_').$email;
90 90
 
91 91
         // Ensure the emails folder exists in the log folder.
92 92
         $path = config_item('log_path');
93
-        $path = ! empty( $path ) ? $path : APPPATH .'logs/';
94
-        $path = rtrim($path, '/ ') .'/email/';
93
+        $path = ! empty($path) ? $path : APPPATH.'logs/';
94
+        $path = rtrim($path, '/ ').'/email/';
95 95
 
96
-        if (! is_dir($path))
96
+        if ( ! is_dir($path))
97 97
         {
98 98
             mkdir($path, 0777, true);
99 99
         }
@@ -101,15 +101,15 @@  discard block
 block discarded – undo
101 101
         get_instance()->load->helper('file');
102 102
 
103 103
         // Write our HTML file out
104
-        if (! empty($this->html_message) && ! write_file( $path . $filename . '.html', $this->html_message ) )
104
+        if ( ! empty($this->html_message) && ! write_file($path.$filename.'.html', $this->html_message))
105 105
         {
106
-            throw new \RuntimeException( sprintf( lang('mail.error_html_log'), $path, $filename) );
106
+            throw new \RuntimeException(sprintf(lang('mail.error_html_log'), $path, $filename));
107 107
         }
108 108
 
109 109
         // Write our TEXT file out
110
-        if (! empty($this->text_message) && ! write_file( $path . $filename . '.txt', $this->text_message ) )
110
+        if ( ! empty($this->text_message) && ! write_file($path.$filename.'.txt', $this->text_message))
111 111
         {
112
-            throw new \RuntimeException( sprintf( lang('mail.error_text_log'), $path, $filename) );
112
+            throw new \RuntimeException(sprintf(lang('mail.error_text_log'), $path, $filename));
113 113
         }
114 114
 
115 115
         return true;
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
      * @param string    $newname        If you'd like to rename the file for delivery
126 126
      * @param string    $mime           Custom defined mime type.
127 127
      */
128
-    public function attach($filename, $disposition=null, $newname=null, $mime=null)
128
+    public function attach($filename, $disposition = null, $newname = null, $mime = null)
129 129
     {
130 130
         return;
131 131
     }
@@ -174,9 +174,9 @@  discard block
 block discarded – undo
174 174
      * @param null $name
175 175
      * @return mixed
176 176
      */
177
-    public function from($email, $name=null)
177
+    public function from($email, $name = null)
178 178
     {
179
-        if (! empty($name))
179
+        if ( ! empty($name))
180 180
         {
181 181
             $this->from = [$email, $name];
182 182
         }
@@ -226,9 +226,9 @@  discard block
 block discarded – undo
226 226
      * @param $email
227 227
      * @return mixed
228 228
      */
229
-    public function reply_to($email, $name=null)
229
+    public function reply_to($email, $name = null)
230 230
     {
231
-        if (! empty($name))
231
+        if ( ! empty($name))
232 232
         {
233 233
             $this->reply_to = [$email, $name];
234 234
         }
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
      * @param bool $clear_attachments
310 310
      * @return mixed
311 311
      */
312
-    public function reset($clear_attachments=true)
312
+    public function reset($clear_attachments = true)
313 313
     {
314 314
         $this->to = null;
315 315
         $this->from = null;
Please login to merge, or discard this patch.
myth/Mail/Mail.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
      * @param array $options
48 48
      * @return mixed
49 49
      */
50
-    public static function deliver($mailer_name, $params=[], $options=[])
50
+    public static function deliver($mailer_name, $params = [], $options = [])
51 51
     {
52 52
         // Protect users from themselves here.
53 53
         str_replace('::', ':', $mailer_name);
@@ -55,28 +55,28 @@  discard block
 block discarded – undo
55 55
         // Try to load our mailer class.
56 56
         list($class, $method) = explode(':', $mailer_name);
57 57
 
58
-        if (! is_file(APPPATH .'mailers/'. $class .'.php'))
58
+        if ( ! is_file(APPPATH.'mailers/'.$class.'.php'))
59 59
         {
60
-            throw new \RuntimeException( sprintf( lang('mail.cant_find_mailer'), $class) );
60
+            throw new \RuntimeException(sprintf(lang('mail.cant_find_mailer'), $class));
61 61
         }
62 62
 
63
-        require_once APPPATH .'mailers/'. $class .'.php';
63
+        require_once APPPATH.'mailers/'.$class.'.php';
64 64
 
65
-        if (! class_exists($class, false))
65
+        if ( ! class_exists($class, false))
66 66
         {
67
-            throw new \RuntimeException( sprintf( lang('errors.cant_instantiate'), $class) );
67
+            throw new \RuntimeException(sprintf(lang('errors.cant_instantiate'), $class));
68 68
         }
69 69
 
70
-        $mailer = new $class( $options );
70
+        $mailer = new $class($options);
71 71
 
72
-        if (! method_exists($mailer, $method))
72
+        if ( ! method_exists($mailer, $method))
73 73
         {
74
-            throw new \BadMethodCallException( sprintf( lang('mail.invalid_mailer_method'), $class, $method) );
74
+            throw new \BadMethodCallException(sprintf(lang('mail.invalid_mailer_method'), $class, $method));
75 75
         }
76 76
 
77 77
         // try to deliver the mail, but don't send back the contents
78 78
         // since we don't want to force the mailers to return anything.
79
-        if (call_user_func_array([$mailer, $method], $params) )
79
+        if (call_user_func_array([$mailer, $method], $params))
80 80
         {
81 81
             return true;
82 82
         }
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
      *
97 97
      * @return mixed
98 98
      */
99
-    public static function queue($mailer_name, $params=[], $options=[], &$queue=null)
99
+    public static function queue($mailer_name, $params = [], $options = [], &$queue = null)
100 100
     {
101 101
         $data = [
102 102
             'mailer'    => $mailer_name,
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
      * @param int $chunk_size   // How many emails to send per batch.
122 122
      * @return string           // The output of the cronjob...
123 123
      */
124
-    public static function process($chunk_size=50, &$db=null)
124
+    public static function process($chunk_size = 50, &$db = null)
125 125
     {
126 126
         if (empty($db))
127 127
         {
@@ -131,19 +131,19 @@  discard block
 block discarded – undo
131 131
         // Grab our batch of emails to process
132 132
         $queue = $db->find_many_by('sent', 0);
133 133
 
134
-        if (! $queue)
134
+        if ( ! $queue)
135 135
         {
136 136
             // We didn't have an error, we simply
137 137
             // didn't have anything to do.
138 138
             return true;
139 139
         }
140 140
 
141
-        $output = 'Started processing email Queue at '. date('Y-m-d H:i:s') .".\n\n";
141
+        $output = 'Started processing email Queue at '.date('Y-m-d H:i:s').".\n\n";
142 142
 
143 143
         foreach ($queue as $item)
144 144
         {
145 145
             try {
146
-                if (! Mail::deliver($item->mailer, unserialize($item->params), unserialize($item->options))) {
146
+                if ( ! Mail::deliver($item->mailer, unserialize($item->params), unserialize($item->options))) {
147 147
                     $output .= '[FAILED] ';
148 148
                 } else {
149 149
                     $data = [
@@ -158,11 +158,11 @@  discard block
 block discarded – undo
158 158
             }
159 159
             catch (\Exception $e)
160 160
             {
161
-                $output .= "[EXCEPTION] ". $e->getMessage() ."\n";
161
+                $output .= "[EXCEPTION] ".$e->getMessage()."\n";
162 162
             }
163 163
         }
164 164
 
165
-        $output .= "Done processing email Queue at ". date('H:i:s') .".\n";
165
+        $output .= "Done processing email Queue at ".date('H:i:s').".\n";
166 166
 
167 167
         return $output;
168 168
     }
Please login to merge, or discard this patch.
myth/Mail/MailServiceInterface.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
      *
50 50
      * @return mixed
51 51
      */
52
-    public function send($clear_after=true);
52
+    public function send($clear_after = true);
53 53
 
54 54
     //--------------------------------------------------------------------
55 55
 
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
      * @param string    $newname        If you'd like to rename the file for delivery
62 62
      * @param string    $mime           Custom defined mime type.
63 63
      */
64
-    public function attach($filename, $disposition=null, $newname=null, $mime=null);
64
+    public function attach($filename, $disposition = null, $newname = null, $mime = null);
65 65
 
66 66
     //--------------------------------------------------------------------
67 67
 
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
      * @param null $name
98 98
      * @return mixed
99 99
      */
100
-    public function from($email, $name=null);
100
+    public function from($email, $name = null);
101 101
 
102 102
     //--------------------------------------------------------------------
103 103
 
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
      * @param $name
129 129
      * @return mixed
130 130
      */
131
-    public function reply_to($email, $name=null);
131
+    public function reply_to($email, $name = null);
132 132
 
133 133
     //--------------------------------------------------------------------
134 134
 
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
      * @param bool $clear_attachments
181 181
      * @return mixed
182 182
      */
183
-    public function reset($clear_attachments=true);
183
+    public function reset($clear_attachments = true);
184 184
 
185 185
     //--------------------------------------------------------------------
186 186
 }
Please login to merge, or discard this patch.
myth/Modules.php 1 patch
Spacing   +91 added lines, -91 removed lines patch added patch discarded remove patch
@@ -37,20 +37,20 @@  discard block
 block discarded – undo
37 37
  * available within the Router class, before get_instance() is available we'll have to
38 38
  * live with it for now.
39 39
  */
40
-include APPPATH . 'config/config.php';
40
+include APPPATH.'config/config.php';
41 41
 
42
-if ( isset( $config ) )
42
+if (isset($config))
43 43
 {
44
-	if ( is_array( $config['modules_locations'] ) )
44
+	if (is_array($config['modules_locations']))
45 45
 	{
46 46
 		Modules::$locations = $config['modules_locations'];
47 47
 	}
48 48
 	else
49 49
 	{
50
-		Modules::$locations = array( APPPATH . 'modules/' => '../modules/' );
50
+		Modules::$locations = array(APPPATH.'modules/' => '../modules/');
51 51
 	}
52 52
 
53
-	unset( $config );
53
+	unset($config);
54 54
 }
55 55
 
56 56
 
@@ -107,17 +107,17 @@  discard block
 block discarded – undo
107 107
 	 *
108 108
 	 * @return bool
109 109
 	 */
110
-	public static function load_file( $file, $path, $type = 'other', $result = TRUE )
110
+	public static function load_file($file, $path, $type = 'other', $result = TRUE)
111 111
 	{
112 112
 
113
-		$file     = str_replace( '.php', '', $file );
114
-		$location = $path . $file . '.php';
113
+		$file     = str_replace('.php', '', $file);
114
+		$location = $path.$file.'.php';
115 115
 
116
-		if ( $type === 'other' )
116
+		if ($type === 'other')
117 117
 		{
118
-			if ( class_exists( $file, FALSE ) )
118
+			if (class_exists($file, FALSE))
119 119
 			{
120
-				log_message( 'debug', "File already loaded: {$location}" );
120
+				log_message('debug', "File already loaded: {$location}");
121 121
 
122 122
 				return $result;
123 123
 			}
@@ -129,14 +129,14 @@  discard block
 block discarded – undo
129 129
 			/* load config or language array */
130 130
 			include $location;
131 131
 
132
-			if ( ! isset( $$type ) OR ! is_array( $$type ) )
132
+			if ( ! isset($$type) OR ! is_array($$type))
133 133
 			{
134
-				show_error( "{$location} does not contain a valid {$type} array" );
134
+				show_error("{$location} does not contain a valid {$type} array");
135 135
 			}
136 136
 
137 137
 			$result = $$type;
138 138
 		}
139
-		log_message( 'debug', "File loaded: {$location}" );
139
+		log_message('debug', "File loaded: {$location}");
140 140
 
141 141
 		return $result;
142 142
 	}
@@ -156,64 +156,64 @@  discard block
 block discarded – undo
156 156
 	 *
157 157
 	 * @return  array           [ {full_path_to_file}, {file} ] or FALSE
158 158
 	 */
159
-	public static function find( $file, $module, $base )
159
+	public static function find($file, $module, $base)
160 160
 	{
161
-		if (! is_string($module) || ! is_string($file) || ! is_string($base))
161
+		if ( ! is_string($module) || ! is_string($file) || ! is_string($base))
162 162
 		{
163 163
 			throw new \InvalidArgumentException('Argument must be a string for Modules::find()');
164 164
 		}
165 165
 
166 166
 		// Find the actual file name. It will always be the last element.
167
-		$segments = explode( '/', $file );
168
-		$file     = array_pop( $segments );
169
-		$file_ext = ( pathinfo( $file, PATHINFO_EXTENSION ) ) ? $file : $file . '.php';
167
+		$segments = explode('/', $file);
168
+		$file     = array_pop($segments);
169
+		$file_ext = (pathinfo($file, PATHINFO_EXTENSION)) ? $file : $file.'.php';
170 170
 
171 171
 		// Put the pieces back to get the path.
172
-		$path = implode( '/', $segments ) . '/';
173
-		$base = rtrim( $base, '/' ) . '/';
172
+		$path = implode('/', $segments).'/';
173
+		$base = rtrim($base, '/').'/';
174 174
 
175 175
 		// Look in any possible module locations based on the string segments.
176 176
 		$modules = array();
177
-		if ( ! empty( $module ) )
177
+		if ( ! empty($module))
178 178
 		{
179
-			$modules[ $module ] = $path;
179
+			$modules[$module] = $path;
180 180
 		}
181 181
 
182 182
 		// Collect the modules from the segments
183
-		if ( ! empty( $segments ) )
183
+		if ( ! empty($segments))
184 184
 		{
185
-			$modules[ array_shift( $segments ) ] = ltrim( implode( '/', $segments ) . '/', '/' );
185
+			$modules[array_shift($segments)] = ltrim(implode('/', $segments).'/', '/');
186 186
 		}
187 187
 
188
-		foreach ( self::$locations as $location )
188
+		foreach (self::$locations as $location)
189 189
 		{
190 190
 
191
-			foreach ( $modules as $module => $subpath )
191
+			foreach ($modules as $module => $subpath)
192 192
 			{
193 193
 				// Combine the elements to make an actual path to the file
194
-				$fullpath = str_replace( '//', '/', "{$location}{$module}/{$base}{$subpath}" );
194
+				$fullpath = str_replace('//', '/', "{$location}{$module}/{$base}{$subpath}");
195 195
 
196 196
 				// If it starts with a '/' assume it's a full path already
197
-				if ( substr( $path, 0, 1 ) == '/' && strlen( $path ) > 1 )
197
+				if (substr($path, 0, 1) == '/' && strlen($path) > 1)
198 198
 				{
199 199
 					$fullpath = $path;
200 200
 				}
201 201
 
202 202
 				// Libraries are a special consideration since they are
203 203
 				// frequently ucfirst.
204
-				if ( $base == 'libraries/' AND is_file( $fullpath . ucfirst( $file_ext ) ) )
204
+				if ($base == 'libraries/' AND is_file($fullpath.ucfirst($file_ext)))
205 205
 				{
206
-					return array( $fullpath, ucfirst( $file ) );
206
+					return array($fullpath, ucfirst($file));
207 207
 				}
208 208
 
209
-				if ( is_file( $fullpath . $file_ext ) )
209
+				if (is_file($fullpath.$file_ext))
210 210
 				{
211
-					return array( $fullpath, $file );
211
+					return array($fullpath, $file);
212 212
 				}
213 213
 			}
214 214
 		}
215 215
 
216
-		return array( FALSE, $file );
216
+		return array(FALSE, $file);
217 217
 	}
218 218
 
219 219
 	//--------------------------------------------------------------------
@@ -225,33 +225,33 @@  discard block
 block discarded – undo
225 225
 	 */
226 226
 	public static function listModules()
227 227
 	{
228
-		if ( ! function_exists( 'directory_map' ) )
228
+		if ( ! function_exists('directory_map'))
229 229
 		{
230
-			require BASEPATH . 'helpers/directory_helper.php';
230
+			require BASEPATH.'helpers/directory_helper.php';
231 231
 		}
232 232
 
233 233
 		$map = array();
234 234
 
235
-		foreach ( self::$locations as $folder )
235
+		foreach (self::$locations as $folder)
236 236
 		{
237 237
 
238
-			$dirs = directory_map( $folder, 1 );
239
-			if ( ! is_array( $dirs ) )
238
+			$dirs = directory_map($folder, 1);
239
+			if ( ! is_array($dirs))
240 240
 			{
241 241
 				$dirs = array();
242 242
 			}
243 243
 
244
-			$map = array_merge( $map, $dirs );
244
+			$map = array_merge($map, $dirs);
245 245
 		}
246 246
 
247 247
 		// Clean out any html or php files
248
-		if ( $count = count( $map ) )
248
+		if ($count = count($map))
249 249
 		{
250
-			for ( $i = 0; $i < $count; $i ++ )
250
+			for ($i = 0; $i < $count; $i++)
251 251
 			{
252
-				if ( strpos( $map[ $i ], '.html' ) !== FALSE || strpos( $map[ $i ], '.php' ) !== FALSE )
252
+				if (strpos($map[$i], '.html') !== FALSE || strpos($map[$i], '.php') !== FALSE)
253 253
 				{
254
-					unset( $map[ $i ] );
254
+					unset($map[$i]);
255 255
 				}
256 256
 			}
257 257
 		}
@@ -278,17 +278,17 @@  discard block
 block discarded – undo
278 278
 	 *
279 279
 	 * @return boolean
280 280
 	 */
281
-	public static function controllerExists($controller, $module )
281
+	public static function controllerExists($controller, $module)
282 282
 	{
283
-		if (! is_string($module) || ! is_string($controller))
283
+		if ( ! is_string($module) || ! is_string($controller))
284 284
 		{
285 285
 			throw new \InvalidArgumentException('Argument must be a string for Modules::controllerExists()');
286 286
 		}
287 287
 
288 288
 		// Look in all module paths
289
-		foreach ( self::$locations as $folder )
289
+		foreach (self::$locations as $folder)
290 290
 		{
291
-			if ( is_file( "{$folder}{$module}/controllers/{$controller}.php" ) )
291
+			if (is_file("{$folder}{$module}/controllers/{$controller}.php"))
292 292
 			{
293 293
 				return TRUE;
294 294
 			}
@@ -308,18 +308,18 @@  discard block
 block discarded – undo
308 308
 	 *
309 309
 	 * @return  string          The full path to the file, or false if the file was not found
310 310
 	 */
311
-	public static function filePath( $module, $folder, $file )
311
+	public static function filePath($module, $folder, $file)
312 312
 	{
313
-		if (! is_string($module) || ! is_string($folder) || ! is_string($file))
313
+		if ( ! is_string($module) || ! is_string($folder) || ! is_string($file))
314 314
 		{
315 315
 			throw new \InvalidArgumentException('Argument must be a string for Modules::filePath()');
316 316
 		}
317 317
 
318
-		foreach ( self::$locations as $location )
318
+		foreach (self::$locations as $location)
319 319
 		{
320 320
 			$test_file = "{$location}{$module}/{$folder}/{$file}";
321 321
 
322
-			if ( is_file( $test_file ) )
322
+			if (is_file($test_file))
323 323
 			{
324 324
 				return $test_file;
325 325
 			}
@@ -338,23 +338,23 @@  discard block
 block discarded – undo
338 338
 	 *
339 339
 	 * @return string The path, relative to the front controller, or false if the folder was not found
340 340
 	 */
341
-	public static function path( $module, $folder = null )
341
+	public static function path($module, $folder = null)
342 342
 	{
343
-		if (! is_string($module) || (! is_string($folder) && !is_null($folder) ) )
343
+		if ( ! is_string($module) || ( ! is_string($folder) && ! is_null($folder)))
344 344
 		{
345 345
 			throw new \InvalidArgumentException('Argument must be a string for Modules::path()');
346 346
 		}
347 347
 
348
-		foreach ( self::$locations as $module_folder )
348
+		foreach (self::$locations as $module_folder)
349 349
 		{
350
-			if ( is_dir( $module_folder . $module ) )
350
+			if (is_dir($module_folder.$module))
351 351
 			{
352
-				if ( ! empty( $folder ) && is_dir( "{$module_folder}{$module}/{$folder}" ) )
352
+				if ( ! empty($folder) && is_dir("{$module_folder}{$module}/{$folder}"))
353 353
 				{
354 354
 					return "{$module_folder}{$module}/{$folder}/";
355 355
 				}
356 356
 
357
-				return $module_folder . $module . '/';
357
+				return $module_folder.$module.'/';
358 358
 			}
359 359
 		}
360 360
 
@@ -372,58 +372,58 @@  discard block
 block discarded – undo
372 372
 	 *
373 373
 	 * @return array An associative array, like: array('module_name' => array('folder' => array('file1', 'file2')))
374 374
 	 */
375
-	public static function files( $module_name = NULL, $module_folder = NULL )
375
+	public static function files($module_name = NULL, $module_folder = NULL)
376 376
 	{
377
-		if ( ! function_exists( 'directory_map' ) )
377
+		if ( ! function_exists('directory_map'))
378 378
 		{
379
-			require BASEPATH . 'helpers/directory_helper.php';
379
+			require BASEPATH.'helpers/directory_helper.php';
380 380
 		}
381 381
 
382 382
 		$files = array();
383 383
 
384
-		foreach ( self::$locations as $path )
384
+		foreach (self::$locations as $path)
385 385
 		{
386 386
 
387 387
 			// Only map the whole modules directory if $module_name isn't passed
388
-			if ( empty( $module_name ) )
388
+			if (empty($module_name))
389 389
 			{
390
-				$modules = directory_map( $path );
390
+				$modules = directory_map($path);
391 391
 			}
392 392
 			// Only map the $module_name directory if it exists
393
-			elseif ( is_dir( $path . $module_name ) )
393
+			elseif (is_dir($path.$module_name))
394 394
 			{
395
-				$path                    = $path . $module_name;
396
-				$modules[ $module_name ] = directory_map( $path );
395
+				$path                    = $path.$module_name;
396
+				$modules[$module_name] = directory_map($path);
397 397
 			}
398 398
 
399 399
 			// If the element is not an array, it's a file, so ignore it.
400 400
 			// Otherwise it is assumed to be a module.
401
-			if ( empty( $modules ) || ! is_array( $modules ) )
401
+			if (empty($modules) || ! is_array($modules))
402 402
 			{
403 403
 				continue;
404 404
 			}
405 405
 
406
-			foreach ( $modules as $mod_name => $values )
406
+			foreach ($modules as $mod_name => $values)
407 407
 			{
408
-				if ( is_array( $values ) )
408
+				if (is_array($values))
409 409
 				{
410 410
 					// Add just the specified folder for this module
411
-					if ( ! empty( $module_folder ) && isset( $values[ $module_folder .'/' ] ) && count( $values[ $module_folder .'/' ] ) )
411
+					if ( ! empty($module_folder) && isset($values[$module_folder.'/']) && count($values[$module_folder.'/']))
412 412
 					{
413
-						$files[ $mod_name ] = array(
414
-							$module_folder .'/' => $values[ $module_folder .'/' ],
413
+						$files[$mod_name] = array(
414
+							$module_folder.'/' => $values[$module_folder.'/'],
415 415
 						);
416 416
 					}
417 417
 					// Add the entire module
418
-					elseif ( empty( $module_folder ) )
418
+					elseif (empty($module_folder))
419 419
 					{
420
-						$files[ $mod_name ] = $values;
420
+						$files[$mod_name] = $values;
421 421
 					}
422 422
 				}
423 423
 			}
424 424
 		}
425 425
 
426
-		return count( $files ) ? $files : null;
426
+		return count($files) ? $files : null;
427 427
 	}
428 428
 
429 429
 	//--------------------------------------------------------------------
@@ -436,37 +436,37 @@  discard block
 block discarded – undo
436 436
 	 *
437 437
 	 * @return array
438 438
 	 */
439
-	public static function parse_routes( $module, $uri )
439
+	public static function parse_routes($module, $uri)
440 440
 	{
441 441
 
442 442
 		/* load the route file */
443
-		if ( ! isset( self::$routes[ $module ] ) )
443
+		if ( ! isset(self::$routes[$module]))
444 444
 		{
445
-			if ( list( $path ) = self::find( 'routes', $module, 'config/' ) AND $path )
445
+			if (list($path) = self::find('routes', $module, 'config/') AND $path)
446 446
 			{
447
-				self::$routes[ $module ] = self::load_file( 'routes', $path, 'route' );
447
+				self::$routes[$module] = self::load_file('routes', $path, 'route');
448 448
 			}
449 449
 		}
450 450
 
451
-		if ( ! isset( self::$routes[ $module ] ) )
451
+		if ( ! isset(self::$routes[$module]))
452 452
 		{
453 453
 			return;
454 454
 		}
455 455
 
456 456
 		/* parse module routes */
457
-		foreach ( self::$routes[ $module ] as $key => $val )
457
+		foreach (self::$routes[$module] as $key => $val)
458 458
 		{
459 459
 
460
-			$key = str_replace( array( ':any', ':num' ), array( '.+', '[0-9]+' ), $key );
460
+			$key = str_replace(array(':any', ':num'), array('.+', '[0-9]+'), $key);
461 461
 
462
-			if ( preg_match( '#^' . $key . '$#', $uri ) )
462
+			if (preg_match('#^'.$key.'$#', $uri))
463 463
 			{
464
-				if ( strpos( $val, '$' ) !== FALSE AND strpos( $key, '(' ) !== FALSE )
464
+				if (strpos($val, '$') !== FALSE AND strpos($key, '(') !== FALSE)
465 465
 				{
466
-					$val = preg_replace( '#^' . $key . '$#', $val, $uri );
466
+					$val = preg_replace('#^'.$key.'$#', $val, $uri);
467 467
 				}
468 468
 
469
-				return explode( '/', $module . '/' . $val );
469
+				return explode('/', $module.'/'.$val);
470 470
 			}
471 471
 		}
472 472
 	}
@@ -482,17 +482,17 @@  discard block
 block discarded – undo
482 482
 	 *
483 483
 	 * @param $class
484 484
 	 */
485
-	public static function autoload( $class )
485
+	public static function autoload($class)
486 486
 	{
487 487
 
488 488
 		/* don't autoload CI_ prefixed classes or those using the config subclass_prefix */
489
-		if ( strstr( $class, 'CI_' ) OR strstr( $class, config_item( 'subclass_prefix' ) ) )
489
+		if (strstr($class, 'CI_') OR strstr($class, config_item('subclass_prefix')))
490 490
 		{
491 491
 			return;
492 492
 		}
493 493
 
494 494
 		/* autoload core classes */
495
-		if ( is_file( $location = APPPATH . 'core/' . $class . '.php' ) )
495
+		if (is_file($location = APPPATH.'core/'.$class.'.php'))
496 496
 		{
497 497
 			include_once $location;
498 498
 
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
 		}
501 501
 
502 502
 		/* autoload library classes */
503
-		if ( is_file( $location = APPPATH . 'libraries/' . $class . '.php' ) )
503
+		if (is_file($location = APPPATH.'libraries/'.$class.'.php'))
504 504
 		{
505 505
 			include_once $location;
506 506
 
Please login to merge, or discard this patch.
myth/Route.php 1 patch
Spacing   +29 added lines, -30 removed lines patch added patch discarded remove patch
@@ -162,10 +162,10 @@  discard block
 block discarded – undo
162 162
     {
163 163
         // Ensure consistency
164 164
         $name    = trim($name, '{} ');
165
-        $pattern = '(' . trim($pattern, '() ') . ')';
165
+        $pattern = '('.trim($pattern, '() ').')';
166 166
 
167 167
         // Not here? Add it and leave...
168
-        if (! array_key_exists($name, $this->constraints)) {
168
+        if ( ! array_key_exists($name, $this->constraints)) {
169 169
             $this->constraints[$name] = $pattern;
170 170
 
171 171
             return;
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 
232 232
         // To register a route, we'll set a flag so that our router
233 233
         // so it will see the groupname.
234
-        $this->group = ltrim($old_group . '/' . $name, '/');
234
+        $this->group = ltrim($old_group.'/'.$name, '/');
235 235
 
236 236
         call_user_func($callback);
237 237
 
@@ -429,24 +429,23 @@  discard block
 block discarded – undo
429 429
         // If a new module was specified, simply put that path
430 430
         // in front of the controller.
431 431
         if (isset($options['module'])) {
432
-            $new_name = $options['module'] . '/' . $new_name;
432
+            $new_name = $options['module'].'/'.$new_name;
433 433
         }
434 434
 
435 435
         // In order to allow customization of allowed id values
436 436
         // we need someplace to store them.
437
-        $id = isset($this->constraints[$this->default_constraint]) ? $this->constraints[$this->default_constraint] :
438
-            '(:any)';
437
+        $id = isset($this->constraints[$this->default_constraint]) ? $this->constraints[$this->default_constraint] : '(:any)';
439 438
 
440 439
         if (isset($options['constraint'])) {
441 440
             $id = $options['constraint'];
442 441
         }
443 442
 
444
-        $this->get($name, $new_name . '/list_all', $options);
445
-        $this->get($name . '/' . $id, $new_name . '/show/$1', $options);
446
-        $this->post($name, $new_name . '/create', $options);
447
-        $this->put($name . '/' . $id, $new_name . '/update/$1', $options);
448
-        $this->delete($name . '/' . $id, $new_name . '/delete/$1', $options);
449
-        $this->options($name, $new_name . '/index', $options);
443
+        $this->get($name, $new_name.'/list_all', $options);
444
+        $this->get($name.'/'.$id, $new_name.'/show/$1', $options);
445
+        $this->post($name, $new_name.'/create', $options);
446
+        $this->put($name.'/'.$id, $new_name.'/update/$1', $options);
447
+        $this->delete($name.'/'.$id, $new_name.'/delete/$1', $options);
448
+        $this->options($name, $new_name.'/index', $options);
450 449
     }
451 450
 
452 451
     //--------------------------------------------------------------------
@@ -468,11 +467,11 @@  discard block
 block discarded – undo
468 467
         self::$areas[$area] = $controller;
469 468
 
470 469
         // Create routes for this area.
471
-        $this->create($area . '/(:any)/(:any)/(:any)/(:any)/(:any)', '$1/' . $controller . '/$2/$3/$4/$5', $options);
472
-        $this->create($area . '/(:any)/(:any)/(:any)/(:any)', '$1/' . $controller . '/$2/$3/$4', $options);
473
-        $this->create($area . '/(:any)/(:any)/(:any)', '$1/' . $controller . '/$2/$3', $options);
474
-        $this->create($area . '/(:any)/(:any)', '$1/' . $controller . '/$2', $options);
475
-        $this->create($area . '/(:any)', '$1/' . $controller, $options);
470
+        $this->create($area.'/(:any)/(:any)/(:any)/(:any)/(:any)', '$1/'.$controller.'/$2/$3/$4/$5', $options);
471
+        $this->create($area.'/(:any)/(:any)/(:any)/(:any)', '$1/'.$controller.'/$2/$3/$4', $options);
472
+        $this->create($area.'/(:any)/(:any)/(:any)', '$1/'.$controller.'/$2/$3', $options);
473
+        $this->create($area.'/(:any)/(:any)', '$1/'.$controller.'/$2', $options);
474
+        $this->create($area.'/(:any)', '$1/'.$controller, $options);
476 475
     }
477 476
 
478 477
     //--------------------------------------------------------------------
@@ -534,7 +533,7 @@  discard block
 block discarded – undo
534 533
     {
535 534
         $paths = func_get_args();
536 535
 
537
-        if (! is_array($paths) || ! count($paths)) {
536
+        if ( ! is_array($paths) || ! count($paths)) {
538 537
             return;
539 538
         }
540 539
 
@@ -577,20 +576,20 @@  discard block
 block discarded – undo
577 576
      */
578 577
     private function create($from, $to, $options = array())
579 578
     {
580
-        $prefix = is_null($this->group) ? '' : $this->group . '/';
579
+        $prefix = is_null($this->group) ? '' : $this->group.'/';
581 580
 
582
-        $from = $prefix . $from;
581
+        $from = $prefix.$from;
583 582
 
584 583
         // Are we saving the name for this one?
585
-        if (isset($options['as']) && !empty($options['as'])) {
584
+        if (isset($options['as']) && ! empty($options['as'])) {
586 585
             self::$names[$options['as']] = $from;
587 586
         }
588 587
 
589 588
         // Limiting to subdomains?
590
-        if (isset($options['subdomain']) && !empty($options['subdomain'])) {
589
+        if (isset($options['subdomain']) && ! empty($options['subdomain'])) {
591 590
             // If we don't match the current subdomain, then
592 591
             // we don't need to add the route.
593
-            if (!$this->checkSubdomains($options['subdomain'])) {
592
+            if ( ! $this->checkSubdomains($options['subdomain'])) {
594 593
                 return;
595 594
             }
596 595
         }
@@ -602,11 +601,11 @@  discard block
 block discarded – undo
602 601
             // Get a constant string to work with.
603 602
             $to = preg_replace('/(\$\d+)/', '$X', $to);
604 603
 
605
-            for ($i = (int)$options['offset'] + 1; $i < (int)$options['offset'] + 7; $i ++) {
604
+            for ($i = (int) $options['offset'] + 1; $i < (int) $options['offset'] + 7; $i++) {
606 605
                 $to = preg_replace_callback(
607 606
                     '/\$X/',
608
-                    function ($m) use ($i) {
609
-                        return '$' . $i;
607
+                    function($m) use ($i) {
608
+                        return '$'.$i;
610 609
                     },
611 610
                     $to,
612 611
                     1
@@ -616,7 +615,7 @@  discard block
 block discarded – undo
616 615
 
617 616
         // Convert any custom constraints to the CI/pattern equivalent
618 617
         foreach ($this->constraints as $name => $pattern) {
619
-            $from = str_replace('{' . $name . '}', $pattern, $from);
618
+            $from = str_replace('{'.$name.'}', $pattern, $from);
620 619
         }
621 620
 
622 621
         $this->routes[$from] = $to;
@@ -637,7 +636,7 @@  discard block
 block discarded – undo
637 636
             $this->determineCurrentSubdomain();
638 637
         }
639 638
 
640
-        if (!is_array($subdomains)) {
639
+        if ( ! is_array($subdomains)) {
641 640
             $subdomains = array($subdomains);
642 641
         }
643 642
 
@@ -645,7 +644,7 @@  discard block
 block discarded – undo
645 644
 
646 645
         array_walk(
647 646
             $subdomains,
648
-            function ($subdomain) use (&$matched) {
647
+            function($subdomain) use (&$matched) {
649 648
                 if ($subdomain == $this->current_subdomain || $subdomain == '*') {
650 649
                     $matched = true;
651 650
                 }
@@ -670,7 +669,7 @@  discard block
 block discarded – undo
670 669
         // If we only have 2 parts, then we don't have a subdomain.
671 670
         // This won't be totally accurate, since URL's like example.co.uk
672 671
         // would still pass, but it helps to separate the chaff...
673
-        if (!is_array($host) || count($host) == 2) {
672
+        if ( ! is_array($host) || count($host) == 2) {
674 673
             // Set it to false so we don't make it back here again.
675 674
             $this->current_subdomain = false;
676 675
             return;
Please login to merge, or discard this patch.