@@ -17,23 +17,23 @@ discard block |
||
| 17 | 17 | * |
| 18 | 18 | * @return void |
| 19 | 19 | */ |
| 20 | - public function setUp() { |
|
| 21 | - parent::setUp(); |
|
| 20 | + public function setUp() { |
|
| 21 | + parent::setUp(); |
|
| 22 | 22 | |
| 23 | - $this->VatNumberCheck = new VatNumberCheck(); |
|
| 24 | - // $this->VatNumberCheck->setDataSource('vatNumberCheckWebservice'); |
|
| 25 | - } |
|
| 23 | + $this->VatNumberCheck = new VatNumberCheck(); |
|
| 24 | + // $this->VatNumberCheck->setDataSource('vatNumberCheckWebservice'); |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | 27 | /** |
| 28 | 28 | * tearDown method |
| 29 | 29 | * |
| 30 | 30 | * @return void |
| 31 | 31 | */ |
| 32 | - public function tearDown() { |
|
| 33 | - unset($this->VatNumberCheck); |
|
| 32 | + public function tearDown() { |
|
| 33 | + unset($this->VatNumberCheck); |
|
| 34 | 34 | |
| 35 | - parent::tearDown(); |
|
| 36 | - } |
|
| 35 | + parent::tearDown(); |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | 38 | /** |
| 39 | 39 | * Tests `normalize`. |
@@ -43,29 +43,29 @@ discard block |
||
| 43 | 43 | * @return void |
| 44 | 44 | * @dataProvider normalizeProvider |
| 45 | 45 | */ |
| 46 | - public function testNormalize(string $vatNumber, string $expected) { |
|
| 47 | - $actual = $this->VatNumberCheck->normalize($vatNumber); |
|
| 48 | - $this->assertSame($expected, $actual); |
|
| 49 | - } |
|
| 46 | + public function testNormalize(string $vatNumber, string $expected) { |
|
| 47 | + $actual = $this->VatNumberCheck->normalize($vatNumber); |
|
| 48 | + $this->assertSame($expected, $actual); |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | 51 | /** |
| 52 | 52 | * Data provider for `normalize`. |
| 53 | 53 | * |
| 54 | 54 | * @return array |
| 55 | 55 | */ |
| 56 | - public function normalizeProvider() : array { |
|
| 57 | - return [ |
|
| 58 | - // $vatNumber, $expected |
|
| 56 | + public function normalizeProvider() : array { |
|
| 57 | + return [ |
|
| 58 | + // $vatNumber, $expected |
|
| 59 | 59 | |
| 60 | - // Correct |
|
| 61 | - ['NL820345672B01', 'NL820345672B01'], |
|
| 62 | - // To upper case |
|
| 63 | - ['NL820345672b01', 'NL820345672B01'], |
|
| 64 | - // Removal of non-alphanumeric |
|
| 65 | - ['NL820345672 B01', 'NL820345672B01'], |
|
| 66 | - ['NL820345672!B01', 'NL820345672B01'], |
|
| 67 | - ]; |
|
| 68 | - } |
|
| 60 | + // Correct |
|
| 61 | + ['NL820345672B01', 'NL820345672B01'], |
|
| 62 | + // To upper case |
|
| 63 | + ['NL820345672b01', 'NL820345672B01'], |
|
| 64 | + // Removal of non-alphanumeric |
|
| 65 | + ['NL820345672 B01', 'NL820345672B01'], |
|
| 66 | + ['NL820345672!B01', 'NL820345672B01'], |
|
| 67 | + ]; |
|
| 68 | + } |
|
| 69 | 69 | |
| 70 | 70 | /** |
| 71 | 71 | * Tests `check`. |
@@ -75,33 +75,33 @@ discard block |
||
| 75 | 75 | * @return void |
| 76 | 76 | * @dataProvider checkProvider |
| 77 | 77 | */ |
| 78 | - public function testCheck(string $vatNumber, bool $expected) { |
|
| 78 | + public function testCheck(string $vatNumber, bool $expected) { |
|
| 79 | 79 | $actual = $this->VatNumberCheck->check($vatNumber); |
| 80 | - $this->assertSame($expected, $actual); |
|
| 81 | - } |
|
| 80 | + $this->assertSame($expected, $actual); |
|
| 81 | + } |
|
| 82 | 82 | |
| 83 | 83 | /** |
| 84 | 84 | * Data provider for `check`. |
| 85 | 85 | * |
| 86 | 86 | * @return array |
| 87 | 87 | */ |
| 88 | - public function checkProvider() : array { |
|
| 89 | - return [ |
|
| 90 | - // $vatNumber, $expected |
|
| 91 | - // Correct |
|
| 92 | - ['NL820345672B01', true], |
|
| 93 | - ['BE0475899519', true], |
|
| 94 | - // Incorrect vat |
|
| 95 | - ['NL820345672B02', false], |
|
| 96 | - ]; |
|
| 97 | - } |
|
| 88 | + public function checkProvider() : array { |
|
| 89 | + return [ |
|
| 90 | + // $vatNumber, $expected |
|
| 91 | + // Correct |
|
| 92 | + ['NL820345672B01', true], |
|
| 93 | + ['BE0475899519', true], |
|
| 94 | + // Incorrect vat |
|
| 95 | + ['NL820345672B02', false], |
|
| 96 | + ]; |
|
| 97 | + } |
|
| 98 | 98 | |
| 99 | 99 | /** |
| 100 | 100 | * Tests `check` with invalid data. |
| 101 | 101 | * |
| 102 | 102 | */ |
| 103 | - public function testCheckInvalid() { |
|
| 104 | - $this->expectException(InternalErrorException::class); |
|
| 105 | - $this->VatNumberCheck->check(''); |
|
| 106 | - } |
|
| 103 | + public function testCheckInvalid() { |
|
| 104 | + $this->expectException(InternalErrorException::class); |
|
| 105 | + $this->VatNumberCheck->check(''); |
|
| 106 | + } |
|
| 107 | 107 | } |
@@ -32,10 +32,10 @@ |
||
| 32 | 32 | $VatNumberChecks = new VatNumberCheck(); |
| 33 | 33 | } |
| 34 | 34 | /** |
| 35 | - * Tests `/vat_number_check/vat_number_checks/check.json`. |
|
| 36 | - * |
|
| 37 | - * @return void |
|
| 38 | - */ |
|
| 35 | + * Tests `/vat_number_check/vat_number_checks/check.json`. |
|
| 36 | + * |
|
| 37 | + * @return void |
|
| 38 | + */ |
|
| 39 | 39 | public function testCheck() { |
| 40 | 40 | $url = '/vat_number_check/vat_number_checks/check.json'; |
| 41 | 41 | // Post request, correct vat |
@@ -5,6 +5,6 @@ |
||
| 5 | 5 | use Cake\Routing\Route\DashedRoute; |
| 6 | 6 | Router::defaultRouteClass(DashedRoute::class); |
| 7 | 7 | Router::scope('/', function (RouteBuilder $routes) { |
| 8 | - $routes->fallbacks(DashedRoute::class); |
|
| 8 | + $routes->fallbacks(DashedRoute::class); |
|
| 9 | 9 | }); |
| 10 | 10 | Plugin::routes(); |
@@ -4,7 +4,7 @@ |
||
| 4 | 4 | use Cake\Routing\Router; |
| 5 | 5 | use Cake\Routing\Route\DashedRoute; |
| 6 | 6 | Router::defaultRouteClass(DashedRoute::class); |
| 7 | -Router::scope('/', function (RouteBuilder $routes) { |
|
| 7 | +Router::scope('/', function(RouteBuilder $routes) { |
|
| 8 | 8 | $routes->fallbacks(DashedRoute::class); |
| 9 | 9 | }); |
| 10 | 10 | Plugin::routes(); |
@@ -1,251 +1,251 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | return [ |
| 3 | - /** |
|
| 4 | - * Debug Level: |
|
| 5 | - * |
|
| 6 | - * Production Mode: |
|
| 7 | - * false: No error messages, errors, or warnings shown. |
|
| 8 | - * |
|
| 9 | - * Development Mode: |
|
| 10 | - * true: Errors and warnings shown. |
|
| 11 | - */ |
|
| 12 | - 'debug' => filter_var(env('DEBUG', true), FILTER_VALIDATE_BOOLEAN), |
|
| 3 | + /** |
|
| 4 | + * Debug Level: |
|
| 5 | + * |
|
| 6 | + * Production Mode: |
|
| 7 | + * false: No error messages, errors, or warnings shown. |
|
| 8 | + * |
|
| 9 | + * Development Mode: |
|
| 10 | + * true: Errors and warnings shown. |
|
| 11 | + */ |
|
| 12 | + 'debug' => filter_var(env('DEBUG', true), FILTER_VALIDATE_BOOLEAN), |
|
| 13 | 13 | |
| 14 | - /** |
|
| 15 | - * Configure basic information about the application. |
|
| 16 | - * |
|
| 17 | - * - namespace - The namespace to find app classes under. |
|
| 18 | - * - defaultLocale - The default locale for translation, formatting currencies and numbers, date and time. |
|
| 19 | - * - encoding - The encoding used for HTML + database connections. |
|
| 20 | - * - base - The base directory the app resides in. If false this |
|
| 21 | - * will be auto detected. |
|
| 22 | - * - dir - Name of app directory. |
|
| 23 | - * - webroot - The webroot directory. |
|
| 24 | - * - wwwRoot - The file path to webroot. |
|
| 25 | - * - baseUrl - To configure CakePHP to *not* use mod_rewrite and to |
|
| 26 | - * use CakePHP pretty URLs, remove these .htaccess |
|
| 27 | - * files: |
|
| 28 | - * /.htaccess |
|
| 29 | - * /webroot/.htaccess |
|
| 30 | - * And uncomment the baseUrl key below. |
|
| 31 | - * - fullBaseUrl - A base URL to use for absolute links. When set to false (default) |
|
| 32 | - * CakePHP generates required value based on `HTTP_HOST` environment variable. |
|
| 33 | - * However, you can define it manually to optimize performance or if you |
|
| 34 | - * are concerned about people manipulating the `Host` header. |
|
| 35 | - * - imageBaseUrl - Web path to the public images directory under webroot. |
|
| 36 | - * - cssBaseUrl - Web path to the public css directory under webroot. |
|
| 37 | - * - jsBaseUrl - Web path to the public js directory under webroot. |
|
| 38 | - * - paths - Configure paths for non class based resources. Supports the |
|
| 39 | - * `plugins`, `templates`, `locales` subkeys, which allow the definition of |
|
| 40 | - * paths for plugins, view templates and locale files respectively. |
|
| 41 | - */ |
|
| 42 | - 'App' => [ |
|
| 43 | - 'namespace' => 'App', |
|
| 44 | - 'encoding' => env('APP_ENCODING', 'UTF-8'), |
|
| 45 | - 'defaultLocale' => env('APP_DEFAULT_LOCALE', 'en_US'), |
|
| 46 | - 'defaultTimezone' => env('APP_DEFAULT_TIMEZONE', 'UTC'), |
|
| 47 | - 'base' => false, |
|
| 48 | - 'dir' => 'src', |
|
| 49 | - 'webroot' => 'webroot', |
|
| 50 | - 'wwwRoot' => WWW_ROOT, |
|
| 51 | - //'baseUrl' => env('SCRIPT_NAME'), |
|
| 52 | - 'fullBaseUrl' => false, |
|
| 53 | - 'imageBaseUrl' => 'img/', |
|
| 54 | - 'cssBaseUrl' => 'css/', |
|
| 55 | - 'jsBaseUrl' => 'js/', |
|
| 56 | - 'paths' => [ |
|
| 57 | - 'plugins' => [ROOT . DS . 'plugins' . DS], |
|
| 58 | - 'templates' => [APP . 'Template' . DS], |
|
| 59 | - 'locales' => [APP . 'Locale' . DS], |
|
| 60 | - ], |
|
| 61 | - ], |
|
| 14 | + /** |
|
| 15 | + * Configure basic information about the application. |
|
| 16 | + * |
|
| 17 | + * - namespace - The namespace to find app classes under. |
|
| 18 | + * - defaultLocale - The default locale for translation, formatting currencies and numbers, date and time. |
|
| 19 | + * - encoding - The encoding used for HTML + database connections. |
|
| 20 | + * - base - The base directory the app resides in. If false this |
|
| 21 | + * will be auto detected. |
|
| 22 | + * - dir - Name of app directory. |
|
| 23 | + * - webroot - The webroot directory. |
|
| 24 | + * - wwwRoot - The file path to webroot. |
|
| 25 | + * - baseUrl - To configure CakePHP to *not* use mod_rewrite and to |
|
| 26 | + * use CakePHP pretty URLs, remove these .htaccess |
|
| 27 | + * files: |
|
| 28 | + * /.htaccess |
|
| 29 | + * /webroot/.htaccess |
|
| 30 | + * And uncomment the baseUrl key below. |
|
| 31 | + * - fullBaseUrl - A base URL to use for absolute links. When set to false (default) |
|
| 32 | + * CakePHP generates required value based on `HTTP_HOST` environment variable. |
|
| 33 | + * However, you can define it manually to optimize performance or if you |
|
| 34 | + * are concerned about people manipulating the `Host` header. |
|
| 35 | + * - imageBaseUrl - Web path to the public images directory under webroot. |
|
| 36 | + * - cssBaseUrl - Web path to the public css directory under webroot. |
|
| 37 | + * - jsBaseUrl - Web path to the public js directory under webroot. |
|
| 38 | + * - paths - Configure paths for non class based resources. Supports the |
|
| 39 | + * `plugins`, `templates`, `locales` subkeys, which allow the definition of |
|
| 40 | + * paths for plugins, view templates and locale files respectively. |
|
| 41 | + */ |
|
| 42 | + 'App' => [ |
|
| 43 | + 'namespace' => 'App', |
|
| 44 | + 'encoding' => env('APP_ENCODING', 'UTF-8'), |
|
| 45 | + 'defaultLocale' => env('APP_DEFAULT_LOCALE', 'en_US'), |
|
| 46 | + 'defaultTimezone' => env('APP_DEFAULT_TIMEZONE', 'UTC'), |
|
| 47 | + 'base' => false, |
|
| 48 | + 'dir' => 'src', |
|
| 49 | + 'webroot' => 'webroot', |
|
| 50 | + 'wwwRoot' => WWW_ROOT, |
|
| 51 | + //'baseUrl' => env('SCRIPT_NAME'), |
|
| 52 | + 'fullBaseUrl' => false, |
|
| 53 | + 'imageBaseUrl' => 'img/', |
|
| 54 | + 'cssBaseUrl' => 'css/', |
|
| 55 | + 'jsBaseUrl' => 'js/', |
|
| 56 | + 'paths' => [ |
|
| 57 | + 'plugins' => [ROOT . DS . 'plugins' . DS], |
|
| 58 | + 'templates' => [APP . 'Template' . DS], |
|
| 59 | + 'locales' => [APP . 'Locale' . DS], |
|
| 60 | + ], |
|
| 61 | + ], |
|
| 62 | 62 | |
| 63 | - /** |
|
| 64 | - * Security and encryption configuration |
|
| 65 | - * |
|
| 66 | - * - salt - A random string used in security hashing methods. |
|
| 67 | - * The salt value is also used as the encryption key. |
|
| 68 | - * You should treat it as extremely sensitive data. |
|
| 69 | - */ |
|
| 70 | - 'Security' => [ |
|
| 71 | - 'salt' => env('SECURITY_SALT', '__SALT__'), |
|
| 72 | - ], |
|
| 63 | + /** |
|
| 64 | + * Security and encryption configuration |
|
| 65 | + * |
|
| 66 | + * - salt - A random string used in security hashing methods. |
|
| 67 | + * The salt value is also used as the encryption key. |
|
| 68 | + * You should treat it as extremely sensitive data. |
|
| 69 | + */ |
|
| 70 | + 'Security' => [ |
|
| 71 | + 'salt' => env('SECURITY_SALT', '__SALT__'), |
|
| 72 | + ], |
|
| 73 | 73 | |
| 74 | - /** |
|
| 75 | - * Apply timestamps with the last modified time to static assets (js, css, images). |
|
| 76 | - * Will append a querystring parameter containing the time the file was modified. |
|
| 77 | - * This is useful for busting browser caches. |
|
| 78 | - * |
|
| 79 | - * Set to true to apply timestamps when debug is true. Set to 'force' to always |
|
| 80 | - * enable timestamping regardless of debug value. |
|
| 81 | - */ |
|
| 82 | - 'Asset' => [ |
|
| 83 | - //'timestamp' => true, |
|
| 84 | - // 'cacheTime' => '+1 year' |
|
| 85 | - ], |
|
| 74 | + /** |
|
| 75 | + * Apply timestamps with the last modified time to static assets (js, css, images). |
|
| 76 | + * Will append a querystring parameter containing the time the file was modified. |
|
| 77 | + * This is useful for busting browser caches. |
|
| 78 | + * |
|
| 79 | + * Set to true to apply timestamps when debug is true. Set to 'force' to always |
|
| 80 | + * enable timestamping regardless of debug value. |
|
| 81 | + */ |
|
| 82 | + 'Asset' => [ |
|
| 83 | + //'timestamp' => true, |
|
| 84 | + // 'cacheTime' => '+1 year' |
|
| 85 | + ], |
|
| 86 | 86 | |
| 87 | - /** |
|
| 88 | - * Configure the cache adapters. |
|
| 89 | - */ |
|
| 90 | - 'Cache' => [ |
|
| 91 | - 'default' => [ |
|
| 92 | - 'className' => 'Cake\Cache\Engine\FileEngine', |
|
| 93 | - 'path' => CACHE, |
|
| 94 | - 'url' => env('CACHE_DEFAULT_URL', null), |
|
| 95 | - ], |
|
| 87 | + /** |
|
| 88 | + * Configure the cache adapters. |
|
| 89 | + */ |
|
| 90 | + 'Cache' => [ |
|
| 91 | + 'default' => [ |
|
| 92 | + 'className' => 'Cake\Cache\Engine\FileEngine', |
|
| 93 | + 'path' => CACHE, |
|
| 94 | + 'url' => env('CACHE_DEFAULT_URL', null), |
|
| 95 | + ], |
|
| 96 | 96 | |
| 97 | - /** |
|
| 98 | - * Configure the cache used for general framework caching. |
|
| 99 | - * Translation cache files are stored with this configuration. |
|
| 100 | - * Duration will be set to '+2 minutes' in bootstrap.php when debug = true |
|
| 101 | - * If you set 'className' => 'Null' core cache will be disabled. |
|
| 102 | - */ |
|
| 103 | - '_cake_core_' => [ |
|
| 104 | - 'className' => 'Cake\Cache\Engine\FileEngine', |
|
| 105 | - 'prefix' => 'myapp_cake_core_', |
|
| 106 | - 'path' => CACHE . 'persistent/', |
|
| 107 | - 'serialize' => true, |
|
| 108 | - 'duration' => '+1 years', |
|
| 109 | - 'url' => env('CACHE_CAKECORE_URL', null), |
|
| 110 | - ], |
|
| 97 | + /** |
|
| 98 | + * Configure the cache used for general framework caching. |
|
| 99 | + * Translation cache files are stored with this configuration. |
|
| 100 | + * Duration will be set to '+2 minutes' in bootstrap.php when debug = true |
|
| 101 | + * If you set 'className' => 'Null' core cache will be disabled. |
|
| 102 | + */ |
|
| 103 | + '_cake_core_' => [ |
|
| 104 | + 'className' => 'Cake\Cache\Engine\FileEngine', |
|
| 105 | + 'prefix' => 'myapp_cake_core_', |
|
| 106 | + 'path' => CACHE . 'persistent/', |
|
| 107 | + 'serialize' => true, |
|
| 108 | + 'duration' => '+1 years', |
|
| 109 | + 'url' => env('CACHE_CAKECORE_URL', null), |
|
| 110 | + ], |
|
| 111 | 111 | |
| 112 | - /** |
|
| 113 | - * Configure the cache for model and datasource caches. This cache |
|
| 114 | - * configuration is used to store schema descriptions, and table listings |
|
| 115 | - * in connections. |
|
| 116 | - * Duration will be set to '+2 minutes' in bootstrap.php when debug = true |
|
| 117 | - */ |
|
| 118 | - '_cake_model_' => [ |
|
| 119 | - 'className' => 'Cake\Cache\Engine\FileEngine', |
|
| 120 | - 'prefix' => 'myapp_cake_model_', |
|
| 121 | - 'path' => CACHE . 'models/', |
|
| 122 | - 'serialize' => true, |
|
| 123 | - 'duration' => '+1 years', |
|
| 124 | - 'url' => env('CACHE_CAKEMODEL_URL', null), |
|
| 125 | - ], |
|
| 112 | + /** |
|
| 113 | + * Configure the cache for model and datasource caches. This cache |
|
| 114 | + * configuration is used to store schema descriptions, and table listings |
|
| 115 | + * in connections. |
|
| 116 | + * Duration will be set to '+2 minutes' in bootstrap.php when debug = true |
|
| 117 | + */ |
|
| 118 | + '_cake_model_' => [ |
|
| 119 | + 'className' => 'Cake\Cache\Engine\FileEngine', |
|
| 120 | + 'prefix' => 'myapp_cake_model_', |
|
| 121 | + 'path' => CACHE . 'models/', |
|
| 122 | + 'serialize' => true, |
|
| 123 | + 'duration' => '+1 years', |
|
| 124 | + 'url' => env('CACHE_CAKEMODEL_URL', null), |
|
| 125 | + ], |
|
| 126 | 126 | |
| 127 | - /** |
|
| 128 | - * Configure the cache for routes. The cached routes collection is built the |
|
| 129 | - * first time the routes are processed via `config/routes.php`. |
|
| 130 | - * Duration will be set to '+2 seconds' in bootstrap.php when debug = true |
|
| 131 | - */ |
|
| 132 | - '_cake_routes_' => [ |
|
| 133 | - 'className' => 'Cake\Cache\Engine\FileEngine', |
|
| 134 | - 'prefix' => 'myapp_cake_routes_', |
|
| 135 | - 'path' => CACHE, |
|
| 136 | - 'serialize' => true, |
|
| 137 | - 'duration' => '+1 years', |
|
| 138 | - 'url' => env('CACHE_CAKEROUTES_URL', null), |
|
| 139 | - ], |
|
| 140 | - ], |
|
| 127 | + /** |
|
| 128 | + * Configure the cache for routes. The cached routes collection is built the |
|
| 129 | + * first time the routes are processed via `config/routes.php`. |
|
| 130 | + * Duration will be set to '+2 seconds' in bootstrap.php when debug = true |
|
| 131 | + */ |
|
| 132 | + '_cake_routes_' => [ |
|
| 133 | + 'className' => 'Cake\Cache\Engine\FileEngine', |
|
| 134 | + 'prefix' => 'myapp_cake_routes_', |
|
| 135 | + 'path' => CACHE, |
|
| 136 | + 'serialize' => true, |
|
| 137 | + 'duration' => '+1 years', |
|
| 138 | + 'url' => env('CACHE_CAKEROUTES_URL', null), |
|
| 139 | + ], |
|
| 140 | + ], |
|
| 141 | 141 | |
| 142 | - /** |
|
| 143 | - * Configure the Error and Exception handlers used by your application. |
|
| 144 | - * |
|
| 145 | - * By default errors are displayed using Debugger, when debug is true and logged |
|
| 146 | - * by Cake\Log\Log when debug is false. |
|
| 147 | - * |
|
| 148 | - * In CLI environments exceptions will be printed to stderr with a backtrace. |
|
| 149 | - * In web environments an HTML page will be displayed for the exception. |
|
| 150 | - * With debug true, framework errors like Missing Controller will be displayed. |
|
| 151 | - * When debug is false, framework errors will be coerced into generic HTTP errors. |
|
| 152 | - * |
|
| 153 | - * Options: |
|
| 154 | - * |
|
| 155 | - * - `errorLevel` - int - The level of errors you are interested in capturing. |
|
| 156 | - * - `trace` - boolean - Whether or not backtraces should be included in |
|
| 157 | - * logged errors/exceptions. |
|
| 158 | - * - `log` - boolean - Whether or not you want exceptions logged. |
|
| 159 | - * - `exceptionRenderer` - string - The class responsible for rendering |
|
| 160 | - * uncaught exceptions. If you choose a custom class you should place |
|
| 161 | - * the file for that class in src/Error. This class needs to implement a |
|
| 162 | - * render method. |
|
| 163 | - * - `skipLog` - array - List of exceptions to skip for logging. Exceptions that |
|
| 164 | - * extend one of the listed exceptions will also be skipped for logging. |
|
| 165 | - * E.g.: |
|
| 166 | - * `'skipLog' => ['Cake\Http\Exception\NotFoundException', 'Cake\Http\Exception\UnauthorizedException']` |
|
| 167 | - * - `extraFatalErrorMemory` - int - The number of megabytes to increase |
|
| 168 | - * the memory limit by when a fatal error is encountered. This allows |
|
| 169 | - * breathing room to complete logging or error handling. |
|
| 170 | - */ |
|
| 171 | - 'Error' => [ |
|
| 172 | - 'errorLevel' => E_ALL, |
|
| 173 | - 'exceptionRenderer' => 'Cake\Error\ExceptionRenderer', |
|
| 174 | - 'skipLog' => [], |
|
| 175 | - 'log' => true, |
|
| 176 | - 'trace' => true, |
|
| 177 | - ], |
|
| 142 | + /** |
|
| 143 | + * Configure the Error and Exception handlers used by your application. |
|
| 144 | + * |
|
| 145 | + * By default errors are displayed using Debugger, when debug is true and logged |
|
| 146 | + * by Cake\Log\Log when debug is false. |
|
| 147 | + * |
|
| 148 | + * In CLI environments exceptions will be printed to stderr with a backtrace. |
|
| 149 | + * In web environments an HTML page will be displayed for the exception. |
|
| 150 | + * With debug true, framework errors like Missing Controller will be displayed. |
|
| 151 | + * When debug is false, framework errors will be coerced into generic HTTP errors. |
|
| 152 | + * |
|
| 153 | + * Options: |
|
| 154 | + * |
|
| 155 | + * - `errorLevel` - int - The level of errors you are interested in capturing. |
|
| 156 | + * - `trace` - boolean - Whether or not backtraces should be included in |
|
| 157 | + * logged errors/exceptions. |
|
| 158 | + * - `log` - boolean - Whether or not you want exceptions logged. |
|
| 159 | + * - `exceptionRenderer` - string - The class responsible for rendering |
|
| 160 | + * uncaught exceptions. If you choose a custom class you should place |
|
| 161 | + * the file for that class in src/Error. This class needs to implement a |
|
| 162 | + * render method. |
|
| 163 | + * - `skipLog` - array - List of exceptions to skip for logging. Exceptions that |
|
| 164 | + * extend one of the listed exceptions will also be skipped for logging. |
|
| 165 | + * E.g.: |
|
| 166 | + * `'skipLog' => ['Cake\Http\Exception\NotFoundException', 'Cake\Http\Exception\UnauthorizedException']` |
|
| 167 | + * - `extraFatalErrorMemory` - int - The number of megabytes to increase |
|
| 168 | + * the memory limit by when a fatal error is encountered. This allows |
|
| 169 | + * breathing room to complete logging or error handling. |
|
| 170 | + */ |
|
| 171 | + 'Error' => [ |
|
| 172 | + 'errorLevel' => E_ALL, |
|
| 173 | + 'exceptionRenderer' => 'Cake\Error\ExceptionRenderer', |
|
| 174 | + 'skipLog' => [], |
|
| 175 | + 'log' => true, |
|
| 176 | + 'trace' => true, |
|
| 177 | + ], |
|
| 178 | 178 | |
| 179 | - /** |
|
| 180 | - * Configures logging options |
|
| 181 | - */ |
|
| 182 | - 'Log' => [ |
|
| 183 | - 'debug' => [ |
|
| 184 | - 'className' => 'Cake\Log\Engine\FileLog', |
|
| 185 | - 'path' => LOGS, |
|
| 186 | - 'file' => 'debug', |
|
| 187 | - 'url' => env('LOG_DEBUG_URL', null), |
|
| 188 | - 'scopes' => false, |
|
| 189 | - 'levels' => ['notice', 'info', 'debug'], |
|
| 190 | - ], |
|
| 191 | - 'error' => [ |
|
| 192 | - 'className' => 'Cake\Log\Engine\FileLog', |
|
| 193 | - 'path' => LOGS, |
|
| 194 | - 'file' => 'error', |
|
| 195 | - 'url' => env('LOG_ERROR_URL', null), |
|
| 196 | - 'scopes' => false, |
|
| 197 | - 'levels' => ['warning', 'error', 'critical', 'alert', 'emergency'], |
|
| 198 | - ], |
|
| 199 | - // To enable this dedicated query log, you need set your datasource's log flag to true |
|
| 200 | - 'queries' => [ |
|
| 201 | - 'className' => 'Cake\Log\Engine\FileLog', |
|
| 202 | - 'path' => LOGS, |
|
| 203 | - 'file' => 'queries', |
|
| 204 | - 'url' => env('LOG_QUERIES_URL', null), |
|
| 205 | - 'scopes' => ['queriesLog'], |
|
| 206 | - ], |
|
| 207 | - ], |
|
| 179 | + /** |
|
| 180 | + * Configures logging options |
|
| 181 | + */ |
|
| 182 | + 'Log' => [ |
|
| 183 | + 'debug' => [ |
|
| 184 | + 'className' => 'Cake\Log\Engine\FileLog', |
|
| 185 | + 'path' => LOGS, |
|
| 186 | + 'file' => 'debug', |
|
| 187 | + 'url' => env('LOG_DEBUG_URL', null), |
|
| 188 | + 'scopes' => false, |
|
| 189 | + 'levels' => ['notice', 'info', 'debug'], |
|
| 190 | + ], |
|
| 191 | + 'error' => [ |
|
| 192 | + 'className' => 'Cake\Log\Engine\FileLog', |
|
| 193 | + 'path' => LOGS, |
|
| 194 | + 'file' => 'error', |
|
| 195 | + 'url' => env('LOG_ERROR_URL', null), |
|
| 196 | + 'scopes' => false, |
|
| 197 | + 'levels' => ['warning', 'error', 'critical', 'alert', 'emergency'], |
|
| 198 | + ], |
|
| 199 | + // To enable this dedicated query log, you need set your datasource's log flag to true |
|
| 200 | + 'queries' => [ |
|
| 201 | + 'className' => 'Cake\Log\Engine\FileLog', |
|
| 202 | + 'path' => LOGS, |
|
| 203 | + 'file' => 'queries', |
|
| 204 | + 'url' => env('LOG_QUERIES_URL', null), |
|
| 205 | + 'scopes' => ['queriesLog'], |
|
| 206 | + ], |
|
| 207 | + ], |
|
| 208 | 208 | |
| 209 | - /** |
|
| 210 | - * Session configuration. |
|
| 211 | - * |
|
| 212 | - * Contains an array of settings to use for session configuration. The |
|
| 213 | - * `defaults` key is used to define a default preset to use for sessions, any |
|
| 214 | - * settings declared here will override the settings of the default config. |
|
| 215 | - * |
|
| 216 | - * ## Options |
|
| 217 | - * |
|
| 218 | - * - `cookie` - The name of the cookie to use. Defaults to 'CAKEPHP'. Avoid using `.` in cookie names, |
|
| 219 | - * as PHP will drop sessions from cookies with `.` in the name. |
|
| 220 | - * - `cookiePath` - The url path for which session cookie is set. Maps to the |
|
| 221 | - * `session.cookie_path` php.ini config. Defaults to base path of app. |
|
| 222 | - * - `timeout` - The time in minutes the session should be valid for. |
|
| 223 | - * Pass 0 to disable checking timeout. |
|
| 224 | - * Please note that php.ini's session.gc_maxlifetime must be equal to or greater |
|
| 225 | - * than the largest Session['timeout'] in all served websites for it to have the |
|
| 226 | - * desired effect. |
|
| 227 | - * - `defaults` - The default configuration set to use as a basis for your session. |
|
| 228 | - * There are four built-in options: php, cake, cache, database. |
|
| 229 | - * - `handler` - Can be used to enable a custom session handler. Expects an |
|
| 230 | - * array with at least the `engine` key, being the name of the Session engine |
|
| 231 | - * class to use for managing the session. CakePHP bundles the `CacheSession` |
|
| 232 | - * and `DatabaseSession` engines. |
|
| 233 | - * - `ini` - An associative array of additional ini values to set. |
|
| 234 | - * |
|
| 235 | - * The built-in `defaults` options are: |
|
| 236 | - * |
|
| 237 | - * - 'php' - Uses settings defined in your php.ini. |
|
| 238 | - * - 'cake' - Saves session files in CakePHP's /tmp directory. |
|
| 239 | - * - 'database' - Uses CakePHP's database sessions. |
|
| 240 | - * - 'cache' - Use the Cache class to save sessions. |
|
| 241 | - * |
|
| 242 | - * To define a custom session handler, save it at src/Network/Session/<name>.php. |
|
| 243 | - * Make sure the class implements PHP's `SessionHandlerInterface` and set |
|
| 244 | - * Session.handler to <name> |
|
| 245 | - * |
|
| 246 | - * To use database sessions, load the SQL file located at config/schema/sessions.sql |
|
| 247 | - */ |
|
| 248 | - 'Session' => [ |
|
| 249 | - 'defaults' => 'php', |
|
| 250 | - ], |
|
| 209 | + /** |
|
| 210 | + * Session configuration. |
|
| 211 | + * |
|
| 212 | + * Contains an array of settings to use for session configuration. The |
|
| 213 | + * `defaults` key is used to define a default preset to use for sessions, any |
|
| 214 | + * settings declared here will override the settings of the default config. |
|
| 215 | + * |
|
| 216 | + * ## Options |
|
| 217 | + * |
|
| 218 | + * - `cookie` - The name of the cookie to use. Defaults to 'CAKEPHP'. Avoid using `.` in cookie names, |
|
| 219 | + * as PHP will drop sessions from cookies with `.` in the name. |
|
| 220 | + * - `cookiePath` - The url path for which session cookie is set. Maps to the |
|
| 221 | + * `session.cookie_path` php.ini config. Defaults to base path of app. |
|
| 222 | + * - `timeout` - The time in minutes the session should be valid for. |
|
| 223 | + * Pass 0 to disable checking timeout. |
|
| 224 | + * Please note that php.ini's session.gc_maxlifetime must be equal to or greater |
|
| 225 | + * than the largest Session['timeout'] in all served websites for it to have the |
|
| 226 | + * desired effect. |
|
| 227 | + * - `defaults` - The default configuration set to use as a basis for your session. |
|
| 228 | + * There are four built-in options: php, cake, cache, database. |
|
| 229 | + * - `handler` - Can be used to enable a custom session handler. Expects an |
|
| 230 | + * array with at least the `engine` key, being the name of the Session engine |
|
| 231 | + * class to use for managing the session. CakePHP bundles the `CacheSession` |
|
| 232 | + * and `DatabaseSession` engines. |
|
| 233 | + * - `ini` - An associative array of additional ini values to set. |
|
| 234 | + * |
|
| 235 | + * The built-in `defaults` options are: |
|
| 236 | + * |
|
| 237 | + * - 'php' - Uses settings defined in your php.ini. |
|
| 238 | + * - 'cake' - Saves session files in CakePHP's /tmp directory. |
|
| 239 | + * - 'database' - Uses CakePHP's database sessions. |
|
| 240 | + * - 'cache' - Use the Cache class to save sessions. |
|
| 241 | + * |
|
| 242 | + * To define a custom session handler, save it at src/Network/Session/<name>.php. |
|
| 243 | + * Make sure the class implements PHP's `SessionHandlerInterface` and set |
|
| 244 | + * Session.handler to <name> |
|
| 245 | + * |
|
| 246 | + * To use database sessions, load the SQL file located at config/schema/sessions.sql |
|
| 247 | + */ |
|
| 248 | + 'Session' => [ |
|
| 249 | + 'defaults' => 'php', |
|
| 250 | + ], |
|
| 251 | 251 | ]; |