diff options
Diffstat (limited to 'vendor/ruflin/elastica/lib/Elastica/Exception')
20 files changed, 94 insertions, 130 deletions
diff --git a/vendor/ruflin/elastica/lib/Elastica/Exception/Bulk/Response/ActionException.php b/vendor/ruflin/elastica/lib/Elastica/Exception/Bulk/Response/ActionException.php index 6500e040..5db0e49f 100644 --- a/vendor/ruflin/elastica/lib/Elastica/Exception/Bulk/Response/ActionException.php +++ b/vendor/ruflin/elastica/lib/Elastica/Exception/Bulk/Response/ActionException.php @@ -1,10 +1,8 @@ <?php - namespace Elastica\Exception\Bulk\Response; -use Elastica\Exception\BulkException; -use Elastica\Bulk\Action; use Elastica\Bulk\Response; +use Elastica\Exception\BulkException; class ActionException extends BulkException { @@ -41,6 +39,7 @@ class ActionException extends BulkException /** * @param \Elastica\Bulk\Response $response + * * @return string */ public function getErrorMessage(Response $response) @@ -51,13 +50,13 @@ class ActionException extends BulkException $path = ''; if (isset($data['_index'])) { - $path.= '/' . $data['_index']; + $path .= '/'.$data['_index']; } if (isset($data['_type'])) { - $path.= '/' . $data['_type']; + $path .= '/'.$data['_type']; } if (isset($data['_id'])) { - $path.= '/' . $data['_id']; + $path .= '/'.$data['_id']; } $message = "$opType: $path caused $error"; diff --git a/vendor/ruflin/elastica/lib/Elastica/Exception/Bulk/ResponseException.php b/vendor/ruflin/elastica/lib/Elastica/Exception/Bulk/ResponseException.php index 9df1b3e8..54b5702b 100644 --- a/vendor/ruflin/elastica/lib/Elastica/Exception/Bulk/ResponseException.php +++ b/vendor/ruflin/elastica/lib/Elastica/Exception/Bulk/ResponseException.php @@ -1,5 +1,4 @@ <?php - namespace Elastica\Exception\Bulk; use Elastica\Bulk\ResponseSet; @@ -7,16 +6,11 @@ use Elastica\Exception\Bulk\Response\ActionException; use Elastica\Exception\BulkException; /** - * Bulk Response exception - * - * @category Xodoa - * @package Elastica + * Bulk Response exception. */ class ResponseException extends BulkException { /** - * Response - * * @var \Elastica\Bulk\ResponseSet ResponseSet object */ protected $_responseSet; @@ -27,7 +21,7 @@ class ResponseException extends BulkException protected $_actionExceptions = array(); /** - * Construct Exception + * Construct Exception. * * @param \Elastica\Bulk\ResponseSet $responseSet */ @@ -35,8 +29,8 @@ class ResponseException extends BulkException { $this->_init($responseSet); - $message = 'Error in one or more bulk request actions:' . PHP_EOL . PHP_EOL; - $message.= $this->getActionExceptionsAsString(); + $message = 'Error in one or more bulk request actions:'.PHP_EOL.PHP_EOL; + $message .= $this->getActionExceptionsAsString(); parent::__construct($message); } @@ -56,7 +50,7 @@ class ResponseException extends BulkException } /** - * Returns bulk response set object + * Returns bulk response set object. * * @return \Elastica\Bulk\ResponseSet */ @@ -66,7 +60,7 @@ class ResponseException extends BulkException } /** - * Returns array of failed actions + * Returns array of failed actions. * * @return array Array of failed actions */ @@ -96,8 +90,9 @@ class ResponseException extends BulkException { $message = ''; foreach ($this->getActionExceptions() as $actionException) { - $message.= $actionException->getMessage() . PHP_EOL; + $message .= $actionException->getMessage().PHP_EOL; } + return $message; } } diff --git a/vendor/ruflin/elastica/lib/Elastica/Exception/Bulk/UdpException.php b/vendor/ruflin/elastica/lib/Elastica/Exception/Bulk/UdpException.php index 0b2d4d2e..e332b92f 100644 --- a/vendor/ruflin/elastica/lib/Elastica/Exception/Bulk/UdpException.php +++ b/vendor/ruflin/elastica/lib/Elastica/Exception/Bulk/UdpException.php @@ -1,5 +1,4 @@ <?php - namespace Elastica\Exception\Bulk; use Elastica\Exception\BulkException; diff --git a/vendor/ruflin/elastica/lib/Elastica/Exception/BulkException.php b/vendor/ruflin/elastica/lib/Elastica/Exception/BulkException.php index 6d384556..121cf557 100644 --- a/vendor/ruflin/elastica/lib/Elastica/Exception/BulkException.php +++ b/vendor/ruflin/elastica/lib/Elastica/Exception/BulkException.php @@ -1,5 +1,4 @@ <?php - namespace Elastica\Exception; class BulkException extends \RuntimeException implements ExceptionInterface diff --git a/vendor/ruflin/elastica/lib/Elastica/Exception/ClientException.php b/vendor/ruflin/elastica/lib/Elastica/Exception/ClientException.php index 00efd67d..66af363d 100644 --- a/vendor/ruflin/elastica/lib/Elastica/Exception/ClientException.php +++ b/vendor/ruflin/elastica/lib/Elastica/Exception/ClientException.php @@ -1,12 +1,9 @@ <?php - namespace Elastica\Exception; /** - * Client exception + * Client exception. * - * @category Xodoa - * @package Elastica * @author Nicolas Ruflin <spam@ruflin.com> */ class ClientException extends \RuntimeException implements ExceptionInterface diff --git a/vendor/ruflin/elastica/lib/Elastica/Exception/Connection/GuzzleException.php b/vendor/ruflin/elastica/lib/Elastica/Exception/Connection/GuzzleException.php index 645c0eff..614ad139 100644 --- a/vendor/ruflin/elastica/lib/Elastica/Exception/Connection/GuzzleException.php +++ b/vendor/ruflin/elastica/lib/Elastica/Exception/Connection/GuzzleException.php @@ -1,5 +1,4 @@ <?php - namespace Elastica\Exception\Connection; use Elastica\Exception\ConnectionException; @@ -8,9 +7,8 @@ use Elastica\Response; use GuzzleHttp\Exception\TransferException; /** - * Transport exception + * Transport exception. * - * @package Elastica * @author Milan Magudia <milan@magudia.com> */ class GuzzleException extends ConnectionException @@ -22,8 +20,8 @@ class GuzzleException extends ConnectionException /** * @param \GuzzleHttp\Exception\TransferException $guzzleException - * @param \Elastica\Request $request - * @param \Elastica\Response $response + * @param \Elastica\Request $request + * @param \Elastica\Response $response */ public function __construct(TransferException $guzzleException, Request $request = null, Response $response = null) { @@ -34,6 +32,7 @@ class GuzzleException extends ConnectionException /** * @param \GuzzleHttp\Exception\TransferException $guzzleException + * * @return string */ public function getErrorMessage(TransferException $guzzleException) diff --git a/vendor/ruflin/elastica/lib/Elastica/Exception/Connection/HttpException.php b/vendor/ruflin/elastica/lib/Elastica/Exception/Connection/HttpException.php index 2a36fe48..28e78e77 100644 --- a/vendor/ruflin/elastica/lib/Elastica/Exception/Connection/HttpException.php +++ b/vendor/ruflin/elastica/lib/Elastica/Exception/Connection/HttpException.php @@ -1,5 +1,4 @@ <?php - namespace Elastica\Exception\Connection; use Elastica\Exception\ConnectionException; @@ -7,25 +6,23 @@ use Elastica\Request; use Elastica\Response; /** - * Connection exception + * Connection exception. * - * @category Xodoa - * @package Elastica * @author Nicolas Ruflin <spam@ruflin.com> */ class HttpException extends ConnectionException { /** - * Error code / message + * Error code / message. * * @var string Error code / message */ protected $_error = 0; /** - * Construct Exception + * Construct Exception. * - * @param string $error Error + * @param string $error Error * @param \Elastica\Request $request * @param \Elastica\Response $response */ @@ -39,22 +36,23 @@ class HttpException extends ConnectionException /** * 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} + * 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) { switch ($error) { case CURLE_UNSUPPORTED_PROTOCOL: - $error = "Unsupported protocol"; + $error = 'Unsupported protocol'; break; case CURLE_FAILED_INIT: - $error = "Internal cUrl error?"; + $error = 'Internal cUrl error?'; break; case CURLE_URL_MALFORMAT: - $error = "Malformed URL"; + $error = 'Malformed URL'; break; case CURLE_COULDNT_RESOLVE_PROXY: $error = "Couldn't resolve proxy"; @@ -66,10 +64,10 @@ class HttpException extends ConnectionException $error = "Couldn't connect to host, Elasticsearch down?"; break; case 28: - $error = "Operation timed out"; + $error = 'Operation timed out'; break; default: - $error = "Unknown error:" . $error; + $error = 'Unknown error:'.$error; break; } @@ -77,7 +75,7 @@ class HttpException extends ConnectionException } /** - * Return Error code / message + * Return Error code / message. * * @return string Error code / message */ diff --git a/vendor/ruflin/elastica/lib/Elastica/Exception/Connection/MemcacheException.php b/vendor/ruflin/elastica/lib/Elastica/Exception/Connection/MemcacheException.php new file mode 100644 index 00000000..24181379 --- /dev/null +++ b/vendor/ruflin/elastica/lib/Elastica/Exception/Connection/MemcacheException.php @@ -0,0 +1,13 @@ +<?php +namespace Elastica\Exception\Connection; + +use Elastica\Exception\ConnectionException; + +/** + * Transport exception. + * + * @author Igor Denisenko <im.denisenko@yahoo.com> + */ +class MemcacheException extends ConnectionException +{ +} diff --git a/vendor/ruflin/elastica/lib/Elastica/Exception/Connection/ThriftException.php b/vendor/ruflin/elastica/lib/Elastica/Exception/Connection/ThriftException.php index 0ca331c7..499cbd7d 100644 --- a/vendor/ruflin/elastica/lib/Elastica/Exception/Connection/ThriftException.php +++ b/vendor/ruflin/elastica/lib/Elastica/Exception/Connection/ThriftException.php @@ -1,5 +1,4 @@ <?php - namespace Elastica\Exception\Connection; use Elastica\Exception\ConnectionException; @@ -8,10 +7,8 @@ use Elastica\Response; use Thrift\Exception\TException; /** - * Transport exception + * Transport exception. * - * @category Xodoa - * @package Elastica * @author Mikhail Shamin <munk13@gmail.com> */ class ThriftException extends ConnectionException @@ -23,8 +20,8 @@ class ThriftException extends ConnectionException /** * @param \Thrift\Exception\TException $thriftException - * @param \Elastica\Request $request - * @param \Elastica\Response $response + * @param \Elastica\Request $request + * @param \Elastica\Response $response */ public function __construct(TException $thriftException, Request $request = null, Response $response = null) { @@ -35,6 +32,7 @@ class ThriftException extends ConnectionException /** * @param \Thrift\Exception\TException $thriftException + * * @return string */ public function getErrorMessage(TException $thriftException) diff --git a/vendor/ruflin/elastica/lib/Elastica/Exception/ConnectionException.php b/vendor/ruflin/elastica/lib/Elastica/Exception/ConnectionException.php index 35d60472..b2376d2f 100644 --- a/vendor/ruflin/elastica/lib/Elastica/Exception/ConnectionException.php +++ b/vendor/ruflin/elastica/lib/Elastica/Exception/ConnectionException.php @@ -1,37 +1,30 @@ <?php - namespace Elastica\Exception; use Elastica\Request; use Elastica\Response; /** - * Connection exception + * Connection exception. * - * @category Xodoa - * @package Elastica * @author Nicolas Ruflin <spam@ruflin.com> */ class ConnectionException extends \RuntimeException implements ExceptionInterface { /** - * Request - * * @var \Elastica\Request Request object */ protected $_request; /** - * Response - * * @var \Elastica\Response Response object */ protected $_response; /** - * Construct Exception + * Construct Exception. * - * @param string $message Message + * @param string $message Message * @param \Elastica\Request $request * @param \Elastica\Response $response */ @@ -44,7 +37,7 @@ class ConnectionException extends \RuntimeException implements ExceptionInterfac } /** - * Returns request object + * Returns request object. * * @return \Elastica\Request Request object */ @@ -54,7 +47,7 @@ class ConnectionException extends \RuntimeException implements ExceptionInterfac } /** - * Returns response object + * Returns response object. * * @return \Elastica\Response Response object */ diff --git a/vendor/ruflin/elastica/lib/Elastica/Exception/ElasticsearchException.php b/vendor/ruflin/elastica/lib/Elastica/Exception/ElasticsearchException.php index 0f7509f9..59cca0c6 100644 --- a/vendor/ruflin/elastica/lib/Elastica/Exception/ElasticsearchException.php +++ b/vendor/ruflin/elastica/lib/Elastica/Exception/ElasticsearchException.php @@ -1,37 +1,29 @@ <?php - namespace Elastica\Exception; /** - * Elasticsearch exception + * Elasticsearch exception. * - * @category Xodoa - * @package Elastica * @author Ian Babrou <ibobrik@gmail.com> */ -class ElasticsearchException extends \Exception +class ElasticsearchException extends \Exception implements ExceptionInterface { - const REMOTE_TRANSPORT_EXCEPTION = 'RemoteTransportException'; /** - * Elasticsearch exception name - * - * @var string|null + * @var string|null Elasticsearch exception name */ private $_exception; /** - * Whether exception was local to server node or remote - * - * @var bool + * @var bool Whether exception was local to server node or remote */ private $_isRemote = false; /** - * Constructs elasticsearch exception + * Constructs elasticsearch exception. * - * @param int $code Error code + * @param int $code Error code * @param string $error Error message from elasticsearch */ public function __construct($code, $error) @@ -41,7 +33,7 @@ class ElasticsearchException extends \Exception } /** - * Parse error message from elasticsearch + * Parse error message from elasticsearch. * * @param string $error Error message */ @@ -62,9 +54,10 @@ class ElasticsearchException extends \Exception } /** - * Extract exception name from error response + * Extract exception name from error response. * * @param string $error + * * @return null|string */ protected function _extractException($error) @@ -72,12 +65,12 @@ class ElasticsearchException extends \Exception if (preg_match('/^(\w+)\[.*\]/', $error, $matches)) { return $matches[1]; } else { - return null; + return; } } /** - * Returns elasticsearch exception name + * Returns elasticsearch exception name. * * @return string|null */ @@ -87,7 +80,7 @@ class ElasticsearchException extends \Exception } /** - * Returns whether exception was local to server node or remote + * Returns whether exception was local to server node or remote. * * @return bool */ @@ -95,5 +88,4 @@ class ElasticsearchException extends \Exception { return $this->_isRemote; } - } diff --git a/vendor/ruflin/elastica/lib/Elastica/Exception/ExceptionInterface.php b/vendor/ruflin/elastica/lib/Elastica/Exception/ExceptionInterface.php index 746c9c81..02f43092 100644 --- a/vendor/ruflin/elastica/lib/Elastica/Exception/ExceptionInterface.php +++ b/vendor/ruflin/elastica/lib/Elastica/Exception/ExceptionInterface.php @@ -1,12 +1,9 @@ <?php - namespace Elastica\Exception; /** - * General Elastica exception interface + * General Elastica exception interface. * - * @category Xodoa - * @package Elastica * @author Nicolas Ruflin <spam@ruflin.com> */ interface ExceptionInterface diff --git a/vendor/ruflin/elastica/lib/Elastica/Exception/InvalidException.php b/vendor/ruflin/elastica/lib/Elastica/Exception/InvalidException.php index ff4a4cd3..996a9389 100644 --- a/vendor/ruflin/elastica/lib/Elastica/Exception/InvalidException.php +++ b/vendor/ruflin/elastica/lib/Elastica/Exception/InvalidException.php @@ -1,12 +1,9 @@ <?php - namespace Elastica\Exception; /** - * Invalid exception + * Invalid exception. * - * @category Xodoa - * @package Elastica * @author Nicolas Ruflin <spam@ruflin.com> */ class InvalidException extends \InvalidArgumentException implements ExceptionInterface diff --git a/vendor/ruflin/elastica/lib/Elastica/Exception/JSONParseException.php b/vendor/ruflin/elastica/lib/Elastica/Exception/JSONParseException.php index 3cf39911..010adf45 100644 --- a/vendor/ruflin/elastica/lib/Elastica/Exception/JSONParseException.php +++ b/vendor/ruflin/elastica/lib/Elastica/Exception/JSONParseException.php @@ -1,11 +1,8 @@ <?php - namespace Elastica\Exception; /** - * JSON Parse exception - * - * @package Elastica + * JSON Parse exception. */ class JSONParseException extends \RuntimeException implements ExceptionInterface { diff --git a/vendor/ruflin/elastica/lib/Elastica/Exception/NotFoundException.php b/vendor/ruflin/elastica/lib/Elastica/Exception/NotFoundException.php index 539b01c2..a2897fd7 100644 --- a/vendor/ruflin/elastica/lib/Elastica/Exception/NotFoundException.php +++ b/vendor/ruflin/elastica/lib/Elastica/Exception/NotFoundException.php @@ -1,12 +1,9 @@ <?php - namespace Elastica\Exception; /** - * Not found exception + * Not found exception. * - * @category Xodoa - * @package Elastica * @author Nicolas Ruflin <spam@ruflin.com> */ class NotFoundException extends \RuntimeException implements ExceptionInterface diff --git a/vendor/ruflin/elastica/lib/Elastica/Exception/NotImplementedException.php b/vendor/ruflin/elastica/lib/Elastica/Exception/NotImplementedException.php index 49d3918b..591417b6 100644 --- a/vendor/ruflin/elastica/lib/Elastica/Exception/NotImplementedException.php +++ b/vendor/ruflin/elastica/lib/Elastica/Exception/NotImplementedException.php @@ -1,14 +1,11 @@ <?php - namespace Elastica\Exception; /** - * Not implemented exception + * Not implemented exception. * * Is thrown if a function or feature is not implemented yet * - * @category Xodoa - * @package Elastica * @author Nicolas Ruflin <spam@ruflin.com> */ class NotImplementedException extends \BadMethodCallException implements ExceptionInterface diff --git a/vendor/ruflin/elastica/lib/Elastica/Exception/PartialShardFailureException.php b/vendor/ruflin/elastica/lib/Elastica/Exception/PartialShardFailureException.php index f853bf96..bb3fa44a 100644 --- a/vendor/ruflin/elastica/lib/Elastica/Exception/PartialShardFailureException.php +++ b/vendor/ruflin/elastica/lib/Elastica/Exception/PartialShardFailureException.php @@ -1,5 +1,4 @@ <?php - namespace Elastica\Exception; use Elastica\JSON; @@ -7,19 +6,16 @@ use Elastica\Request; use Elastica\Response; /** - * Partial shard failure exception + * Partial shard failure exception. * - * @category Xodoa - * @package Elastica * @author Ian Babrou <ibobrik@gmail.com> */ class PartialShardFailureException extends ResponseException { - /** - * Construct Exception + * Construct Exception. * - * @param \Elastica\Request $request + * @param \Elastica\Request $request * @param \Elastica\Response $response */ public function __construct(Request $request, Response $response) @@ -29,5 +25,4 @@ class PartialShardFailureException extends ResponseException $shardsStatistics = $response->getShardsStatistics(); $this->message = JSON::stringify($shardsStatistics['failed']); } - } diff --git a/vendor/ruflin/elastica/lib/Elastica/Exception/QueryBuilderException.php b/vendor/ruflin/elastica/lib/Elastica/Exception/QueryBuilderException.php new file mode 100644 index 00000000..ae03c831 --- /dev/null +++ b/vendor/ruflin/elastica/lib/Elastica/Exception/QueryBuilderException.php @@ -0,0 +1,11 @@ +<?php +namespace Elastica\Exception; + +/** + * QueryBuilder exception. + * + * @author Manuel Andreo Garcia <andreo.garcia@googlemail.com> + */ +class QueryBuilderException extends \RuntimeException implements ExceptionInterface +{ +} diff --git a/vendor/ruflin/elastica/lib/Elastica/Exception/ResponseException.php b/vendor/ruflin/elastica/lib/Elastica/Exception/ResponseException.php index 63244487..57502307 100644 --- a/vendor/ruflin/elastica/lib/Elastica/Exception/ResponseException.php +++ b/vendor/ruflin/elastica/lib/Elastica/Exception/ResponseException.php @@ -1,37 +1,30 @@ <?php - namespace Elastica\Exception; use Elastica\Request; use Elastica\Response; /** - * Response exception + * Response exception. * - * @category Xodoa - * @package Elastica * @author Nicolas Ruflin <spam@ruflin.com> */ class ResponseException extends \RuntimeException implements ExceptionInterface { /** - * Request - * * @var \Elastica\Request Request object */ protected $_request = null; /** - * Response - * * @var \Elastica\Response Response object */ protected $_response = null; /** - * Construct Exception + * Construct Exception. * - * @param \Elastica\Request $request + * @param \Elastica\Request $request * @param \Elastica\Response $response */ public function __construct(Request $request, Response $response) @@ -42,7 +35,7 @@ class ResponseException extends \RuntimeException implements ExceptionInterface } /** - * Returns request object + * Returns request object. * * @return \Elastica\Request Request object */ @@ -52,7 +45,7 @@ class ResponseException extends \RuntimeException implements ExceptionInterface } /** - * Returns response object + * Returns response object. * * @return \Elastica\Response Response object */ @@ -62,14 +55,15 @@ class ResponseException extends \RuntimeException implements ExceptionInterface } /** - * Returns elasticsearch exception + * Returns elasticsearch exception. * * @return ElasticsearchException */ - public function getElasticsearchException() { + public function getElasticsearchException() + { $response = $this->getResponse(); $transfer = $response->getTransferInfo(); - $code = array_key_exists('http_code', $transfer) ? $transfer['http_code'] : 0; + $code = array_key_exists('http_code', $transfer) ? $transfer['http_code'] : 0; return new ElasticsearchException($code, $response->getError()); } diff --git a/vendor/ruflin/elastica/lib/Elastica/Exception/RuntimeException.php b/vendor/ruflin/elastica/lib/Elastica/Exception/RuntimeException.php index 5ee420e1..af18faff 100644 --- a/vendor/ruflin/elastica/lib/Elastica/Exception/RuntimeException.php +++ b/vendor/ruflin/elastica/lib/Elastica/Exception/RuntimeException.php @@ -1,12 +1,9 @@ <?php - namespace Elastica\Exception; /** - * Client exception + * Client exception. * - * @category Xodoa - * @package Elastica * @author Mikhail Shamin <munk13@gmail.com> */ class RuntimeException extends \RuntimeException implements ExceptionInterface |