ConfiguredComponent.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. * Redistributions of files must retain the above copyright notice.
  8. *
  9. * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
  10. * @link https://cakephp.org CakePHP(tm) Project
  11. * @since 3.3.6
  12. * @license https://opensource.org/licenses/mit-license.php MIT License
  13. */
  14. namespace TestApp\Controller\Component;
  15. use Cake\Controller\Component;
  16. use Cake\Controller\ComponentRegistry;
  17. /**
  18. * A test component that makes a copy of the configuration.
  19. */
  20. class ConfiguredComponent extends Component
  21. {
  22. /**
  23. * @var array
  24. */
  25. public $configCopy;
  26. /**
  27. * components property
  28. *
  29. * @var array
  30. */
  31. public $components = [];
  32. /**
  33. * Constructor
  34. *
  35. * @param ComponentRegistry $registry A ComponentRegistry this component can use to lazy load its components
  36. * @param array $config Array of configuration settings.
  37. * @param array $components Array of child components.
  38. */
  39. public function __construct(ComponentRegistry $registry, array $config, array $components = [])
  40. {
  41. $this->components = $components;
  42. parent::__construct($registry, $config);
  43. }
  44. /**
  45. * @param array $config
  46. */
  47. public function initialize(array $config)
  48. {
  49. $this->configCopy = $config;
  50. parent::initialize($config);
  51. }
  52. }