@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | namespace Kenjis\MonkeyPatch\Patcher; |
| 12 | 12 | |
| 13 | -require __DIR__ . '/../Exception/ExitException.php'; |
|
| 13 | +require __DIR__.'/../Exception/ExitException.php'; |
|
| 14 | 14 | |
| 15 | 15 | class ExitPatcher |
| 16 | 16 | { |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | } |
| 31 | 31 | elseif ($token[0] === T_EXIT) |
| 32 | 32 | { |
| 33 | - if ($tokens[$i+1] === ';') |
|
| 33 | + if ($tokens[$i + 1] === ';') |
|
| 34 | 34 | { |
| 35 | 35 | $new_source .= 'exit__()'; |
| 36 | 36 | } |
@@ -27,20 +27,17 @@ |
||
| 27 | 27 | if (is_string($token)) |
| 28 | 28 | { |
| 29 | 29 | $new_source .= $token; |
| 30 | - } |
|
| 31 | - elseif ($token[0] === T_EXIT) |
|
| 30 | + } elseif ($token[0] === T_EXIT) |
|
| 32 | 31 | { |
| 33 | 32 | if ($tokens[$i+1] === ';') |
| 34 | 33 | { |
| 35 | 34 | $new_source .= 'exit__()'; |
| 36 | - } |
|
| 37 | - else |
|
| 35 | + } else |
|
| 38 | 36 | { |
| 39 | 37 | $new_source .= 'exit__'; |
| 40 | 38 | } |
| 41 | 39 | $patched = true; |
| 42 | - } |
|
| 43 | - else |
|
| 40 | + } else |
|
| 44 | 41 | { |
| 45 | 42 | $new_source .= $token[1]; |
| 46 | 43 | } |
@@ -12,36 +12,36 @@ |
||
| 12 | 12 | if (class_exists('PhpParser\Autoloader')) { |
| 13 | 13 | if (class_exists('PhpParser\Node\Identifier')) { |
| 14 | 14 | // PHP-Parser 4.x |
| 15 | - require __DIR__ . '/4.x/MonkeyPatchManager.php'; |
|
| 15 | + require __DIR__.'/4.x/MonkeyPatchManager.php'; |
|
| 16 | 16 | } |
| 17 | - elseif (method_exists('PhpParser\Node\Name','set')) { |
|
| 17 | + elseif (method_exists('PhpParser\Node\Name', 'set')) { |
|
| 18 | 18 | // PHP-Parser 2.x |
| 19 | - require __DIR__ . '/2.x/MonkeyPatchManager.php'; |
|
| 19 | + require __DIR__.'/2.x/MonkeyPatchManager.php'; |
|
| 20 | 20 | } else { |
| 21 | 21 | // PHP-Parser 3.x |
| 22 | - require __DIR__ . '/3.x/MonkeyPatchManager.php'; |
|
| 22 | + require __DIR__.'/3.x/MonkeyPatchManager.php'; |
|
| 23 | 23 | } |
| 24 | 24 | } |
| 25 | 25 | // If you don't use Composer |
| 26 | 26 | else { |
| 27 | 27 | if (version_compare(PHP_VERSION, '5.5.0', '>=')) { |
| 28 | 28 | // Use PHP-Parser 3.x |
| 29 | - require __DIR__ . '/third_party/PHP-Parser-3.1.5/lib/bootstrap.php'; |
|
| 30 | - require __DIR__ . '/3.x/MonkeyPatchManager.php'; |
|
| 29 | + require __DIR__.'/third_party/PHP-Parser-3.1.5/lib/bootstrap.php'; |
|
| 30 | + require __DIR__.'/3.x/MonkeyPatchManager.php'; |
|
| 31 | 31 | } else { |
| 32 | 32 | // Use PHP-Parser 2.x |
| 33 | - require __DIR__ . '/third_party/PHP-Parser-2.1.1/lib/bootstrap.php'; |
|
| 34 | - require __DIR__ . '/2.x/MonkeyPatchManager.php'; |
|
| 33 | + require __DIR__.'/third_party/PHP-Parser-2.1.1/lib/bootstrap.php'; |
|
| 34 | + require __DIR__.'/2.x/MonkeyPatchManager.php'; |
|
| 35 | 35 | } |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | -require __DIR__ . '/IncludeStream.php'; |
|
| 39 | -require __DIR__ . '/PathChecker.php'; |
|
| 40 | -require __DIR__ . '/MonkeyPatch.php'; |
|
| 41 | -require __DIR__ . '/Cache.php'; |
|
| 42 | -require __DIR__ . '/InvocationVerifier.php'; |
|
| 38 | +require __DIR__.'/IncludeStream.php'; |
|
| 39 | +require __DIR__.'/PathChecker.php'; |
|
| 40 | +require __DIR__.'/MonkeyPatch.php'; |
|
| 41 | +require __DIR__.'/Cache.php'; |
|
| 42 | +require __DIR__.'/InvocationVerifier.php'; |
|
| 43 | 43 | |
| 44 | -require __DIR__ . '/functions/exit__.php'; |
|
| 44 | +require __DIR__.'/functions/exit__.php'; |
|
| 45 | 45 | |
| 46 | 46 | const __GO_TO_ORIG__ = '__GO_TO_ORIG__'; |
| 47 | 47 | |
@@ -13,8 +13,7 @@ |
||
| 13 | 13 | if (class_exists('PhpParser\Node\Identifier')) { |
| 14 | 14 | // PHP-Parser 4.x |
| 15 | 15 | require __DIR__ . '/4.x/MonkeyPatchManager.php'; |
| 16 | - } |
|
| 17 | - elseif (method_exists('PhpParser\Node\Name','set')) { |
|
| 16 | + } elseif (method_exists('PhpParser\Node\Name','set')) { |
|
| 18 | 17 | // PHP-Parser 2.x |
| 19 | 18 | require __DIR__ . '/2.x/MonkeyPatchManager.php'; |
| 20 | 19 | } else { |
@@ -80,8 +80,7 @@ discard block |
||
| 80 | 80 | if (version_compare(PHP_VERSION, '5.3', '>=')) |
| 81 | 81 | { |
| 82 | 82 | error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED); |
| 83 | - } |
|
| 84 | - else |
|
| 83 | + } else |
|
| 85 | 84 | { |
| 86 | 85 | error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE); |
| 87 | 86 | } |
@@ -204,8 +203,7 @@ discard block |
||
| 204 | 203 | if (($_temp = realpath($system_path)) !== FALSE) |
| 205 | 204 | { |
| 206 | 205 | $system_path = $_temp.DIRECTORY_SEPARATOR; |
| 207 | - } |
|
| 208 | - else |
|
| 206 | + } else |
|
| 209 | 207 | { |
| 210 | 208 | // Ensure there's a trailing slash |
| 211 | 209 | $system_path = strtr( |
@@ -249,8 +247,7 @@ discard block |
||
| 249 | 247 | if (($_temp = realpath($application_folder)) !== FALSE) |
| 250 | 248 | { |
| 251 | 249 | $application_folder = $_temp; |
| 252 | - } |
|
| 253 | - else |
|
| 250 | + } else |
|
| 254 | 251 | { |
| 255 | 252 | $application_folder = strtr( |
| 256 | 253 | rtrim($application_folder, '/\\'), |
@@ -258,16 +255,14 @@ discard block |
||
| 258 | 255 | DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR |
| 259 | 256 | ); |
| 260 | 257 | } |
| 261 | - } |
|
| 262 | - elseif (is_dir(BASEPATH.$application_folder.DIRECTORY_SEPARATOR)) |
|
| 258 | + } elseif (is_dir(BASEPATH.$application_folder.DIRECTORY_SEPARATOR)) |
|
| 263 | 259 | { |
| 264 | 260 | $application_folder = BASEPATH.strtr( |
| 265 | 261 | trim($application_folder, '/\\'), |
| 266 | 262 | '/\\', |
| 267 | 263 | DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR |
| 268 | 264 | ); |
| 269 | - } |
|
| 270 | - else |
|
| 265 | + } else |
|
| 271 | 266 | { |
| 272 | 267 | header('HTTP/1.1 503 Service Unavailable.', TRUE, 503); |
| 273 | 268 | echo 'Your application folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF; |
@@ -280,14 +275,12 @@ discard block |
||
| 280 | 275 | if ( ! isset($view_folder[0]) && is_dir(APPPATH.'views'.DIRECTORY_SEPARATOR)) |
| 281 | 276 | { |
| 282 | 277 | $view_folder = APPPATH.'views'; |
| 283 | - } |
|
| 284 | - elseif (is_dir($view_folder)) |
|
| 278 | + } elseif (is_dir($view_folder)) |
|
| 285 | 279 | { |
| 286 | 280 | if (($_temp = realpath($view_folder)) !== FALSE) |
| 287 | 281 | { |
| 288 | 282 | $view_folder = $_temp; |
| 289 | - } |
|
| 290 | - else |
|
| 283 | + } else |
|
| 291 | 284 | { |
| 292 | 285 | $view_folder = strtr( |
| 293 | 286 | rtrim($view_folder, '/\\'), |
@@ -295,16 +288,14 @@ discard block |
||
| 295 | 288 | DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR |
| 296 | 289 | ); |
| 297 | 290 | } |
| 298 | - } |
|
| 299 | - elseif (is_dir(APPPATH.$view_folder.DIRECTORY_SEPARATOR)) |
|
| 291 | + } elseif (is_dir(APPPATH.$view_folder.DIRECTORY_SEPARATOR)) |
|
| 300 | 292 | { |
| 301 | 293 | $view_folder = APPPATH.strtr( |
| 302 | 294 | trim($view_folder, '/\\'), |
| 303 | 295 | '/\\', |
| 304 | 296 | DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR |
| 305 | 297 | ); |
| 306 | - } |
|
| 307 | - else |
|
| 298 | + } else |
|
| 308 | 299 | { |
| 309 | 300 | header('HTTP/1.1 503 Service Unavailable.', TRUE, 503); |
| 310 | 301 | echo 'Your view folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF; |
@@ -317,8 +308,7 @@ discard block |
||
| 317 | 308 | if (is_file(TESTPATH . '_ci_phpunit_test' . DIRECTORY_SEPARATOR . 'CIPHPUnitTest.php')) |
| 318 | 309 | { |
| 319 | 310 | define('CI_PHPUNIT_TESTPATH', TESTPATH . '_ci_phpunit_test' . DIRECTORY_SEPARATOR); |
| 320 | - } |
|
| 321 | - else |
|
| 311 | + } else |
|
| 322 | 312 | { |
| 323 | 313 | // Assume Composer with a vendor directory parallel to the application directory |
| 324 | 314 | define('CI_PHPUNIT_TESTPATH', implode( |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | // Define testing environment for ci-phpunit-test |
| 58 | 58 | // This `if` statement is needed for @runInSeparateProcess |
| 59 | -if (! defined('ENVIRONMENT')) |
|
| 59 | +if ( ! defined('ENVIRONMENT')) |
|
| 60 | 60 | { |
| 61 | 61 | define('ENVIRONMENT', 'testing'); |
| 62 | 62 | } |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME)); |
| 245 | 245 | |
| 246 | 246 | // Path to the test directory containing all the test files. |
| 247 | - define('TESTPATH', __DIR__.DIRECTORY_SEPARATOR); // Should be the folder this `Bootstrap.php` file is in. |
|
| 247 | + define('TESTPATH', __DIR__.DIRECTORY_SEPARATOR); // Should be the folder this `Bootstrap.php` file is in. |
|
| 248 | 248 | |
| 249 | 249 | // Path to the system directory |
| 250 | 250 | define('BASEPATH', $system_path); |
@@ -326,9 +326,9 @@ discard block |
||
| 326 | 326 | define('VIEWPATH', $view_folder.DIRECTORY_SEPARATOR); |
| 327 | 327 | |
| 328 | 328 | // Path to the ci-phpunit-test directory |
| 329 | - if (is_file(TESTPATH . '_ci_phpunit_test' . DIRECTORY_SEPARATOR . 'CIPHPUnitTest.php')) |
|
| 329 | + if (is_file(TESTPATH.'_ci_phpunit_test'.DIRECTORY_SEPARATOR.'CIPHPUnitTest.php')) |
|
| 330 | 330 | { |
| 331 | - define('CI_PHPUNIT_TESTPATH', TESTPATH . '_ci_phpunit_test' . DIRECTORY_SEPARATOR); |
|
| 331 | + define('CI_PHPUNIT_TESTPATH', TESTPATH.'_ci_phpunit_test'.DIRECTORY_SEPARATOR); |
|
| 332 | 332 | } |
| 333 | 333 | else |
| 334 | 334 | { |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | * ------------------------------------------------------------------- |
| 390 | 390 | */ |
| 391 | 391 | |
| 392 | -require CI_PHPUNIT_TESTPATH . '/CIPHPUnitTest.php'; |
|
| 392 | +require CI_PHPUNIT_TESTPATH.'/CIPHPUnitTest.php'; |
|
| 393 | 393 | |
| 394 | 394 | CIPHPUnitTest::init(); |
| 395 | 395 | // Or you can set directories for autoloading |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | // Support PHPUnit 6.0 |
| 46 | 46 | if (! class_exists('PHPUnit_Util_Configuration')) { |
| 47 | - class_alias('PHPUnit\Util\Configuration', 'PHPUnit_Util_Configuration'); |
|
| 47 | + class_alias('PHPUnit\Util\Configuration', 'PHPUnit_Util_Configuration'); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | /** |
@@ -57,71 +57,71 @@ discard block |
||
| 57 | 57 | */ |
| 58 | 58 | final class TestSuiteProvider |
| 59 | 59 | { |
| 60 | - /** |
|
| 61 | - * phpunit configuration file |
|
| 62 | - * |
|
| 63 | - * @var string |
|
| 64 | - */ |
|
| 65 | - private static $file; |
|
| 60 | + /** |
|
| 61 | + * phpunit configuration file |
|
| 62 | + * |
|
| 63 | + * @var string |
|
| 64 | + */ |
|
| 65 | + private static $file; |
|
| 66 | 66 | |
| 67 | - /** |
|
| 68 | - * constructor |
|
| 69 | - */ |
|
| 70 | - private function __construct() {} |
|
| 67 | + /** |
|
| 68 | + * constructor |
|
| 69 | + */ |
|
| 70 | + private function __construct() {} |
|
| 71 | 71 | |
| 72 | - /** |
|
| 73 | - * set the phpunit configuration file |
|
| 74 | - * |
|
| 75 | - * @param string $file the path or filename of the phunit configuration file |
|
| 76 | - */ |
|
| 77 | - public static function setConfigurationFile($file) |
|
| 78 | - { |
|
| 79 | - static::$file = $file; |
|
| 80 | - } |
|
| 72 | + /** |
|
| 73 | + * set the phpunit configuration file |
|
| 74 | + * |
|
| 75 | + * @param string $file the path or filename of the phunit configuration file |
|
| 76 | + */ |
|
| 77 | + public static function setConfigurationFile($file) |
|
| 78 | + { |
|
| 79 | + static::$file = $file; |
|
| 80 | + } |
|
| 81 | 81 | |
| 82 | - /** |
|
| 83 | - * get the phpunit test suite instance |
|
| 84 | - * |
|
| 85 | - * @return PHPUnit_Framework_TestSuite returns the phpunit test suite instance |
|
| 86 | - * @throws FileNotFoundException if the file is not found |
|
| 87 | - */ |
|
| 88 | - public static function suite() |
|
| 89 | - { |
|
| 90 | - $file = static::checkConfigurationFile( |
|
| 91 | - static::getConfigurationFile() |
|
| 92 | - ); |
|
| 82 | + /** |
|
| 83 | + * get the phpunit test suite instance |
|
| 84 | + * |
|
| 85 | + * @return PHPUnit_Framework_TestSuite returns the phpunit test suite instance |
|
| 86 | + * @throws FileNotFoundException if the file is not found |
|
| 87 | + */ |
|
| 88 | + public static function suite() |
|
| 89 | + { |
|
| 90 | + $file = static::checkConfigurationFile( |
|
| 91 | + static::getConfigurationFile() |
|
| 92 | + ); |
|
| 93 | 93 | |
| 94 | - return PHPUnit_Util_Configuration::getInstance($file) |
|
| 95 | - ->getTestSuiteConfiguration(); |
|
| 96 | - } |
|
| 94 | + return PHPUnit_Util_Configuration::getInstance($file) |
|
| 95 | + ->getTestSuiteConfiguration(); |
|
| 96 | + } |
|
| 97 | 97 | |
| 98 | - /** |
|
| 99 | - * get the phpunit configuration file |
|
| 100 | - * |
|
| 101 | - * @return string |
|
| 102 | - */ |
|
| 103 | - private static function getConfigurationFile() |
|
| 104 | - { |
|
| 105 | - static::$file = isset(static::$file) |
|
| 106 | - ? static::$file |
|
| 107 | - : TESTPATH.'phpunit.xml'; |
|
| 98 | + /** |
|
| 99 | + * get the phpunit configuration file |
|
| 100 | + * |
|
| 101 | + * @return string |
|
| 102 | + */ |
|
| 103 | + private static function getConfigurationFile() |
|
| 104 | + { |
|
| 105 | + static::$file = isset(static::$file) |
|
| 106 | + ? static::$file |
|
| 107 | + : TESTPATH.'phpunit.xml'; |
|
| 108 | 108 | |
| 109 | - return static::$file; |
|
| 110 | - } |
|
| 109 | + return static::$file; |
|
| 110 | + } |
|
| 111 | 111 | |
| 112 | - /** |
|
| 113 | - * check the given file |
|
| 114 | - * |
|
| 115 | - * @param string $file file to check |
|
| 116 | - * @return string returns the file if it is valid |
|
| 117 | - * @throws FileNotFoundException if the file is not found |
|
| 118 | - */ |
|
| 119 | - private static function checkConfigurationFile($file) |
|
| 120 | - { |
|
| 121 | - if (!file_exists($file)) { |
|
| 122 | - throw new \RuntimeException("The requested phpunit configuration was not found at $file"); |
|
| 123 | - } |
|
| 112 | + /** |
|
| 113 | + * check the given file |
|
| 114 | + * |
|
| 115 | + * @param string $file file to check |
|
| 116 | + * @return string returns the file if it is valid |
|
| 117 | + * @throws FileNotFoundException if the file is not found |
|
| 118 | + */ |
|
| 119 | + private static function checkConfigurationFile($file) |
|
| 120 | + { |
|
| 121 | + if (!file_exists($file)) { |
|
| 122 | + throw new \RuntimeException("The requested phpunit configuration was not found at $file"); |
|
| 123 | + } |
|
| 124 | 124 | |
| 125 | - return $file; |
|
| 126 | - } |
|
| 125 | + return $file; |
|
| 126 | + } |
|
| 127 | 127 | } |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | use PHPUnit_Util_Configuration; |
| 44 | 44 | |
| 45 | 45 | // Support PHPUnit 6.0 |
| 46 | -if (! class_exists('PHPUnit_Util_Configuration')) { |
|
| 46 | +if ( ! class_exists('PHPUnit_Util_Configuration')) { |
|
| 47 | 47 | class_alias('PHPUnit\Util\Configuration', 'PHPUnit_Util_Configuration'); |
| 48 | 48 | } |
| 49 | 49 | |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | */ |
| 119 | 119 | private static function checkConfigurationFile($file) |
| 120 | 120 | { |
| 121 | - if (!file_exists($file)) { |
|
| 121 | + if ( ! file_exists($file)) { |
|
| 122 | 122 | throw new \RuntimeException("The requested phpunit configuration was not found at $file"); |
| 123 | 123 | } |
| 124 | 124 | |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | { |
| 36 | 36 | if ($this->db === null) |
| 37 | 37 | { |
| 38 | - $CI =& get_instance(); |
|
| 38 | + $CI = & get_instance(); |
|
| 39 | 39 | $CI->load->database(); |
| 40 | 40 | $this->db = $CI->db; |
| 41 | 41 | } |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | { |
| 57 | 57 | $this->checkDbConnId(); |
| 58 | 58 | |
| 59 | - if (! empty($this->insertCache)) |
|
| 59 | + if ( ! empty($this->insertCache)) |
|
| 60 | 60 | { |
| 61 | 61 | foreach ($this->insertCache as $row) |
| 62 | 62 | { |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | $this->db->close(); |
| 84 | 84 | $this->db = null; |
| 85 | 85 | |
| 86 | - $CI =& get_instance(); |
|
| 86 | + $CI = & get_instance(); |
|
| 87 | 87 | $CI->load->database(); |
| 88 | 88 | $this->db = $CI->db; |
| 89 | 89 | } |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | * |
| 33 | 33 | * @param string $classname |
| 34 | 34 | * @param array $params [method_name => return_value] |
| 35 | - * @param mixed $constructor_params false: disable constructor, array: constructor params |
|
| 35 | + * @param boolean $constructor_params false: disable constructor, array: constructor params |
|
| 36 | 36 | * |
| 37 | 37 | * @return mixed PHPUnit mock object |
| 38 | 38 | */ |
@@ -95,6 +95,10 @@ discard block |
||
| 95 | 95 | return $mock; |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | + /** |
|
| 99 | + * @param string $method |
|
| 100 | + * @param string $with |
|
| 101 | + */ |
|
| 98 | 102 | protected function _verify($mock, $method, $params = null, $expects, $with) |
| 99 | 103 | { |
| 100 | 104 | $invocation = $mock->expects($expects) |
@@ -46,8 +46,7 @@ |
||
| 46 | 46 | if ($constructor_params === false) |
| 47 | 47 | { |
| 48 | 48 | $mockBuilder->disableOriginalConstructor(); |
| 49 | - } |
|
| 50 | - elseif (is_array($constructor_params)) |
|
| 49 | + } elseif (is_array($constructor_params)) |
|
| 51 | 50 | { |
| 52 | 51 | $mockBuilder->setConstructorArgs($constructor_params); |
| 53 | 52 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | // Load the mime types |
| 75 | - $mimes =& get_mimes(); |
|
| 75 | + $mimes = & get_mimes(); |
|
| 76 | 76 | |
| 77 | 77 | // Only change the default MIME if we can find one |
| 78 | 78 | if (isset($mimes[$extension])) |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | |
| 118 | 118 | if (is_testing_env()) |
| 119 | 119 | { |
| 120 | - $CI =& get_instance(); |
|
| 120 | + $CI = & get_instance(); |
|
| 121 | 121 | $CI->output->set_header('Content-Type: '.$mime); |
| 122 | 122 | $CI->output->set_header('Content-Disposition: attachment; filename="'.$filename.'"'); |
| 123 | 123 | $CI->output->set_header('Expires: 0'); |
@@ -38,8 +38,7 @@ discard block |
||
| 38 | 38 | if ($filename === '' OR $data === '') |
| 39 | 39 | { |
| 40 | 40 | return; |
| 41 | - } |
|
| 42 | - elseif ($data === NULL) |
|
| 41 | + } elseif ($data === NULL) |
|
| 43 | 42 | { |
| 44 | 43 | if ( ! @is_file($filename) OR ($filesize = @filesize($filename)) === FALSE) |
| 45 | 44 | { |
@@ -49,8 +48,7 @@ discard block |
||
| 49 | 48 | $filepath = $filename; |
| 50 | 49 | $filename = explode('/', str_replace(DIRECTORY_SEPARATOR, '/', $filename)); |
| 51 | 50 | $filename = end($filename); |
| 52 | - } |
|
| 53 | - else |
|
| 51 | + } else |
|
| 54 | 52 | { |
| 55 | 53 | $filesize = strlen($data); |
| 56 | 54 | } |
@@ -137,8 +135,7 @@ discard block |
||
| 137 | 135 | if ( ! is_testing_env()) |
| 138 | 136 | { |
| 139 | 137 | exit($data); |
| 140 | - } |
|
| 141 | - else |
|
| 138 | + } else |
|
| 142 | 139 | { |
| 143 | 140 | echo($data); |
| 144 | 141 | throw new CIPHPUnitTestExitException('exit() from force_download()'); |
@@ -155,8 +152,7 @@ discard block |
||
| 155 | 152 | if ( ! is_testing_env()) |
| 156 | 153 | { |
| 157 | 154 | exit; |
| 158 | - } |
|
| 159 | - else |
|
| 155 | + } else |
|
| 160 | 156 | { |
| 161 | 157 | throw new CIPHPUnitTestExitException('exit() from force_download()'); |
| 162 | 158 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | // Load the mime types |
| 75 | - $mimes =& get_mimes(); |
|
| 75 | + $mimes = & get_mimes(); |
|
| 76 | 76 | |
| 77 | 77 | // Only change the default MIME if we can find one |
| 78 | 78 | if (isset($mimes[$extension])) |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | |
| 118 | 118 | if (is_testing_env()) |
| 119 | 119 | { |
| 120 | - $CI =& get_instance(); |
|
| 120 | + $CI = & get_instance(); |
|
| 121 | 121 | $CI->output->set_header('Content-Type: '.$mime); |
| 122 | 122 | $CI->output->set_header('Content-Disposition: attachment; filename="'.$filename.'"'); |
| 123 | 123 | $CI->output->set_header('Expires: 0'); |
@@ -38,8 +38,7 @@ discard block |
||
| 38 | 38 | if ($filename === '' OR $data === '') |
| 39 | 39 | { |
| 40 | 40 | return; |
| 41 | - } |
|
| 42 | - elseif ($data === NULL) |
|
| 41 | + } elseif ($data === NULL) |
|
| 43 | 42 | { |
| 44 | 43 | if ( ! @is_file($filename) OR ($filesize = @filesize($filename)) === FALSE) |
| 45 | 44 | { |
@@ -49,8 +48,7 @@ discard block |
||
| 49 | 48 | $filepath = $filename; |
| 50 | 49 | $filename = explode('/', str_replace(DIRECTORY_SEPARATOR, '/', $filename)); |
| 51 | 50 | $filename = end($filename); |
| 52 | - } |
|
| 53 | - else |
|
| 51 | + } else |
|
| 54 | 52 | { |
| 55 | 53 | $filesize = strlen($data); |
| 56 | 54 | } |
@@ -137,8 +135,7 @@ discard block |
||
| 137 | 135 | if ( ! is_testing_env()) |
| 138 | 136 | { |
| 139 | 137 | exit($data); |
| 140 | - } |
|
| 141 | - else |
|
| 138 | + } else |
|
| 142 | 139 | { |
| 143 | 140 | echo($data); |
| 144 | 141 | throw new CIPHPUnitTestExitException('exit() from force_download()'); |
@@ -155,8 +152,7 @@ discard block |
||
| 155 | 152 | if ( ! is_testing_env()) |
| 156 | 153 | { |
| 157 | 154 | exit; |
| 158 | - } |
|
| 159 | - else |
|
| 155 | + } else |
|
| 160 | 156 | { |
| 161 | 157 | throw new CIPHPUnitTestExitException('exit() from force_download()'); |
| 162 | 158 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | // Load the mime types |
| 75 | - $mimes =& get_mimes(); |
|
| 75 | + $mimes = & get_mimes(); |
|
| 76 | 76 | |
| 77 | 77 | // Only change the default MIME if we can find one |
| 78 | 78 | if (isset($mimes[$extension])) |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | |
| 118 | 118 | if (is_testing_env()) |
| 119 | 119 | { |
| 120 | - $CI =& get_instance(); |
|
| 120 | + $CI = & get_instance(); |
|
| 121 | 121 | $CI->output->set_header('Content-Type: '.$mime); |
| 122 | 122 | $CI->output->set_header('Content-Disposition: attachment; filename="'.$filename.'"'); |
| 123 | 123 | $CI->output->set_header('Expires: 0'); |
@@ -38,8 +38,7 @@ discard block |
||
| 38 | 38 | if ($filename === '' OR $data === '') |
| 39 | 39 | { |
| 40 | 40 | return; |
| 41 | - } |
|
| 42 | - elseif ($data === NULL) |
|
| 41 | + } elseif ($data === NULL) |
|
| 43 | 42 | { |
| 44 | 43 | if ( ! @is_file($filename) OR ($filesize = @filesize($filename)) === FALSE) |
| 45 | 44 | { |
@@ -49,8 +48,7 @@ discard block |
||
| 49 | 48 | $filepath = $filename; |
| 50 | 49 | $filename = explode('/', str_replace(DIRECTORY_SEPARATOR, '/', $filename)); |
| 51 | 50 | $filename = end($filename); |
| 52 | - } |
|
| 53 | - else |
|
| 51 | + } else |
|
| 54 | 52 | { |
| 55 | 53 | $filesize = strlen($data); |
| 56 | 54 | } |
@@ -137,8 +135,7 @@ discard block |
||
| 137 | 135 | if ( ! is_testing_env()) |
| 138 | 136 | { |
| 139 | 137 | exit($data); |
| 140 | - } |
|
| 141 | - else |
|
| 138 | + } else |
|
| 142 | 139 | { |
| 143 | 140 | echo($data); |
| 144 | 141 | throw new CIPHPUnitTestExitException('exit() from force_download()'); |
@@ -155,8 +152,7 @@ discard block |
||
| 155 | 152 | if ( ! is_testing_env()) |
| 156 | 153 | { |
| 157 | 154 | exit; |
| 158 | - } |
|
| 159 | - else |
|
| 155 | + } else |
|
| 160 | 156 | { |
| 161 | 157 | throw new CIPHPUnitTestExitException('exit() from force_download()'); |
| 162 | 158 | } |