@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | } else { |
40 | 40 | if ($throwException) { |
41 | 41 | // @todo is this the correct exception to throw? |
42 | - throw new \OutOfBoundsException('Unknown array index: ' . $key); |
|
42 | + throw new \OutOfBoundsException('Unknown array index: '.$key); |
|
43 | 43 | } |
44 | 44 | } |
45 | 45 | return $default; |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | public static function average($arr) |
58 | 58 | { |
59 | - if (!is_array($arr)) throw new \InvalidArgumentException('"average" function expected array, got ' . gettype($arr)); |
|
59 | + if (!is_array($arr)) throw new \InvalidArgumentException('"average" function expected array, got '.gettype($arr)); |
|
60 | 60 | return array_sum($arr) / count($arr); |
61 | 61 | } |
62 | 62 | |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | |
72 | 72 | public static function mode($arr) |
73 | 73 | { |
74 | - if (!is_array($arr)) throw new \InvalidArgumentException('"mode" function expected array, got ' . gettype($arr)); |
|
74 | + if (!is_array($arr)) throw new \InvalidArgumentException('"mode" function expected array, got '.gettype($arr)); |
|
75 | 75 | $vals = array(); |
76 | 76 | foreach ($arr as $key => $val) { |
77 | 77 | $vals[$val] = self::array_get($vals, $val, 0) + 1; |
@@ -56,7 +56,9 @@ discard block |
||
56 | 56 | |
57 | 57 | public static function average($arr) |
58 | 58 | { |
59 | - if (!is_array($arr)) throw new \InvalidArgumentException('"average" function expected array, got ' . gettype($arr)); |
|
59 | + if (!is_array($arr)) { |
|
60 | + throw new \InvalidArgumentException('"average" function expected array, got ' . gettype($arr)); |
|
61 | + } |
|
60 | 62 | return array_sum($arr) / count($arr); |
61 | 63 | } |
62 | 64 | |
@@ -71,7 +73,9 @@ discard block |
||
71 | 73 | |
72 | 74 | public static function mode($arr) |
73 | 75 | { |
74 | - if (!is_array($arr)) throw new \InvalidArgumentException('"mode" function expected array, got ' . gettype($arr)); |
|
76 | + if (!is_array($arr)) { |
|
77 | + throw new \InvalidArgumentException('"mode" function expected array, got ' . gettype($arr)); |
|
78 | + } |
|
75 | 79 | $vals = array(); |
76 | 80 | foreach ($arr as $key => $val) { |
77 | 81 | $vals[$val] = self::array_get($vals, $val, 0) + 1; |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | { |
124 | 124 | self::assertFileExists($filename); |
125 | 125 | if (!is_readable($filename)) { |
126 | - throw new IOException('Permission denied for: ' . $filename, IOException::ERR_FILE_PERMISSION_DENIED); |
|
126 | + throw new IOException('Permission denied for: '.$filename, IOException::ERR_FILE_PERMISSION_DENIED); |
|
127 | 127 | } |
128 | 128 | } |
129 | 129 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | protected static function assertFileExists($filename) |
138 | 138 | { |
139 | 139 | if (!file_exists($filename)) { |
140 | - throw new IOException('File does not exist: ' . $filename, IOException::ERR_FILE_NOT_FOUND); |
|
140 | + throw new IOException('File does not exist: '.$filename, IOException::ERR_FILE_NOT_FOUND); |
|
141 | 141 | } |
142 | 142 | } |
143 | 143 | } |
@@ -62,10 +62,10 @@ discard block |
||
62 | 62 | $paths = $this->getPaths(); |
63 | 63 | if ($rp = realpath($path)) { |
64 | 64 | if (in_array($rp, $paths)) return true; |
65 | - $this->paths []= $rp; |
|
65 | + $this->paths [] = $rp; |
|
66 | 66 | return true; |
67 | 67 | } |
68 | - $this->paths []= $path; |
|
68 | + $this->paths [] = $path; |
|
69 | 69 | return false; |
70 | 70 | } |
71 | 71 | |
@@ -113,14 +113,14 @@ discard block |
||
113 | 113 | */ |
114 | 114 | public function load($className) |
115 | 115 | { |
116 | - if(class_exists($className)) { |
|
116 | + if (class_exists($className)) { |
|
117 | 117 | return; |
118 | 118 | } |
119 | 119 | $fqcp = str_replace(self::NAMESPACE_SEPARATOR, DIRECTORY_SEPARATOR, $className); |
120 | 120 | $paths = $this->getPaths(); |
121 | 121 | foreach ($paths as $path) { |
122 | - $classPath = $path . DIRECTORY_SEPARATOR . $fqcp . '.php'; |
|
123 | - if(file_exists($classPath) && is_readable($classPath)) { |
|
122 | + $classPath = $path.DIRECTORY_SEPARATOR.$fqcp.'.php'; |
|
123 | + if (file_exists($classPath) && is_readable($classPath)) { |
|
124 | 124 | require_once($classPath); |
125 | 125 | return; |
126 | 126 | } |
@@ -61,7 +61,9 @@ |
||
61 | 61 | { |
62 | 62 | $paths = $this->getPaths(); |
63 | 63 | if ($rp = realpath($path)) { |
64 | - if (in_array($rp, $paths)) return true; |
|
64 | + if (in_array($rp, $paths)) { |
|
65 | + return true; |
|
66 | + } |
|
65 | 67 | $this->paths []= $rp; |
66 | 68 | return true; |
67 | 69 | } |
@@ -19,7 +19,6 @@ |
||
19 | 19 | if (if $file->hasHeader()) { |
20 | 20 | $header = $file->getHeader() |
21 | 21 | } |
22 | - |
|
23 | 22 | * you can instead simply call $header->getHeader() and handle this exception if |
24 | 23 | * said file has no header |
25 | 24 | * |