Permalink
Browse files

php-cs-fixer fix --level=all

  • Loading branch information...
1 parent 0abadf3 commit 1fba1264cf6215c9a95722955a769778051b0496 @lavoiesl lavoiesl committed Jul 17, 2012
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
@@ -187,4 +187,4 @@
<arg line="--max-user-speed 50" />
</exec>
</target>
-</project>
+</project>
View
@@ -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
@@ -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);
}
}
@@ -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);
}
}
Oops, something went wrong.

0 comments on commit 1fba126

Please sign in to comment.