PageRenderTime 39ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 0ms

/lib/Elastica/Query/Array.php

https://github.com/philippfrenzel/Elastica
PHP | 53 lines | 18 code | 4 blank | 31 comment | 0 complexity | 7db23cf4b6dbf31b6c7651237610513b MD5 | raw file
Possible License(s): Apache-2.0
  1. <?php
  2. /**
  3. * Array query
  4. * Pure php array query. Can be used to create any not existing type of query.
  5. *
  6. * @uses Elastica_Query_Abstract
  7. * @category Xodoa
  8. * @package Elastica
  9. * @author Nicolas Ruflin <spam@ruflin.com>
  10. */
  11. class Elastica_Query_Array extends Elastica_Query_Abstract
  12. {
  13. /**
  14. * Query
  15. *
  16. * @var array Query
  17. */
  18. protected $_query = array();
  19. /**
  20. * Constructs a query based on an array
  21. *
  22. * @param array $query Query array
  23. */
  24. public function __construct(array $query)
  25. {
  26. $this->setQuery($query);
  27. }
  28. /**
  29. * Sets new query array
  30. *
  31. * @param array $query Query array
  32. * @return Elastica_Query_Array Current object
  33. */
  34. public function setQuery(array $query)
  35. {
  36. $this->_query = $query;
  37. return $this;
  38. }
  39. /**
  40. * Converts query to array
  41. *
  42. * @return array Query array
  43. * @see Elastica_Query_Abstract::toArray()
  44. */
  45. public function toArray()
  46. {
  47. return $this->_query;
  48. }
  49. }