StubContext.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
  5. * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
  6. *
  7. * Licensed under The MIT License
  8. * For full copyright and license information, please see the LICENSE.txt
  9. * Redistributions of files must retain the above copyright notice.
  10. *
  11. * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
  12. * @link https://cakephp.org CakePHP(tm) Project
  13. * @since 5.0.0
  14. * @license https://opensource.org/licenses/mit-license.php MIT License
  15. */
  16. namespace TestApp\View\Form;
  17. use Cake\View\Form\ContextInterface;
  18. class StubContext implements ContextInterface
  19. {
  20. public function getPrimaryKey(): array
  21. {
  22. return [];
  23. }
  24. public function isPrimaryKey(string $field): bool
  25. {
  26. return false;
  27. }
  28. public function isCreate(): bool
  29. {
  30. return false;
  31. }
  32. public function val(string $field, array $options = []): mixed
  33. {
  34. return null;
  35. }
  36. public function isRequired(string $field): ?bool
  37. {
  38. return null;
  39. }
  40. public function getRequiredMessage(string $field): ?string
  41. {
  42. return null;
  43. }
  44. public function getMaxLength(string $field): ?int
  45. {
  46. return null;
  47. }
  48. public function fieldNames(): array
  49. {
  50. return [];
  51. }
  52. public function type(string $field): ?string
  53. {
  54. return null;
  55. }
  56. public function attributes(string $field): array
  57. {
  58. return [];
  59. }
  60. public function hasError(string $field): bool
  61. {
  62. return false;
  63. }
  64. public function error(string $field): array
  65. {
  66. return [];
  67. }
  68. }