OptionsInterface.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. /*
  3. * This file is part of the Predis package.
  4. *
  5. * (c) Daniele Alessandri <suppakilla@gmail.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Predis\Configuration;
  11. use Predis\Command\FactoryInterface as CommandFactoryInterface;
  12. use Predis\Command\Processor\ProcessorInterface;
  13. use Predis\Connection\FactoryInterface as ConnectionFactoryInterface;
  14. use Predis\Connection\Cluster\ClusterInterface;
  15. use Predis\Connection\Replication\ReplicationInterface;
  16. /**
  17. * Interface defining a container for client options.
  18. *
  19. * @property-read callable aggregate Custom connection aggregator.
  20. * @property-read ClusterInterface cluster Aggregate connection for clustering.
  21. * @property-read ConnectionFactoryInterface connections Connection factory.
  22. * @property-read bool exceptions Toggles exceptions in client for -ERR responses.
  23. * @property-read ProcessorInterface prefix Key prefixing strategy using the given prefix.
  24. * @property-read CommandFactoryInterface commands Command factory.
  25. * @property-read ReplicationInterface replication Aggregate connection for replication.
  26. * @property-read array parameters Default connection parameters for aggregate connections.
  27. *
  28. * @author Daniele Alessandri <suppakilla@gmail.com>
  29. */
  30. interface OptionsInterface
  31. {
  32. /**
  33. * Returns the default value for the given option.
  34. *
  35. * @param string $option Name of the option.
  36. *
  37. * @return mixed|null
  38. */
  39. public function getDefault($option);
  40. /**
  41. * Checks if the given option has been set by the user upon initialization.
  42. *
  43. * @param string $option Name of the option.
  44. *
  45. * @return bool
  46. */
  47. public function defined($option);
  48. /**
  49. * Checks if the given option has been set and does not evaluate to NULL.
  50. *
  51. * @param string $option Name of the option.
  52. *
  53. * @return bool
  54. */
  55. public function __isset($option);
  56. /**
  57. * Returns the value of the given option.
  58. *
  59. * @param string $option Name of the option.
  60. *
  61. * @return mixed|null
  62. */
  63. public function __get($option);
  64. }