FakeConnection.php 692 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. declare(strict_types=1);
  3. namespace TestApp\Datasource;
  4. class FakeConnection
  5. {
  6. protected $_config = [];
  7. /**
  8. * Constructor.
  9. *
  10. * @param array $config configuration for connecting to database
  11. */
  12. public function __construct($config = [])
  13. {
  14. $this->_config = $config;
  15. }
  16. /**
  17. * Returns the set config
  18. *
  19. * @return array
  20. */
  21. public function config(): array
  22. {
  23. return $this->_config;
  24. }
  25. /**
  26. * Returns the set name
  27. */
  28. public function configName(): string
  29. {
  30. if (empty($this->_config['name'])) {
  31. return '';
  32. }
  33. return $this->_config['name'];
  34. }
  35. }