invalid_parameter.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. /**
  3. * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
  4. * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
  5. *
  6. * Licensed under The MIT License
  7. * For full copyright and license information, please see the LICENSE.txt
  8. * Redistributions of files must retain the above copyright notice.
  9. *
  10. * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
  11. * @link https://cakephp.org CakePHP(tm) Project
  12. * @since 4.3.0
  13. * @license https://opensource.org/licenses/mit-license.php MIT License
  14. * @var string $action
  15. */
  16. use Cake\Core\Configure;
  17. use Cake\Core\Plugin;
  18. use Cake\Utility\Inflector;
  19. $namespace = Configure::read('App.namespace');
  20. if (!empty($plugin)) {
  21. $namespace = str_replace('/', '\\', $plugin);
  22. }
  23. $prefixNs = '';
  24. $prefix = $prefix ?? '';
  25. if ($prefix) {
  26. $prefix = array_map('Cake\Utility\Inflector::camelize', explode('/', $prefix));
  27. $prefixNs = '\\' . implode('\\', $prefix);
  28. $prefix = implode(DIRECTORY_SEPARATOR, $prefix) . DIRECTORY_SEPARATOR;
  29. }
  30. $type = 'Controller';
  31. $class = Inflector::camelize($controller);
  32. if (empty($plugin)) {
  33. $path = APP_DIR . DIRECTORY_SEPARATOR . $type . DIRECTORY_SEPARATOR . $prefix . h($class) . '.php';
  34. } else {
  35. $path = Plugin::classPath($plugin) . $type . DIRECTORY_SEPARATOR . $prefix . h($class) . '.php';
  36. }
  37. $this->layout = 'dev_error';
  38. $this->assign('title', sprintf('Invalid Parameter', h($class)));
  39. $this->assign(
  40. 'subheading',
  41. sprintf('<strong>Error</strong> The passed parameter or parameter type is invalid in <em>%s::%s()</em>', h($class), h($action))
  42. );
  43. $this->assign('templateName', 'invalid_parameter.php');
  44. $this->start('file');
  45. ?>
  46. <p class="error">
  47. <strong>Error</strong>
  48. <?= h($message); ?>
  49. </p>
  50. <div class="code-dump"><?php highlight_string($code) ?></div>
  51. <?php $this->end() ?>