@@ -17,14 +17,14 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | public static function instance() |
| 19 | 19 | { |
| 20 | - if(!isset(self::$instance)) |
|
| 20 | + if (!isset(self::$instance)) |
|
| 21 | 21 | self::$instance = new Loader(); |
| 22 | 22 | return self::$instance; |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | private function get_root() |
| 26 | 26 | { |
| 27 | - if(!isset($this->root)) |
|
| 27 | + if (!isset($this->root)) |
|
| 28 | 28 | { |
| 29 | 29 | $current_directory = dirname(__FILE__); |
| 30 | 30 | $current_directory = substr($current_directory, 0, -7); |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | private static function get_extension($type) |
| 54 | 54 | { |
| 55 | - switch($type) |
|
| 55 | + switch ($type) |
|
| 56 | 56 | { |
| 57 | 57 | case 'collector' : |
| 58 | 58 | case 'controller' : |
@@ -104,18 +104,18 @@ discard block |
||
| 104 | 104 | |
| 105 | 105 | public static function load($type, $files, $data = array()) |
| 106 | 106 | { |
| 107 | - foreach((array) $files as $file) |
|
| 107 | + foreach ((array) $files as $file) |
|
| 108 | 108 | { |
| 109 | 109 | $file_path = self::instance()->get_path($type, $file); |
| 110 | - if(in_array($file_path, self::instance()->get_included_files()) && $type !== 'view') |
|
| 110 | + if (in_array($file_path, self::instance()->get_included_files()) && $type !== 'view') |
|
| 111 | 111 | continue; |
| 112 | 112 | |
| 113 | - if(!file_exists($file_path)) |
|
| 113 | + if (!file_exists($file_path)) |
|
| 114 | 114 | Debugger::logMessage("Requested file does not exist: {$type}, {$file}"); |
| 115 | 115 | |
| 116 | 116 | self::instance()->add_included_file($file_path); |
| 117 | 117 | |
| 118 | - switch($type) |
|
| 118 | + switch ($type) |
|
| 119 | 119 | { |
| 120 | 120 | case 'images' : |
| 121 | 121 | case 'scripts' : |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | |
| 146 | 146 | $reflectionObject = self::create_reflection_class($file); |
| 147 | 147 | |
| 148 | - if( |
|
| 148 | + if ( |
|
| 149 | 149 | $reflectionObject->hasMethod('instance') && |
| 150 | 150 | $reflectionObject->getMethod('instance')->isStatic()) |
| 151 | 151 | { |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | |
| 161 | 161 | $reflectionObject = self::create_reflection_class($file); |
| 162 | 162 | |
| 163 | - if($reflectionObject->hasMethod('__construct')) |
|
| 163 | + if ($reflectionObject->hasMethod('__construct')) |
|
| 164 | 164 | return $reflectionObject->newInstanceArgs($data); |
| 165 | 165 | else |
| 166 | 166 | return $reflectionObject->newInstance(); |
@@ -17,8 +17,9 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | public static function instance() |
| 19 | 19 | { |
| 20 | - if(!isset(self::$instance)) |
|
| 21 | - self::$instance = new Loader(); |
|
| 20 | + if(!isset(self::$instance)) {
|
|
| 21 | + self::$instance = new Loader(); |
|
| 22 | + } |
|
| 22 | 23 | return self::$instance; |
| 23 | 24 | } |
| 24 | 25 | |
@@ -107,11 +108,13 @@ discard block |
||
| 107 | 108 | foreach((array) $files as $file) |
| 108 | 109 | { |
| 109 | 110 | $file_path = self::instance()->get_path($type, $file); |
| 110 | - if(in_array($file_path, self::instance()->get_included_files()) && $type !== 'view') |
|
| 111 | - continue; |
|
| 111 | + if(in_array($file_path, self::instance()->get_included_files()) && $type !== 'view') {
|
|
| 112 | + continue; |
|
| 113 | + } |
|
| 112 | 114 | |
| 113 | - if(!file_exists($file_path)) |
|
| 114 | - Debugger::logMessage("Requested file does not exist: {$type}, {$file}"); |
|
| 115 | + if(!file_exists($file_path)) {
|
|
| 116 | + Debugger::logMessage("Requested file does not exist: {$type}, {$file}");
|
|
| 117 | + } |
|
| 115 | 118 | |
| 116 | 119 | self::instance()->add_included_file($file_path); |
| 117 | 120 | |
@@ -160,10 +163,11 @@ discard block |
||
| 160 | 163 | |
| 161 | 164 | $reflectionObject = self::create_reflection_class($file); |
| 162 | 165 | |
| 163 | - if($reflectionObject->hasMethod('__construct')) |
|
| 164 | - return $reflectionObject->newInstanceArgs($data); |
|
| 165 | - else |
|
| 166 | - return $reflectionObject->newInstance(); |
|
| 166 | + if($reflectionObject->hasMethod('__construct')) {
|
|
| 167 | + return $reflectionObject->newInstanceArgs($data); |
|
| 168 | + } else {
|
|
| 169 | + return $reflectionObject->newInstance(); |
|
| 170 | + } |
|
| 167 | 171 | } |
| 168 | 172 | |
| 169 | 173 | public static function getRoot() |