Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

php-cs-fixer fix --level=all

  • Loading branch information...
commit 1fba1264cf6215c9a95722955a769778051b0496 1 parent 0abadf3
@lavoiesl lavoiesl authored
Showing with 631 additions and 617 deletions.
  1. +1 −1  build.xml
  2. +33 −31 lib/Elastica/Client.php
  3. +5 −1 lib/Elastica/Cluster.php
  4. +15 −11 lib/Elastica/Cluster/Settings.php
  5. +30 −17 lib/Elastica/Document.php
  6. +3 −3 lib/Elastica/Exception/BulkResponse.php
  7. +3 −3 lib/Elastica/Exception/Client.php
  8. +9 −7 lib/Elastica/Facet/Abstract.php
  9. +3 −2 lib/Elastica/Facet/DateHistogram.php
  10. +1 −1  lib/Elastica/Facet/Filter.php
  11. +5 −4 lib/Elastica/Facet/GeoDistance.php
  12. +8 −8 lib/Elastica/Facet/Histogram.php
  13. +1 −1  lib/Elastica/Facet/Query.php
  14. +10 −8 lib/Elastica/Facet/Range.php
  15. +4 −3 lib/Elastica/Facet/Statistical.php
  16. +8 −6 lib/Elastica/Facet/Terms.php
  17. +6 −6 lib/Elastica/Filter/Abstract.php
  18. +4 −4 lib/Elastica/Filter/Abstract/Multi.php
  19. +14 −11 lib/Elastica/Filter/Bool.php
  20. +1 −1  lib/Elastica/Filter/Exists.php
  21. +5 −5 lib/Elastica/Filter/GeoBoundingBox.php
  22. +10 −8 lib/Elastica/Filter/GeoDistance.php
  23. +2 −2 lib/Elastica/Filter/GeoPolygon.php
  24. +5 −4 lib/Elastica/Filter/HasChild.php
  25. +6 −6 lib/Elastica/Filter/Ids.php
  26. +3 −3 lib/Elastica/Filter/Limit.php
  27. +0 −2  lib/Elastica/Filter/Missing.php
  28. +3 −3 lib/Elastica/Filter/Nested.php
  29. +1 −1  lib/Elastica/Filter/Not.php
  30. +4 −1 lib/Elastica/Filter/Prefix.php
  31. +5 −5 lib/Elastica/Filter/Query.php
  32. +6 −4 lib/Elastica/Filter/Range.php
  33. +2 −2 lib/Elastica/Filter/Script.php
  34. +3 −3 lib/Elastica/Filter/Term.php
  35. +8 −5 lib/Elastica/Filter/Terms.php
  36. +3 −2 lib/Elastica/Filter/Type.php
  37. +24 −19 lib/Elastica/Index.php
  38. +22 −15 lib/Elastica/Index/Settings.php
  39. +2 −0  lib/Elastica/Index/Status.php
  40. +5 −4 lib/Elastica/Log.php
  41. +3 −2 lib/Elastica/Node.php
  42. +3 −3 lib/Elastica/Node/Info.php
  43. +13 −10 lib/Elastica/Param.php
  44. +7 −5 lib/Elastica/Percolator.php
  45. +2 −1  lib/Elastica/Query/Array.php
  46. +11 −11 lib/Elastica/Query/Bool.php
  47. +1 −1  lib/Elastica/Query/Builder.php
  48. +5 −5 lib/Elastica/Query/ConstantScore.php
  49. +8 −5 lib/Elastica/Query/CustomFiltersScore.php
  50. +5 −4 lib/Elastica/Query/CustomScore.php
  51. +6 −3 lib/Elastica/Query/Field.php
  52. +6 −4 lib/Elastica/Query/Filtered.php
  53. +2 −2 lib/Elastica/Query/Fuzzy.php
  54. +12 −7 lib/Elastica/Query/FuzzyLikeThis.php
  55. +4 −3 lib/Elastica/Query/HasChild.php
  56. +10 −7 lib/Elastica/Query/Ids.php
  57. +15 −16 lib/Elastica/Query/MoreLikeThis.php
  58. +3 −3 lib/Elastica/Query/Nested.php
  59. +19 −19 lib/Elastica/Query/QueryString.php
  60. +2 −2 lib/Elastica/Query/Range.php
  61. +4 −4 lib/Elastica/Query/Term.php
  62. +8 −5 lib/Elastica/Query/Terms.php
  63. +12 −11 lib/Elastica/Query/Text.php
  64. +4 −3 lib/Elastica/Query/TopChildren.php
  65. +3 −3 lib/Elastica/Query/Wildcard.php
  66. +12 −9 lib/Elastica/Request.php
  67. +8 −2 lib/Elastica/Response.php
  68. +5 −4 lib/Elastica/Result.php
  69. +3 −1 lib/Elastica/ResultSet.php
  70. +8 −8 lib/Elastica/Search.php
  71. +4 −4 lib/Elastica/Searchable.php
  72. +12 −8 lib/Elastica/Status.php
  73. +2 −4 lib/Elastica/Transport/Abstract.php
  74. +5 −4 lib/Elastica/Transport/Http.php
  75. +1 −1  lib/Elastica/Transport/Https.php
  76. +3 −4 lib/Elastica/Transport/Memcache.php
  77. +27 −20 lib/Elastica/Type.php
  78. +5 −5 lib/Elastica/Type/Abstract.php
  79. +17 −14 lib/Elastica/Type/Mapping.php
  80. +8 −6 lib/Elastica/Util.php
  81. +1 −1  phpdoc.dist.xml
  82. +5 −3 test/CodeSniffer/Standards/Xodoa/Sniffs/Commenting/ClassCommentSniff.php
  83. +3 −15 test/CodeSniffer/Standards/Xodoa/Sniffs/Commenting/FileCommentSniff.php
  84. +6 −8 test/CodeSniffer/Standards/Xodoa/Sniffs/Commenting/FunctionCommentSniff.php
  85. +0 −3  test/CodeSniffer/Standards/Xodoa/Sniffs/WhiteSpace/DisallowSpaceIndentSniff.php
  86. +0 −4 test/CodeSniffer/Standards/Xodoa/Sniffs/WhiteSpace/ScopeIndentSniff.php
  87. +1 −1  test/CodeSniffer/Standards/Xodoa/XodoaCodingStandard.php
  88. +1 −1  test/CodeSniffer/Standards/Xodoa/ruleset.xml
  89. +0 −1  test/benchmark/BulkMemoryUsageTest.php
  90. +0 −1  test/benchmark/ClientTest.php
  91. +1 −2  test/lib/Elastica/ClientTest.php
  92. +2 −3 test/lib/Elastica/Cluster/SettingsTest.php
  93. +3 −4 test/lib/Elastica/ClusterTest.php
  94. +1 −2  test/lib/Elastica/DocumentTest.php
  95. +1 −1  test/lib/Elastica/Exception/NotImplementedTest.php
  96. +1 −5 test/lib/Elastica/Facet/DateHistogramTest.php
  97. +0 −1  test/lib/Elastica/Facet/FilterTest.php
  98. +0 −1  test/lib/Elastica/Facet/QueryTest.php
  99. +1 −3 test/lib/Elastica/Facet/StatisticalTest.php
  100. +1 −3 test/lib/Elastica/Facet/TermsTest.php
  101. +0 −1  test/lib/Elastica/Filter/AbstractTest.php
  102. +0 −4 test/lib/Elastica/Filter/AndTest.php
  103. +0 −1  test/lib/Elastica/Filter/ExistsTests.php
  104. +0 −3  test/lib/Elastica/Filter/GeoDistanceTest.php
  105. +0 −2  test/lib/Elastica/Filter/GeoPolygonTest.php
  106. +0 −1  test/lib/Elastica/Filter/IdsTest.php
  107. +1 −1  test/lib/Elastica/Filter/MatchAllTest.php
  108. +0 −1  test/lib/Elastica/Filter/NestedTest.php
  109. +0 −1  test/lib/Elastica/Filter/NotTest.php
  110. +0 −1  test/lib/Elastica/Filter/NumericRangeTest.php
  111. +0 −2  test/lib/Elastica/Filter/OrTest.php
  112. +1 −5 test/lib/Elastica/Filter/PrefixTest.php
  113. +0 −1  test/lib/Elastica/Filter/QueryTest.php
  114. +0 −1  test/lib/Elastica/Filter/RangeTest.php
  115. +1 −1  test/lib/Elastica/Filter/TermTest.php
  116. +0 −1  test/lib/Elastica/Filter/TypeTest.php
  117. +1 −2  test/lib/Elastica/Index/SettingsTest.php
  118. +1 −1  test/lib/Elastica/Index/StatsTest.php
  119. +1 −1  test/lib/Elastica/Index/StatusTest.php
  120. +1 −2  test/lib/Elastica/LogTest.php
  121. +1 −1  test/lib/Elastica/Node/InfoTest.php
  122. +1 −1  test/lib/Elastica/NodeTest.php
  123. +3 −2 test/lib/Elastica/ParamTest.php
  124. +1 −2  test/lib/Elastica/PercolatorTest.php
  125. +1 −4 test/lib/Elastica/Query/ConstantScoreTest.php
  126. +1 −2  test/lib/Elastica/Query/CustomScoreTest.php
  127. +0 −1  test/lib/Elastica/Query/FieldTest.php
  128. +0 −2  test/lib/Elastica/Query/FuzzyLikeThisTest.php
  129. +0 −1  test/lib/Elastica/Query/FuzzyTest.php
  130. +0 −2  test/lib/Elastica/Query/HighlightTest.php
  131. +0 −1  test/lib/Elastica/Query/IdsTest.php
  132. +1 −1  test/lib/Elastica/Query/MatchAllTest.php
  133. +0 −1  test/lib/Elastica/Query/MoreLikeThisTest.php
  134. +2 −4 test/lib/Elastica/Query/QueryStringTest.php
  135. +1 −1  test/lib/Elastica/Query/TermTest.php
  136. +0 −1  test/lib/Elastica/Query/TermsTest.php
  137. +0 −1  test/lib/Elastica/Query/TextTest.php
  138. +0 −4 test/lib/Elastica/Query/WildcardTest.php
  139. +1 −7 test/lib/Elastica/QueryTest.php
  140. +0 −3  test/lib/Elastica/ResponseTest.php
  141. +0 −3  test/lib/Elastica/ResultTest.php
  142. +1 −1  test/lib/Elastica/SearchTest.php
  143. +5 −6 test/lib/Elastica/StatusTest.php
  144. +3 −2 test/lib/Elastica/Test.php
  145. +0 −2  test/lib/Elastica/Transport/MemcacheTest.php
  146. +2 −6 test/lib/Elastica/Type/MappingTest.php
  147. +1 −3 test/lib/Elastica/TypeTest.php
View
2  build.xml
@@ -187,4 +187,4 @@
<arg line="--max-user-speed 50" />
</exec>
</target>
-</project>
+</project>
View
64 lib/Elastica/Client.php
@@ -80,7 +80,7 @@ public function setConfig(array $config)
* Returns a specific config key or the whole
* config array if not set
*
- * @param string $key Config key
+ * @param string $key Config key
* @return array|string Config value
*/
public function getConfig($key = '')
@@ -99,8 +99,8 @@ public function getConfig($key = '')
/**
* Sets / overwrites a specific config value
*
- * @param string $key Key to set
- * @param mixed $value Value
+ * @param string $key Key to set
+ * @param mixed $value Value
* @return Elastica_Client Client object
*/
public function setConfigValue($key, $value)
@@ -111,7 +111,7 @@ public function setConfigValue($key, $value)
/**
* Returns the index for the given connection
*
- * @param string $name Index name to create connection to
+ * @param string $name Index name to create connection to
* @return Elastica_Index Index for the given name
*/
public function getIndex($name)
@@ -152,8 +152,8 @@ public function getTransport()
/**
* Adds a HTTP Header
*
- * @param string $header The HTTP Header
- * @param string $headerValue The HTTP Header Value
+ * @param string $header The HTTP Header
+ * @param string $headerValue The HTTP Header Value
* @throws Elastica_Exception_Invalid If $header or $headerValue is not a string
*/
public function addHeader($header, $headerValue)
@@ -168,7 +168,7 @@ public function addHeader($header, $headerValue)
/**
* Remove a HTTP Header
*
- * @param string $header The HTTP Header to remove
+ * @param string $header The HTTP Header to remove
* @throws Elastica_Exception_Invalid IF $header is not a string
*/
public function removeHeader($header)
@@ -189,8 +189,8 @@ public function removeHeader($header)
* set inside the document, because for bulk settings documents,
* documents can belong to any type and index
*
- * @param array $docs Array of Elastica_Document
- * @return Elastica_Response Response object
+ * @param array $docs Array of Elastica_Document
+ * @return Elastica_Response Response object
* @throws Elastica_Exception_Invalid If docs is empty
* @link http://www.elasticsearch.com/docs/elasticsearch/rest_api/bulk/
*/
@@ -201,7 +201,7 @@ public function addDocuments(array $docs)
}
$params = array();
- foreach($docs as $doc) {
+ foreach ($docs as $doc) {
$indexInfo = array(
'_index' => $doc->getIndex(),
@@ -227,17 +227,18 @@ public function addDocuments(array $docs)
$params[] = array('index' => $indexInfo);
$params[] = $doc->getData();
}
+
return $this->bulk($params);
}
/**
* Update document, using update script. Requires elasticsearch >= 0.19.0
*
- * @param int $id document id
- * @param Elastica_Script $script script to use for update
- * @param string $index index to update
- * @param string $type type of index to update
- * @param array $options array of query params to use for query. For possible options check es api
+ * @param int $id document id
+ * @param Elastica_Script $script script to use for update
+ * @param string $index index to update
+ * @param string $type type of index to update
+ * @param array $options array of query params to use for query. For possible options check es api
* @return Elastica_Response
* @link http://www.elasticsearch.org/guide/reference/api/update.html
*/
@@ -265,7 +266,7 @@ public function updateDocument($id, Elastica_Script $script, $index, $type, arra
/**
* Bulk deletes documents (not implemented yet)
*
- * @param array $docs Docs
+ * @param array $docs Docs
* @throws Elastica_Exception
*/
public function deleteDocuments(array $docs)
@@ -297,11 +298,11 @@ public function getCluster()
/**
* Deletes documents with the given ids, index, type from the index
*
- * @param array $ids Document ids
- * @param string|Elastica_Index $index Index name
- * @param string|Elastica_Type $type Type of documents
- * @return Elastica_Response Response object
- * @throws Elastica_Exception If ids is empty
+ * @param array $ids Document ids
+ * @param string|Elastica_Index $index Index name
+ * @param string|Elastica_Type $type Type of documents
+ * @return Elastica_Response Response object
+ * @throws Elastica_Exception If ids is empty
* @link http://www.elasticsearch.com/docs/elasticsearch/rest_api/bulk/
*/
public function deleteIds(array $ids, $index, $type)
@@ -319,7 +320,7 @@ public function deleteIds(array $ids, $index, $type)
}
$params = array();
- foreach($ids as $id) {
+ foreach ($ids as $id) {
$action = array(
'delete' => array(
'_index' => $index,
@@ -346,7 +347,7 @@ public function deleteIds(array $ids, $index, $type)
* array('delete' => array('_index' => 'test', '_type' => 'user', '_id' => '2'))
* );
*
- * @param array $params Parameter array
+ * @param array $params Parameter array
* @return Elastica_Response Reponse object
* @todo Test
* @link http://www.elasticsearch.com/docs/elasticsearch/rest_api/bulk/
@@ -360,7 +361,7 @@ public function bulk(array $params)
$path = '_bulk';
$queryString = '';
- foreach($params as $index => $baseArray) {
+ foreach ($params as $index => $baseArray) {
// Always newline needed
$queryString .= json_encode($baseArray) . PHP_EOL;
}
@@ -369,9 +370,9 @@ public function bulk(array $params)
$data = $response->getData();
if (isset($data['items'])) {
- foreach($data['items'] as $item) {
+ foreach ($data['items'] as $item) {
$params = reset($item);
- if(isset($params['error'])) {
+ if (isset($params['error'])) {
throw new Elastica_Exception_BulkResponse($response);
}
}
@@ -385,22 +386,23 @@ public function bulk(array $params)
*
* It's possible to make any REST query directly over this method
*
- * @param string $path Path to call
- * @param string $method Rest method to use (GET, POST, DELETE, PUT)
- * @param array $data OPTIONAL Arguments as array
- * @param array $query OPTIONAL Query params
+ * @param string $path Path to call
+ * @param string $method Rest method to use (GET, POST, DELETE, PUT)
+ * @param array $data OPTIONAL Arguments as array
+ * @param array $query OPTIONAL Query params
* @return Elastica_Response Response object
*/
public function request($path, $method, $data = array(), array $query = array())
{
$request = new Elastica_Request($this, $path, $method, $data, $query);
+
return $request->send();
}
/**
* Optimizes all search indices
*
- * @param array $args OPTIONAL Optional arguments
+ * @param array $args OPTIONAL Optional arguments
* @return Elastica_Response Response object
* @link http://www.elasticsearch.com/docs/elasticsearch/rest_api/admin/indices/optimize/
*/
View
6 lib/Elastica/Cluster.php
@@ -60,6 +60,7 @@ public function getIndexNames()
foreach ($metaData as $key => $value) {
$indices[] = $key;
}
+
return $indices;
}
@@ -82,6 +83,7 @@ public function getState()
public function getNodeNames()
{
$data = $this->getState();
+
return array_keys($data['routing_nodes']['nodes']);
}
@@ -96,6 +98,7 @@ public function getNodes()
foreach ($this->getNodeNames() as $name) {
$nodes[] = new Elastica_Node($name, $this->getClient());
}
+
return $nodes;
}
@@ -144,13 +147,14 @@ public function getSettings()
/**
* Shuts down the complete cluster
*
- * @param string $delay OPTIONAL Seconds to shutdown cluster after (default = 1s)
+ * @param string $delay OPTIONAL Seconds to shutdown cluster after (default = 1s)
* @return Elastica_Response
* @link http://www.elasticsearch.org/guide/reference/api/admin-cluster-nodes-shutdown.html
*/
public function shutdown($delay = '1s')
{
$path = '_shutdown?delay=' . $delay;
+
return $this->_client->request($path, Elastica_Request::POST);
}
}
View
26 lib/Elastica/Cluster/Settings.php
@@ -41,7 +41,7 @@ public function get()
*
* If param is set, only specified setting is return.
*
- * @param string $setting OPTIONAL Setting name to return
+ * @param string $setting OPTIONAL Setting name to return
* @return array|string|null Settings data
*/
public function getPersistent($setting = '')
@@ -56,6 +56,7 @@ public function getPersistent($setting = '')
return null;
}
}
+
return $settings;
}
@@ -64,7 +65,7 @@ public function getPersistent($setting = '')
*
* If param is set, only specified setting is return.
*
- * @param string $setting OPTIONAL Setting name to return
+ * @param string $setting OPTIONAL Setting name to return
* @return array|string|null Settings data
*/
public function getTransient($setting = '')
@@ -79,14 +80,15 @@ public function getTransient($setting = '')
return null;
}
}
+
return $settings;
}
/**
* Sets persistent setting
*
- * @param string $key
- * @param string $value
+ * @param string $key
+ * @param string $value
* @return Elastica_Response
*/
public function setPersistent($key, $value)
@@ -103,8 +105,8 @@ public function setPersistent($key, $value)
/**
* Sets transient settings
*
- * @param string $key
- * @param string $value
+ * @param string $key
+ * @param string $value
* @return Elastica_Response
*/
public function setTransient($key, $value)
@@ -123,8 +125,8 @@ public function setTransient($key, $value)
*
* Second param can be used to set it persistent
*
- * @param bool $readOnly
- * @param bool $persistent
+ * @param bool $readOnly
+ * @param bool $persistent
* @return Elastica_Response $response
*/
public function setReadOnly($readOnly = true, $persistent = false)
@@ -136,13 +138,14 @@ public function setReadOnly($readOnly = true, $persistent = false)
} else {
$response = $this->setTransient($key, $readOnly);
}
+
return $response;
}
/**
* Set settings for cluster
*
- * @param array $settings Raw settings (including persistent or transient)
+ * @param array $settings Raw settings (including persistent or transient)
* @return Elastica_Response
*/
public function set(array $settings)
@@ -163,13 +166,14 @@ public function getClient()
/**
* Sends settings request
*
- * @param array $data OPTIONAL Data array
- * @param string $method OPTIONAL Transfer method (default = Elastica_Request::GET)
+ * @param array $data OPTIONAL Data array
+ * @param string $method OPTIONAL Transfer method (default = Elastica_Request::GET)
* @return Elastica_Response Response object
*/
public function request(array $data = array(), $method = Elastica_Request::GET)
{
$path = '_cluster/settings';
+
return $this->getClient()->request($path, $method, $data);
}
}
View
47 lib/Elastica/Document.php
@@ -93,13 +93,14 @@ public function getId()
/**
* Adds the given key/value pair to the document
*
- * @param string $key Document entry key
- * @param mixed $value Document entry value
+ * @param string $key Document entry key
+ * @param mixed $value Document entry value
* @return Elastica_Document
*/
public function add($key, $value)
{
$this->_data[$key] = $value;
+
return $this;
}
@@ -114,9 +115,9 @@ public function add($key, $value)
* This installs the tika file analysis plugin. More infos about supported formats
* can be found here: {@link http://tika.apache.org/0.7/formats.html}
*
- * @param string $key Key to add the file to
- * @param string $filepath Path to add the file
- * @param string $mimeType OPTIONAL Header mime type
+ * @param string $key Key to add the file to
+ * @param string $filepath Path to add the file
+ * @param string $mimeType OPTIONAL Header mime type
* @return Elastica_Document
*/
public function addFile($key, $filepath, $mimeType = '')
@@ -128,14 +129,15 @@ public function addFile($key, $filepath, $mimeType = '')
}
$this->add($key, $value);
+
return $this;
}
/**
* Add file content
*
- * @param string $key Document key
- * @param string $content Raw file content
+ * @param string $key Document key
+ * @param string $content Raw file content
* @return Elastica_Document
*/
public function addFileContent($key, $content)
@@ -159,25 +161,27 @@ public function addGeoPoint($key, $latitude, $longitude)
$value = array('lat' => $latitude, 'lon' => $longitude,);
$this->add($key, $value);
+
return $this;
}
/**
* Overwrites the curent document data with the given data
*
- * @param array $data Data array
+ * @param array $data Data array
* @return Elastica_Document
*/
public function setData(array $data)
{
$this->_data = $data;
+
return $this;
}
/**
* Sets lifetime of document
*
- * @param string $ttl
+ * @param string $ttl
* @return Elastica_Document
*/
public function setTtl($ttl)
@@ -198,19 +202,20 @@ public function getData()
/**
* Sets the document type name
*
- * @param string $type Type name
+ * @param string $type Type name
* @return Elastica_Document Current object
*/
public function setType($type)
{
$this->_type = $type;
+
return $this;
}
/**
* Return document type name
*
- * @return string Document type name
+ * @return string Document type name
* @throws Elastica_Exception_Invalid
*/
public function getType()
@@ -220,25 +225,27 @@ public function getType()
if (is_null($type)) {
throw new Elastica_Exception_Invalid('Type not set');
}
+
return $type;
}
/**
* Sets the document index name
*
- * @param string $index Index name
+ * @param string $index Index name
* @return Elastica_Document Current object
*/
public function setIndex($index)
{
$this->_index = $index;
+
return $this;
}
/**
* Get the document index name
*
- * @return string Index name
+ * @return string Index name
* @throws Elastica_Exception_Invalid
*/
public function getIndex()
@@ -248,13 +255,14 @@ public function getIndex()
if (is_null($index)) {
throw new Elastica_Exception_Invalid('Index not set');
}
+
return $index;
}
/**
* Sets the version of a document for use with optimistic concurrency control
*
- * @param int $version Document version
+ * @param int $version Document version
* @return Elastica_Document Current object
* @link http://www.elasticsearch.org/blog/2011/02/08/versioning.html
*/
@@ -263,6 +271,7 @@ public function setVersion($version)
if ($version !== '') {
$this->_version = (int) $version;
}
+
return $this;
}
@@ -279,13 +288,14 @@ public function getVersion()
/**
* Sets parent document id
*
- * @param string|int $parent Parent document id
+ * @param string|int $parent Parent document id
* @return Elastica_Document Current object
* @link http://www.elasticsearch.org/guide/reference/mapping/parent-field.html
*/
public function setParent($parent)
{
$this->_parent = $parent;
+
return $this;
}
@@ -302,12 +312,13 @@ public function getParent()
/**
* Set operation type
*
- * @param string $optype Only accept create
+ * @param string $optype Only accept create
* @return Elastica_Document Current object
*/
public function setOpType($optype)
{
$this->_optype = $optype;
+
return $this;
}
@@ -322,12 +333,13 @@ public function getOpType()
/**
* Set percolate query param
*
- * @param string $value percolator filter
+ * @param string $value percolator filter
* @return Elastica_Document
*/
public function setPercolate($value = '*')
{
$this->_percolate = $value;
+
return $this;
}
@@ -372,6 +384,7 @@ public function toArray()
}
$doc['_source'] = $this->getData();
+
return $doc;
}
}
View
6 lib/Elastica/Exception/BulkResponse.php
@@ -45,14 +45,14 @@ public function getFailures()
$data = $this->_response->getData();
$errors = array();
- foreach($data['items'] as $item) {
+ foreach ($data['items'] as $item) {
$meta = reset($item);
$action = key($item);
- if(isset($meta['error'])) {
+ if (isset($meta['error'])) {
$error = array(
'action' => $action,
);
- foreach($meta as $key => $value) {
+ foreach ($meta as $key => $value) {
$key = ltrim($key, '_');
$error[$key] = $value;
}
View
6 lib/Elastica/Exception/Client.php
@@ -32,8 +32,8 @@ class Elastica_Exception_Client extends Elastica_Exception_Abstract
/**
* Construct Exception
*
- * @param string $error Error
- * @param Elastica_Request $request
+ * @param string $error Error
+ * @param Elastica_Request $request
* @param Elastica_Response $response
*/
public function __construct($error, Elastica_Request $request = null, Elastica_Response $response = null)
@@ -50,7 +50,7 @@ public function __construct($error, Elastica_Request $request = null, Elastica_R
* Returns the error message corresponding to the error code
* cUrl error code reference can be found here {@link http://curl.haxx.se/libcurl/c/libcurl-errors.html}
*
- * @param string $error Error code
+ * @param string $error Error code
* @return string Error message
*/
public function getErrorMessage($error)
View
16 lib/Elastica/Facet/Abstract.php
@@ -35,7 +35,7 @@ public function __construct($name)
* Sets the name of the facet. It is automatically set by
* the constructor.
*
- * @param string $name The name of the facet.
+ * @param string $name The name of the facet.
* @throws Elastica_Exception_Invalid
* @return Elastica_Facet_Abstract
*/
@@ -45,6 +45,7 @@ public function setName($name)
throw new Elastica_Exception_Invalid('Facet name has to be set');
}
$this->_name = $name;
+
return $this;
}
@@ -61,7 +62,7 @@ public function getName()
/**
* Sets a filter for this facet.
*
- * @param Elastica_Filter_Abstract $filter A filter to apply on the facet.
+ * @param Elastica_Filter_Abstract $filter A filter to apply on the facet.
* @return Elastica_Facet_Abstract
*/
public function setFilter(Elastica_Filter_Abstract $filter)
@@ -74,7 +75,7 @@ public function setFilter(Elastica_Filter_Abstract $filter)
* current search query. When not set, it defaults to the
* ElasticSearch default value.
*
- * @param bool $global Flag to either run the facet globally.
+ * @param bool $global Flag to either run the facet globally.
* @return Elastica_Facet_Abstract
*/
public function setGlobal($global = true)
@@ -85,7 +86,7 @@ public function setGlobal($global = true)
/**
* Sets the path to the nested document
*
- * @param string $nestedPath Nested path
+ * @param string $nestedPath Nested path
* @return Elastica_Facet_Abstract
*/
public function setNested($nestedPath)
@@ -96,7 +97,7 @@ public function setNested($nestedPath)
/**
* Sets the scope
*
- * @param string $scope Scope
+ * @param string $scope Scope
* @return Elastica_Facet_Abstract
*/
public function setScope($scope)
@@ -120,13 +121,14 @@ public function toArray()
* Sets a param for the facet. Each facet implementation needs to take
* care of handling their own params.
*
- * @param string $key The key of the param to set.
- * @param mixed $value The value of the param.
+ * @param string $key The key of the param to set.
+ * @param mixed $value The value of the param.
* @return Elastica_Facet_Abstract
*/
protected function _setFacetParam($key, $value)
{
$this->_facet[$key] = $value;
+
return $this;
}
}
View
5 lib/Elastica/Facet/DateHistogram.php
@@ -13,7 +13,7 @@ class Elastica_Facet_DateHistogram extends Elastica_Facet_Histogram
/**
* Set the time_zone parameter
*
- * @param string $tzOffset
+ * @param string $tzOffset
* @return void
*/
public function setTimezone($tzOffset)
@@ -35,6 +35,7 @@ public function toArray()
* Set the range in the abstract as param.
*/
$this->_setFacetParam('date_histogram', $this->_params);
+
return $this->_facet;
}
-}
+}
View
2  lib/Elastica/Facet/Filter.php
@@ -12,7 +12,7 @@ class Elastica_Facet_Filter extends Elastica_Facet_Abstract
/**
* Set the filter for the facet.
*
- * @param Elastica_Filter_Abstract $filter
+ * @param Elastica_Filter_Abstract $filter
* @return Elastica_Facet_Filter
*/
public function setFilter(Elastica_Filter_Abstract $filter)
View
9 lib/Elastica/Facet/GeoDistance.php
@@ -19,7 +19,7 @@ class Elastica_Facet_GeoDistance extends Elastica_Facet_Abstract
* array('from' => 150)
* )
*
- * @param array $ranges Numerical array with range definitions.
+ * @param array $ranges Numerical array with range definitions.
* @return Elastica_Facet_GeoDistance
*/
public function setRanges(array $ranges)
@@ -30,9 +30,9 @@ public function setRanges(array $ranges)
/**
* Set the relative GeoPoint for the facet.
*
- * @param string $typeField index type and field e.g foo.bar
- * @param float $latitude
- * @param float $longitude
+ * @param string $typeField index type and field e.g foo.bar
+ * @param float $latitude
+ * @param float $longitude
* @return Elastica_Facet_GeoDistance
*/
public function setGeoPoint($typeField, $latitude, $longitude)
@@ -57,6 +57,7 @@ public function toArray()
* Set the geo_distance in the abstract as param.
*/
$this->_setFacetParam ( 'geo_distance', $this->_params );
+
return parent::toArray ();
}
}
View
16 lib/Elastica/Facet/Histogram.php
@@ -12,7 +12,7 @@ class Elastica_Facet_Histogram extends Elastica_Facet_Abstract
/**
* Sets the field for histogram
*
- * @param string $field The name of the field for the historgram
+ * @param string $field The name of the field for the historgram
* @return Elastica_Facet_Histogram
*/
public function setField($field)
@@ -23,7 +23,7 @@ public function setField($field)
/**
* Set the value for interval
*
- * @param string $interval
+ * @param string $interval
* @return Elastica_Facet_Range
*/
public function setInterval($interval)
@@ -31,12 +31,11 @@ public function setInterval($interval)
return $this->setParam('interval', $interval);
}
-
/**
* Set the fields for key_field and value_field
*
- * @param string $keyField Key field
- * @param string $valueField Value field
+ * @param string $keyField Key field
+ * @param string $valueField Value field
* @return Elastica_Facet_Range
*/
public function setKeyValueFields($keyField, $valueField)
@@ -47,7 +46,7 @@ public function setKeyValueFields($keyField, $valueField)
/**
* Sets the key and value for this facet by script.
*
- * @param string $keyScript Script to check whether it falls into the range.
+ * @param string $keyScript Script to check whether it falls into the range.
* @param string $valueScript Script to use for statistical calculations.
*/
public function setKeyValueScripts($keyScript, $valueScript)
@@ -59,7 +58,7 @@ public function setKeyValueScripts($keyScript, $valueScript)
/**
* Set the "params" essential to the a script
*
- * @param array $params Associative array (key/value pair)
+ * @param array $params Associative array (key/value pair)
* @return Elastica_Facet_Histogram Facet object
*/
public function setScriptParams(array $params)
@@ -81,6 +80,7 @@ public function toArray()
* Set the range in the abstract as param.
*/
$this->_setFacetParam('histogram', $this->_params);
+
return parent::toArray();
}
-}
+}
View
2  lib/Elastica/Facet/Query.php
@@ -12,7 +12,7 @@ class Elastica_Facet_Query extends Elastica_Facet_Abstract
/**
* Set the query for the facet.
*
- * @param Elastica_Query_Abstract $query
+ * @param Elastica_Query_Abstract $query
* @return Elastica_Facet_Query
*/
public function setQuery(Elastica_Query_Abstract $query)
View
18 lib/Elastica/Facet/Range.php
@@ -12,7 +12,7 @@ class Elastica_Facet_Range extends Elastica_Facet_Abstract
/**
* Sets the field for the range.
*
- * @param string $field The name of the field for range.
+ * @param string $field The name of the field for range.
* @return Elastica_Facet_Range
*/
public function setField($field)
@@ -23,8 +23,8 @@ public function setField($field)
/**
* Sets the fields by their separate key and value fields.
*
- * @param string $keyField The key_field param for the range.
- * @param string $valueField The key_value param for the range.
+ * @param string $keyField The key_field param for the range.
+ * @param string $valueField The key_value param for the range.
* @return Elastica_Facet_Range
*/
public function setKeyValueFields($keyField, $valueField)
@@ -36,7 +36,7 @@ public function setKeyValueFields($keyField, $valueField)
/**
* Sets the key and value for this facet by script.
*
- * @param string $keyScript Script to check whether it falls into the range.
+ * @param string $keyScript Script to check whether it falls into the range.
* @param string $valueScript Script to use for statistical calculations.
*/
public function setKeyValueScripts($keyScript, $valueScript)
@@ -54,7 +54,7 @@ public function setKeyValueScripts($keyScript, $valueScript)
* array('from' => 150)
* )
*
- * @param array $ranges Numerical array with range definitions.
+ * @param array $ranges Numerical array with range definitions.
* @return Elastica_Facet_Range
*/
public function setRanges(array $ranges)
@@ -65,8 +65,8 @@ public function setRanges(array $ranges)
/**
* Adds a range to the range facet.
*
- * @param mixed $from The from for the range.
- * @param mixed $to The to for the range.
+ * @param mixed $from The from for the range.
+ * @param mixed $to The to for the range.
* @return Elastica_Facet_Range
*/
public function addRange($from = null, $to = null)
@@ -76,6 +76,7 @@ public function addRange($from = null, $to = null)
}
$this->_params['ranges'][] = array('from' => $from, 'to' => $to);
+
return $this;
}
@@ -117,6 +118,7 @@ public function toArray()
* Set the range in the abstract as param.
*/
$this->_setFacetParam('range', $this->_params);
+
return parent::toArray();
}
-}
+}
View
7 lib/Elastica/Facet/Statistical.php
@@ -12,7 +12,7 @@ class Elastica_Facet_Statistical extends Elastica_Facet_Abstract
/**
* Sets the field for the statistical query.
*
- * @param string $field The field name for the statistical query.
+ * @param string $field The field name for the statistical query.
* @return Elastica_Facet_Statistical
*/
public function setField($field)
@@ -23,7 +23,7 @@ public function setField($field)
/**
* Sets multiple fields for the statistical query.
*
- * @param array $fields Numerical array with the fields for the statistical query.
+ * @param array $fields Numerical array with the fields for the statistical query.
* @return Elastica_Facet_Statistical
*/
public function setFields(array $fields)
@@ -34,7 +34,7 @@ public function setFields(array $fields)
/**
* Sets a script to calculate statistical information
*
- * @param string $script The script to do calculations on the statistical values
+ * @param string $script The script to do calculations on the statistical values
* @return Elastica_Facet_Statistical
*/
public function setScript($script)
@@ -52,6 +52,7 @@ public function setScript($script)
public function toArray()
{
$this->_setFacetParam('statistical', $this->_params);
+
return parent::toArray();
}
}
View
14 lib/Elastica/Facet/Terms.php
@@ -21,7 +21,7 @@ class Elastica_Facet_Terms extends Elastica_Facet_Abstract
/**
* Sets the field for the terms.
*
- * @param string $field The field name for the terms.
+ * @param string $field The field name for the terms.
* @return Elastica_Facet_Terms
*/
public function setField($field)
@@ -32,7 +32,7 @@ public function setField($field)
/**
* Sets multiple fields for the terms.
*
- * @param array $fields Numerical array with the fields for the terms.
+ * @param array $fields Numerical array with the fields for the terms.
* @return Elastica_Facet_Terms
*/
public function setFields(array $fields)
@@ -44,7 +44,7 @@ public function setFields(array $fields)
* Sets the flag to return all available terms. When they
* don't have a hit, they have a count of zero.
*
- * @param bool $allTerms Flag to fetch all terms.
+ * @param bool $allTerms Flag to fetch all terms.
* @return Elastica_Facet_Terms
*/
public function setAllTerms($allTerms)
@@ -56,7 +56,7 @@ public function setAllTerms($allTerms)
* Sets the ordering type for this facet. ElasticSearch
* internal default is count.
*
- * @param string $type The order type to set use for sorting of the terms.
+ * @param string $type The order type to set use for sorting of the terms.
* @throws Elastica_Exception_Invalid When an invalid order type was set.
* @return Elastica_Facet_Terms
*/
@@ -65,13 +65,14 @@ public function setOrder($type)
if (!in_array($type, $this->_orderTypes)) {
throw new Elastica_Exception_Invalid('Invalid order type: ' . $type);
}
+
return $this->setParam('order', $type);
}
/**
* Set an array with terms which are omitted in the search.
*
- * @param array $exclude Numerical array which includes all terms which needs to be ignored.
+ * @param array $exclude Numerical array which includes all terms which needs to be ignored.
* @return Elastica_Facet_Terms
*/
public function setExclude(array $exclude)
@@ -82,7 +83,7 @@ public function setExclude(array $exclude)
/**
* Sets the amount of terms to be returned.
*
- * @param int $size The amount of terms to be returned.
+ * @param int $size The amount of terms to be returned.
* @return Elastica_Facet_Terms
*/
public function setSize($size)
@@ -100,6 +101,7 @@ public function setSize($size)
public function toArray()
{
$this->_setFacetParam('terms', $this->_params);
+
return parent::toArray();
}
}
View
12 lib/Elastica/Filter/Abstract.php
@@ -12,28 +12,28 @@
/**
* Sets the filter cache
*
- * @param boolean $cached Cached
+ * @param boolean $cached Cached
* @return Elastica_Filter_Abstract
*/
public function setCached($cached = true)
{
- return $this->setParam('_cache', (bool)$cached);
+ return $this->setParam('_cache', (bool) $cached);
}
/**
* Sets the filter cache key
*
- * @param string $cacheKey Cache key
+ * @param string $cacheKey Cache key
* @return Elastica_Filter_Abstract
*/
public function setCacheKey($cacheKey)
{
- $cacheKey = (string)$cacheKey;
+ $cacheKey = (string) $cacheKey;
- if(empty($cacheKey)) {
+ if (empty($cacheKey)) {
throw new Elastica_Exception_Invalid('Invalid parameter. Has to be a non empty string');
}
- return $this->setParam('_cache_key', (string)$cacheKey);
+ return $this->setParam('_cache_key', (string) $cacheKey);
}
}
View
8 lib/Elastica/Filter/Abstract/Multi.php
@@ -18,7 +18,7 @@
/**
* Add filter
*
- * @param Elastica_Filter_Abstract $filter
+ * @param Elastica_Filter_Abstract $filter
* @return Elastica_Filter_Abstract_Multi
*/
public function addFilter(Elastica_Filter_Abstract $filter)
@@ -31,14 +31,14 @@ public function addFilter(Elastica_Filter_Abstract $filter)
/**
* Set filters
*
- * @param array $filters
+ * @param array $filters
* @return Elastica_Filter_Abstract_Multi
*/
public function setFilters(array $filters)
{
$this->_filters = array();
- foreach($filters as $filter) {
+ foreach ($filters as $filter) {
$this->addFilter($filter);
}
@@ -54,7 +54,7 @@ public function toArray()
$name = $this->_getName();
$filterData = $data[$name];
- if(empty($filterData)) {
+ if (empty($filterData)) {
$filterData = $this->_filters;
} else {
$filterData['filters'] = $this->_filters;
View
25 lib/Elastica/Filter/Bool.php
@@ -41,8 +41,8 @@ class Elastica_Filter_Bool extends Elastica_Filter_Abstract
/**
* Adds should filter
*
- * @param array|Elastica_Filter_Abstract $args Filter data
- * @return Elastica_Filter_Bool Current object
+ * @param array|Elastica_Filter_Abstract $args Filter data
+ * @return Elastica_Filter_Bool Current object
*/
public function addShould($args)
{
@@ -52,8 +52,8 @@ public function addShould($args)
/**
* Adds must filter
*
- * @param array|Elastica_Filter_Abstract $args Filter data
- * @return Elastica_Filter_Bool Current object
+ * @param array|Elastica_Filter_Abstract $args Filter data
+ * @return Elastica_Filter_Bool Current object
*/
public function addMust($args)
{
@@ -63,8 +63,8 @@ public function addMust($args)
/**
* Adds mustNot filter
*
- * @param array|Elastica_Filter_Abstract $args Filter data
- * @return Elastica_Filter_Bool Current object
+ * @param array|Elastica_Filter_Abstract $args Filter data
+ * @return Elastica_Filter_Bool Current object
*/
public function addMustNot($args)
{
@@ -74,9 +74,9 @@ public function addMustNot($args)
/**
* Adds general filter based on type
*
- * @param string $type Filter type
- * @param array|Elastica_Filter_Abstract $args Filter data
- * @return Elastica_Filter_Bool Current object
+ * @param string $type Filter type
+ * @param array|Elastica_Filter_Abstract $args Filter data
+ * @return Elastica_Filter_Bool Current object
*/
protected function _addFilter($type, $args)
{
@@ -90,6 +90,7 @@ protected function _addFilter($type, $args)
$varName = '_' . $type;
$this->{$varName}[] = $args;
+
return $this;
}
@@ -121,24 +122,26 @@ public function toArray()
/**
* Sets the boost value for this filter
*
- * @param float $boost Boost
+ * @param float $boost Boost
* @return Elastica_Filter_Bool Current object
*/
public function setBoost($boost)
{
$this->_boost = $boost;
+
return $this;
}
/**
* Sets the minimum number that should filter have to match
*
- * @param int $minimumNumberShouldMatch Number of matches
+ * @param int $minimumNumberShouldMatch Number of matches
* @return Elastica_Filter_Bool Current object
*/
public function setMinimumNumberShouldMatch($minimumNumberShouldMatch)
{
$this->_minimumNumberShouldMatch = intval($minimumNumberShouldMatch);
+
return $this;
}
View
2  lib/Elastica/Filter/Exists.php
@@ -23,7 +23,7 @@ public function __construct($field)
/**
* Set field
*
- * @param string $field
+ * @param string $field
* @return Elastica_Filter_Exists
*/
public function setField($field)
View
10 lib/Elastica/Filter/GeoBoundingBox.php
@@ -14,8 +14,8 @@ class Elastica_Filter_GeoBoundingBox extends Elastica_Filter_Abstract
/**
* Construct GeoBoundingBox filter
*
- * @param string $key Key
- * @param array $coordinates Array with top left coordinate as first and bottom right coordinate as second element
+ * @param string $key Key
+ * @param array $coordinates Array with top left coordinate as first and bottom right coordinate as second element
*/
public function __construct($key, array $coordinates)
{
@@ -25,9 +25,9 @@ public function __construct($key, array $coordinates)
/**
* Add coordinates
*
- * @param string $key Key
- * @param array $coordinates Array with top left coordinate as first and bottom right coordinate as second element
- * @throws Elastica_Exception_Invalid If $coordinates doesn't have two elements
+ * @param string $key Key
+ * @param array $coordinates Array with top left coordinate as first and bottom right coordinate as second element
+ * @throws Elastica_Exception_Invalid If $coordinates doesn't have two elements
* @return Elastica_Filter_GeoBoundingBox Current object
*/
public function addCoordinates($key, array $coordinates)
View
18 lib/Elastica/Filter/GeoDistance.php
@@ -40,10 +40,10 @@ class Elastica_Filter_GeoDistance extends Elastica_Filter_Abstract
/**
* Create GeoDistance object
*
- * @param string $key Key
- * @param string $latitude Latitude
+ * @param string $key Key
+ * @param string $latitude Latitude
* @param string $longitude Longitude
- * @param string $distance Distance
+ * @param string $distance Distance
*/
public function __construct($key, $latitude, $longitude, $distance)
{
@@ -56,38 +56,40 @@ public function __construct($key, $latitude, $longitude, $distance)
/**
* Sets the distance to search for
*
- * @param string $distance Distance
+ * @param string $distance Distance
* @return Elastica_Filter_GeoDistance Current object
*/
public function setDistance($distance)
{
// TODO: validate distance?
$this->_distance = $distance;
+
return $this;
}
/**
* Sets the laititude
*
- * @param string $latitude Latitude
+ * @param string $latitude Latitude
* @return Elastica_Filter_GeoDistance Current object
*/
public function setLatitude($latitude)
{
$this->_latitude = $latitude;
+
return $this;
}
-
/**
* Sets the longitude
*
- * @param string $longitude Longitude
+ * @param string $longitude Longitude
* @return Elastica_Filter_GeoDistance Current object
*/
public function setLongitude($longitude)
{
$this->_longitude = $longitude;
+
return $this;
}
@@ -109,4 +111,4 @@ public function toArray()
),
);
}
-}
+}
View
4 lib/Elastica/Filter/GeoPolygon.php
@@ -28,8 +28,8 @@ class Elastica_Filter_GeoPolygon extends Elastica_Filter_Abstract
/**
* Construct polygon filter
*
- * @param string $key Key
- * @param array $points Points making up polygon
+ * @param string $key Key
+ * @param array $points Points making up polygon
*/
public function __construct($key, array $points)
{
View
9 lib/Elastica/Filter/HasChild.php
@@ -15,7 +15,7 @@ class Elastica_Filter_HasChild extends Elastica_Filter_Abstract
* Construct HasChild filter
*
* @param string|Elastica_Query $query Query string or a Elastica_Query object
- * @param string $type Parent document type
+ * @param string $type Parent document type
*/
public function __construct($query, $type = null)
{
@@ -26,20 +26,21 @@ public function __construct($query, $type = null)
/**
* Sets query object
*
- * @param string|Elastica_Query|Elastica_Query_Abstract $query
- * @return Elastica_Filter_HasChild Current object
+ * @param string|Elastica_Query|Elastica_Query_Abstract $query
+ * @return Elastica_Filter_HasChild Current object
*/
public function setQuery($query)
{
$query = Elastica_Query::create($query);
$data = $query->toArray();
+
return $this->setParam('query', $data['query']);
}
/**
* Set type of the parent document
*
- * @param string $type Parent document type
+ * @param string $type Parent document type
* @return Elastica_Filter_HasChild Current object
*/
public function setType($type)
View
12 lib/Elastica/Filter/Ids.php
@@ -14,7 +14,7 @@ class Elastica_Filter_Ids extends Elastica_Filter_Abstract
* Creates filter object
*
* @param string|Elastica_Type $type Type to filter on
- * @param array $ids List of ids
+ * @param array $ids List of ids
*/
public function __construct($type = null, array $ids = array())
{
@@ -25,7 +25,7 @@ public function __construct($type = null, array $ids = array())
/**
* Adds one more filter to the and filter
*
- * @param string $id Adds id to filter
+ * @param string $id Adds id to filter
* @return Elastica_Filter_Ids Current object
*/
public function addId($id)
@@ -36,7 +36,7 @@ public function addId($id)
/**
* Adds one more type to query
*
- * @param string $type Adds type to query
+ * @param string $type Adds type to query
* @return Elastica_Filter_Ids Current object
*/
public function addType($type)
@@ -55,8 +55,8 @@ public function addType($type)
/**
* Set type
*
- * @param string|Elastica_Type $type Type name or object
- * @return Elastica_Filter_Ids Current object
+ * @param string|Elastica_Type $type Type name or object
+ * @return Elastica_Filter_Ids Current object
*/
public function setType($type)
{
@@ -74,7 +74,7 @@ public function setType($type)
/**
* Sets the ids to filter
*
- * @param array|string $ids List of ids
+ * @param array|string $ids List of ids
* @return Elastica_Filter_Ids Current object
*/
public function setIds($ids)
View
6 lib/Elastica/Filter/Limit.php
@@ -13,7 +13,7 @@ class Elastica_Filter_Limit extends Elastica_Filter_Abstract
/**
* Construct limit filter
*
- * @param int $limit Limit
+ * @param int $limit Limit
* @return Elastica_Filter_Limit
*/
public function __construct($limit)
@@ -24,11 +24,11 @@ public function __construct($limit)
/**
* Set the limit
*
- * @param int $limit Limit
+ * @param int $limit Limit
* @return Elastica_Filter_Limit
*/
public function setLimit($limit)
{
- return $this->setParam('value', (int)$limit);
+ return $this->setParam('value', (int) $limit);
}
}
View
2  lib/Elastica/Filter/Missing.php
@@ -33,5 +33,3 @@ public function setField($field)
return $this->setParam('field', (string) $field);
}
}
-
-
View
6 lib/Elastica/Filter/Nested.php
@@ -13,7 +13,7 @@ class Elastica_Filter_Nested extends Elastica_Filter_Abstract
/**
* Adds field to mlt filter
*
- * @param string $path Nested object path
+ * @param string $path Nested object path
* @return Elastica_Filter_Nested
*/
public function setPath($path)
@@ -24,7 +24,7 @@ public function setPath($path)
/**
* Sets nested query
*
- * @param Elastica_Query_Abstract $query
+ * @param Elastica_Query_Abstract $query
* @return Elastica_Filter_Nested
*/
public function setQuery(Elastica_Query_Abstract $query)
@@ -35,7 +35,7 @@ public function setQuery(Elastica_Query_Abstract $query)
/**
* Set score mode
*
- * @param string $scoreMode Options: avg, total, max and none.
+ * @param string $scoreMode Options: avg, total, max and none.
* @return Elastica_Filter_Nested
*/
public function setScoreMode($scoreMode)
View
2  lib/Elastica/Filter/Not.php
@@ -23,7 +23,7 @@ public function __construct(Elastica_Filter_Abstract $filter)
/**
* Set filter
*
- * @param Elastica_Filter_Abstract $filter
+ * @param Elastica_Filter_Abstract $filter
* @return Elastica_Filter_Not
*/
public function setFilter(Elastica_Filter_Abstract $filter)
View
5 lib/Elastica/Filter/Prefix.php
@@ -27,7 +27,7 @@ class Elastica_Filter_Prefix extends Elastica_Filter_Abstract
/**
* Creates prefix filter
*
- * @param string $field Field name
+ * @param string $field Field name
* @param string $prefix Prefix string
*/
public function __construct($field = '', $prefix = '')
@@ -44,6 +44,7 @@ public function __construct($field = '', $prefix = '')
public function setField($field)
{
$this->_field = $field;
+
return $this;
}
@@ -55,6 +56,7 @@ public function setField($field)
public function setPrefix($prefix)
{
$this->_prefix = $prefix;
+
return $this;
}
@@ -67,6 +69,7 @@ public function setPrefix($prefix)
public function toArray()
{
$this->setParam($this->_field, $this->_prefix);
+
return parent::toArray();
}
}
View
10 lib/Elastica/Filter/Query.php
@@ -31,9 +31,9 @@ public function __construct($query = null)
/**
* Set query
*
- * @param array|Elastica_Query_Abstract $query
- * @return Elastca_Filter_Query Query object
- * @throws Elastica_Exception_Invalid Invalid param
+ * @param array|Elastica_Query_Abstract $query
+ * @return Elastca_Filter_Query Query object
+ * @throws Elastica_Exception_Invalid Invalid param
*/
public function setQuery($query)
{
@@ -55,7 +55,7 @@ public function setQuery($query)
*/
protected function _getName()
{
- if(empty($this->_params)) {
+ if (empty($this->_params)) {
return parent::_getName();
} else {
return 'fquery';
@@ -72,7 +72,7 @@ public function toArray()
$name = $this->_getName();
$filterData = $data[$name];
- if(empty($filterData)) {
+ if (empty($filterData)) {
$filterData = $this->_query;
} else {
$filterData['query'] = $this->_query;
View
10 lib/Elastica/Filter/Range.php
@@ -20,8 +20,8 @@ class Elastica_Filter_Range extends Elastica_Filter_Abstract
/**
* Construct range filter
*
- * @param string $fieldName Field name
- * @param array $args Field arguments
+ * @param string $fieldName Field name
+ * @param array $args Field arguments
* @return Elastica_Filter_Range
*/
public function __construct($fieldName = false, array $args = array())
@@ -34,13 +34,14 @@ public function __construct($fieldName = false, array $args = array())
/**
* Ads a field with arguments to the range query
*
- * @param string $fieldName Field name
- * @param array $args Field arguments
+ * @param string $fieldName Field name
+ * @param array $args Field arguments
* @return Elastica_Filter_Range
*/
public function addField($fieldName, array $args)
{
$this->_fields[$fieldName] = $args;
+
return $this;
}
@@ -53,6 +54,7 @@ public function addField($fieldName, array $args)
public function toArray()
{
$this->setParams($this->_fields);
+
return parent::toArray();
}
}
View
4 lib/Elastica/Filter/Script.php
@@ -33,9 +33,9 @@ public function __construct($query = null)
/**
* Sets query object
*
- * @param array|Elastica_Query_Abstract $query
+ * @param array|Elastica_Query_Abstract $query
* @return Elastica_Filter_Script
- * @throws Elastica_Exception_Invalid Invalid argument type
+ * @throws Elastica_Exception_Invalid Invalid argument type
*/
public function setQuery($query)
{
View
6 lib/Elastica/Filter/Term.php
@@ -23,7 +23,7 @@ public function __construct(array $term = array())
/**
* Sets/overwrites key and term directly
*
- * @param array $term Key value pair
+ * @param array $term Key value pair
* @return Elastica_Filter_Term Filter object
*/
public function setRawTerm(array $term)
@@ -34,8 +34,8 @@ public function setRawTerm(array $term)
/**
* Adds a term to the term query
*
- * @param string $key Key to query
- * @param string|array $value Values(s) for the query. Boost can be set with array
+ * @param string $key Key to query
+ * @param string|array $value Values(s) for the query. Boost can be set with array
* @return Elastica_Filter_Term Filter object
*/
public function setTerm($key, $value)
View
13 lib/Elastica/Filter/Terms.php
@@ -34,8 +34,8 @@ class Elastica_Filter_Terms extends Elastica_Filter_Abstract
/**
* Creates terms filter
*
- * @param string $key Terms key
- * @param array $terms Terms values
+ * @param string $key Terms key
+ * @param array $terms Terms values
*/
public function __construct($key = '', array $terms = array())
{
@@ -45,25 +45,27 @@ public function __construct($key = '', array $terms = array())
/**
* Sets key and terms for the filter
*
- * @param string $key Terms key
- * @param array $terms Terms for the query.
+ * @param string $key Terms key
+ * @param array $terms Terms for the query.
*/
public function setTerms($key, array $terms)
{
$this->_key = $key;
$this->_terms = array_values($terms);
+
return $this;
}
/**
* Adds an additional term to the query
*
- * @param string $term Filter term
+ * @param string $term Filter term
* @return Elastica_Filter_Abstract Filter object
*/
public function addTerm($term)
{
$this->_terms[] = $term;
+
return $this;
}
@@ -79,6 +81,7 @@ public function toArray()
throw new Elastica_Exception_Invalid('Terms key has to be set');
}
$this->_params[$this->_key] = $this->_terms;
+
return array('terms' => $this->_params);
}
}
View
5 lib/Elastica/Filter/Type.php
@@ -20,7 +20,7 @@ class Elastica_Filter_Type extends Elastica_Filter_Abstract
/**
* Construct Type Filter
*
- * @param string $typeName Type name
+ * @param string $typeName Type name
* @return Elastica_Filter_Type
*/
public function __construct($typeName = null)
@@ -33,12 +33,13 @@ public function __construct($typeName = null)
/**
* Ads a field with arguments to the range query
*
- * @param string $typeName Type name
+ * @param string $typeName Type name
* @return Elastica_Filter_Type current object
*/
public function setType($typeName)
{
$this->_type = $typeName;
+
return $this;
}
View
43 lib/Elastica/Index.php
@@ -45,7 +45,7 @@ public function __construct(Elastica_Client $client, $name)
/**
* Returns a type object for the current index with the given name
*
- * @param string $type Type name
+ * @param string $type Type name
* @return Elastica_Type Type object
*/
public function getType($type)
@@ -83,6 +83,7 @@ public function getMapping()
$path = '_mapping';
$response = $this->request($path, Elastica_Request::GET);
+
return $response->getData();
}
@@ -114,10 +115,10 @@ public function addDocuments(array $docs)
/**