Gestionnaire de fichiers - Editer - /home/wwgoat/public_html/blog/Exception.tar
Arrière
InvalidArgument.php 0000644 00000002122 14720667544 0010362 0 ustar 00 <?php namespace WpOrg\Requests\Exception; use InvalidArgumentException; /** * Exception for an invalid argument passed. * * @package Requests\Exceptions * @since 2.0.0 */ final class InvalidArgument extends InvalidArgumentException { /** * Create a new invalid argument exception with a standardized text. * * @param int $position The argument position in the function signature. 1-based. * @param string $name The argument name in the function signature. * @param string $expected The argument type expected as a string. * @param string $received The actual argument type received. * * @return \WpOrg\Requests\Exception\InvalidArgument */ public static function create($position, $name, $expected, $received) { // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_debug_backtrace $stack = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2); return new self( sprintf( '%s::%s(): Argument #%d (%s) must be of type %s, %s given', $stack[1]['class'], $stack[1]['function'], $position, $name, $expected, $received ) ); } } Transport.php 0000644 00000000364 14720667544 0007273 0 ustar 00 <?php /** * Transport Exception * * @package Requests\Exceptions */ namespace WpOrg\Requests\Exception; use WpOrg\Requests\Exception; /** * Transport Exception * * @package Requests\Exceptions */ class Transport extends Exception {} Transport/Curl.php 0000644 00000002565 14720667544 0010205 0 ustar 00 <?php /** * CURL Transport Exception. * * @package Requests\Exceptions */ namespace WpOrg\Requests\Exception\Transport; use WpOrg\Requests\Exception\Transport; /** * CURL Transport Exception. * * @package Requests\Exceptions */ final class Curl extends Transport { const EASY = 'cURLEasy'; const MULTI = 'cURLMulti'; const SHARE = 'cURLShare'; /** * cURL error code * * @var integer */ protected $code = -1; /** * Which type of cURL error * * EASY|MULTI|SHARE * * @var string */ protected $type = 'Unknown'; /** * Clear text error message * * @var string */ protected $reason = 'Unknown'; /** * Create a new exception. * * @param string $message Exception message. * @param string $type Exception type. * @param mixed $data Associated data, if applicable. * @param int $code Exception numerical code, if applicable. */ public function __construct($message, $type, $data = null, $code = 0) { if ($type !== null) { $this->type = $type; } if ($code !== null) { $this->code = (int) $code; } if ($message !== null) { $this->reason = $message; } $message = sprintf('%d %s', $this->code, $this->reason); parent::__construct($message, $this->type, $data, $this->code); } /** * Get the error message. * * @return string */ public function getReason() { return $this->reason; } } ArgumentCount.php 0000644 00000002664 14720667544 0010077 0 ustar 00 <?php namespace WpOrg\Requests\Exception; use WpOrg\Requests\Exception; /** * Exception for when an incorrect number of arguments are passed to a method. * * Typically, this exception is used when all arguments for a method are optional, * but certain arguments need to be passed together, i.e. a method which can be called * with no arguments or with two arguments, but not with one argument. * * Along the same lines, this exception is also used if a method expects an array * with a certain number of elements and the provided number of elements does not comply. * * @package Requests\Exceptions * @since 2.0.0 */ final class ArgumentCount extends Exception { /** * Create a new argument count exception with a standardized text. * * @param string $expected The argument count expected as a phrase. * For example: `at least 2 arguments` or `exactly 1 argument`. * @param int $received The actual argument count received. * @param string $type Exception type. * * @return \WpOrg\Requests\Exception\ArgumentCount */ public static function create($expected, $received, $type) { // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_debug_backtrace $stack = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2); return new self( sprintf( '%s::%s() expects %s, %d given', $stack[1]['class'], $stack[1]['function'], $expected, $received ), $type ); } } Http/Status501.php 0000644 00000000725 14720667544 0007730 0 ustar 00 <?php /** * Exception for 501 Not Implemented responses * * @package Requests\Exceptions */ namespace WpOrg\Requests\Exception\Http; use WpOrg\Requests\Exception\Http; /** * Exception for 501 Not Implemented responses * * @package Requests\Exceptions */ final class Status501 extends Http { /** * HTTP status code * * @var integer */ protected $code = 501; /** * Reason phrase * * @var string */ protected $reason = 'Not Implemented'; } Http/Status407.php 0000644 00000000777 14720667544 0007744 0 ustar 00 <?php /** * Exception for 407 Proxy Authentication Required responses * * @package Requests\Exceptions */ namespace WpOrg\Requests\Exception\Http; use WpOrg\Requests\Exception\Http; /** * Exception for 407 Proxy Authentication Required responses * * @package Requests\Exceptions */ final class Status407 extends Http { /** * HTTP status code * * @var integer */ protected $code = 407; /** * Reason phrase * * @var string */ protected $reason = 'Proxy Authentication Required'; } Http/Status411.php 0000644 00000000725 14720667544 0007730 0 ustar 00 <?php /** * Exception for 411 Length Required responses * * @package Requests\Exceptions */ namespace WpOrg\Requests\Exception\Http; use WpOrg\Requests\Exception\Http; /** * Exception for 411 Length Required responses * * @package Requests\Exceptions */ final class Status411 extends Http { /** * HTTP status code * * @var integer */ protected $code = 411; /** * Reason phrase * * @var string */ protected $reason = 'Length Required'; } Http/Status306.php 0000644 00000000714 14720667544 0007731 0 ustar 00 <?php /** * Exception for 306 Switch Proxy responses * * @package Requests\Exceptions */ namespace WpOrg\Requests\Exception\Http; use WpOrg\Requests\Exception\Http; /** * Exception for 306 Switch Proxy responses * * @package Requests\Exceptions */ final class Status306 extends Http { /** * HTTP status code * * @var integer */ protected $code = 306; /** * Reason phrase * * @var string */ protected $reason = 'Switch Proxy'; } Http/Status500.php 0000644 00000000747 14720667544 0007733 0 ustar 00 <?php /** * Exception for 500 Internal Server Error responses * * @package Requests\Exceptions */ namespace WpOrg\Requests\Exception\Http; use WpOrg\Requests\Exception\Http; /** * Exception for 500 Internal Server Error responses * * @package Requests\Exceptions */ final class Status500 extends Http { /** * HTTP status code * * @var integer */ protected $code = 500; /** * Reason phrase * * @var string */ protected $reason = 'Internal Server Error'; } Http/Status503.php 0000644 00000000741 14720667544 0007730 0 ustar 00 <?php /** * Exception for 503 Service Unavailable responses * * @package Requests\Exceptions */ namespace WpOrg\Requests\Exception\Http; use WpOrg\Requests\Exception\Http; /** * Exception for 503 Service Unavailable responses * * @package Requests\Exceptions */ final class Status503 extends Http { /** * HTTP status code * * @var integer */ protected $code = 503; /** * Reason phrase * * @var string */ protected $reason = 'Service Unavailable'; } Http/Status418.php 0000644 00000001054 14720667544 0007733 0 ustar 00 <?php /** * Exception for 418 I'm A Teapot responses * * @link https://tools.ietf.org/html/rfc2324 * * @package Requests\Exceptions */ namespace WpOrg\Requests\Exception\Http; use WpOrg\Requests\Exception\Http; /** * Exception for 418 I'm A Teapot responses * * @link https://tools.ietf.org/html/rfc2324 * * @package Requests\Exceptions */ final class Status418 extends Http { /** * HTTP status code * * @var integer */ protected $code = 418; /** * Reason phrase * * @var string */ protected $reason = "I'm A Teapot"; } Http/Status408.php 0000644 00000000725 14720667544 0007736 0 ustar 00 <?php /** * Exception for 408 Request Timeout responses * * @package Requests\Exceptions */ namespace WpOrg\Requests\Exception\Http; use WpOrg\Requests\Exception\Http; /** * Exception for 408 Request Timeout responses * * @package Requests\Exceptions */ final class Status408 extends Http { /** * HTTP status code * * @var integer */ protected $code = 408; /** * Reason phrase * * @var string */ protected $reason = 'Request Timeout'; } Http/Status505.php 0000644 00000000766 14720667544 0007741 0 ustar 00 <?php /** * Exception for 505 HTTP Version Not Supported responses * * @package Requests\Exceptions */ namespace WpOrg\Requests\Exception\Http; use WpOrg\Requests\Exception\Http; /** * Exception for 505 HTTP Version Not Supported responses * * @package Requests\Exceptions */ final class Status505 extends Http { /** * HTTP status code * * @var integer */ protected $code = 505; /** * Reason phrase * * @var string */ protected $reason = 'HTTP Version Not Supported'; } Http/Status429.php 0000644 00000001163 14720667544 0007736 0 ustar 00 <?php /** * Exception for 429 Too Many Requests responses * * @link https://tools.ietf.org/html/draft-nottingham-http-new-status-04 * * @package Requests\Exceptions */ namespace WpOrg\Requests\Exception\Http; use WpOrg\Requests\Exception\Http; /** * Exception for 429 Too Many Requests responses * * @link https://tools.ietf.org/html/draft-nottingham-http-new-status-04 * * @package Requests\Exceptions */ final class Status429 extends Http { /** * HTTP status code * * @var integer */ protected $code = 429; /** * Reason phrase * * @var string */ protected $reason = 'Too Many Requests'; } Http/Status402.php 0000644 00000000730 14720667544 0007724 0 ustar 00 <?php /** * Exception for 402 Payment Required responses * * @package Requests\Exceptions */ namespace WpOrg\Requests\Exception\Http; use WpOrg\Requests\Exception\Http; /** * Exception for 402 Payment Required responses * * @package Requests\Exceptions */ final class Status402 extends Http { /** * HTTP status code * * @var integer */ protected $code = 402; /** * Reason phrase * * @var string */ protected $reason = 'Payment Required'; } Http/Status413.php 0000644 00000000760 14720667544 0007731 0 ustar 00 <?php /** * Exception for 413 Request Entity Too Large responses * * @package Requests\Exceptions */ namespace WpOrg\Requests\Exception\Http; use WpOrg\Requests\Exception\Http; /** * Exception for 413 Request Entity Too Large responses * * @package Requests\Exceptions */ final class Status413 extends Http { /** * HTTP status code * * @var integer */ protected $code = 413; /** * Reason phrase * * @var string */ protected $reason = 'Request Entity Too Large'; } Http/Status405.php 0000644 00000000736 14720667544 0007735 0 ustar 00 <?php /** * Exception for 405 Method Not Allowed responses * * @package Requests\Exceptions */ namespace WpOrg\Requests\Exception\Http; use WpOrg\Requests\Exception\Http; /** * Exception for 405 Method Not Allowed responses * * @package Requests\Exceptions */ final class Status405 extends Http { /** * HTTP status code * * @var integer */ protected $code = 405; /** * Reason phrase * * @var string */ protected $reason = 'Method Not Allowed'; } Http/Status401.php 0000644 00000000714 14720667544 0007725 0 ustar 00 <?php /** * Exception for 401 Unauthorized responses * * @package Requests\Exceptions */ namespace WpOrg\Requests\Exception\Http; use WpOrg\Requests\Exception\Http; /** * Exception for 401 Unauthorized responses * * @package Requests\Exceptions */ final class Status401 extends Http { /** * HTTP status code * * @var integer */ protected $code = 401; /** * Reason phrase * * @var string */ protected $reason = 'Unauthorized'; } Http/Status406.php 0000644 00000000722 14720667544 0007731 0 ustar 00 <?php /** * Exception for 406 Not Acceptable responses * * @package Requests\Exceptions */ namespace WpOrg\Requests\Exception\Http; use WpOrg\Requests\Exception\Http; /** * Exception for 406 Not Acceptable responses * * @package Requests\Exceptions */ final class Status406 extends Http { /** * HTTP status code * * @var integer */ protected $code = 406; /** * Reason phrase * * @var string */ protected $reason = 'Not Acceptable'; } Http/StatusUnknown.php 0000644 00000001712 14720667544 0011057 0 ustar 00 <?php /** * Exception for unknown status responses * * @package Requests\Exceptions */ namespace WpOrg\Requests\Exception\Http; use WpOrg\Requests\Exception\Http; use WpOrg\Requests\Response; /** * Exception for unknown status responses * * @package Requests\Exceptions */ final class StatusUnknown extends Http { /** * HTTP status code * * @var integer|bool Code if available, false if an error occurred */ protected $code = 0; /** * Reason phrase * * @var string */ protected $reason = 'Unknown'; /** * Create a new exception * * If `$data` is an instance of {@see \WpOrg\Requests\Response}, uses the status * code from it. Otherwise, sets as 0 * * @param string|null $reason Reason phrase * @param mixed $data Associated data */ public function __construct($reason = null, $data = null) { if ($data instanceof Response) { $this->code = (int) $data->status_code; } parent::__construct($reason, $data); } } Http/Status404.php 0000644 00000000703 14720667544 0007726 0 ustar 00 <?php /** * Exception for 404 Not Found responses * * @package Requests\Exceptions */ namespace WpOrg\Requests\Exception\Http; use WpOrg\Requests\Exception\Http; /** * Exception for 404 Not Found responses * * @package Requests\Exceptions */ final class Status404 extends Http { /** * HTTP status code * * @var integer */ protected $code = 404; /** * Reason phrase * * @var string */ protected $reason = 'Not Found'; } Http/Status409.php 0000644 00000000700 14720667544 0007730 0 ustar 00 <?php /** * Exception for 409 Conflict responses * * @package Requests\Exceptions */ namespace WpOrg\Requests\Exception\Http; use WpOrg\Requests\Exception\Http; /** * Exception for 409 Conflict responses * * @package Requests\Exceptions */ final class Status409 extends Http { /** * HTTP status code * * @var integer */ protected $code = 409; /** * Reason phrase * * @var string */ protected $reason = 'Conflict'; } Http/Status417.php 0000644 00000000736 14720667544 0007740 0 ustar 00 <?php /** * Exception for 417 Expectation Failed responses * * @package Requests\Exceptions */ namespace WpOrg\Requests\Exception\Http; use WpOrg\Requests\Exception\Http; /** * Exception for 417 Expectation Failed responses * * @package Requests\Exceptions */ final class Status417 extends Http { /** * HTTP status code * * @var integer */ protected $code = 417; /** * Reason phrase * * @var string */ protected $reason = 'Expectation Failed'; } Http/Status502.php 0000644 00000000711 14720667544 0007724 0 ustar 00 <?php /** * Exception for 502 Bad Gateway responses * * @package Requests\Exceptions */ namespace WpOrg\Requests\Exception\Http; use WpOrg\Requests\Exception\Http; /** * Exception for 502 Bad Gateway responses * * @package Requests\Exceptions */ final class Status502 extends Http { /** * HTTP status code * * @var integer */ protected $code = 502; /** * Reason phrase * * @var string */ protected $reason = 'Bad Gateway'; } Http/Status416.php 0000644 00000001005 14720667544 0007725 0 ustar 00 <?php /** * Exception for 416 Requested Range Not Satisfiable responses * * @package Requests\Exceptions */ namespace WpOrg\Requests\Exception\Http; use WpOrg\Requests\Exception\Http; /** * Exception for 416 Requested Range Not Satisfiable responses * * @package Requests\Exceptions */ final class Status416 extends Http { /** * HTTP status code * * @var integer */ protected $code = 416; /** * Reason phrase * * @var string */ protected $reason = 'Requested Range Not Satisfiable'; } Http/Status410.php 0000644 00000000664 14720667544 0007731 0 ustar 00 <?php /** * Exception for 410 Gone responses * * @package Requests\Exceptions */ namespace WpOrg\Requests\Exception\Http; use WpOrg\Requests\Exception\Http; /** * Exception for 410 Gone responses * * @package Requests\Exceptions */ final class Status410 extends Http { /** * HTTP status code * * @var integer */ protected $code = 410; /** * Reason phrase * * @var string */ protected $reason = 'Gone'; } Http/Status305.php 0000644 00000000703 14720667544 0007726 0 ustar 00 <?php /** * Exception for 305 Use Proxy responses * * @package Requests\Exceptions */ namespace WpOrg\Requests\Exception\Http; use WpOrg\Requests\Exception\Http; /** * Exception for 305 Use Proxy responses * * @package Requests\Exceptions */ final class Status305 extends Http { /** * HTTP status code * * @var integer */ protected $code = 305; /** * Reason phrase * * @var string */ protected $reason = 'Use Proxy'; } Http/Status412.php 0000644 00000000741 14720667544 0007727 0 ustar 00 <?php /** * Exception for 412 Precondition Failed responses * * @package Requests\Exceptions */ namespace WpOrg\Requests\Exception\Http; use WpOrg\Requests\Exception\Http; /** * Exception for 412 Precondition Failed responses * * @package Requests\Exceptions */ final class Status412 extends Http { /** * HTTP status code * * @var integer */ protected $code = 412; /** * Reason phrase * * @var string */ protected $reason = 'Precondition Failed'; } Http/Status304.php 0000644 00000000714 14720667544 0007727 0 ustar 00 <?php /** * Exception for 304 Not Modified responses * * @package Requests\Exceptions */ namespace WpOrg\Requests\Exception\Http; use WpOrg\Requests\Exception\Http; /** * Exception for 304 Not Modified responses * * @package Requests\Exceptions */ final class Status304 extends Http { /** * HTTP status code * * @var integer */ protected $code = 304; /** * Reason phrase * * @var string */ protected $reason = 'Not Modified'; } Http/Status414.php 0000644 00000000747 14720667544 0007737 0 ustar 00 <?php /** * Exception for 414 Request-URI Too Large responses * * @package Requests\Exceptions */ namespace WpOrg\Requests\Exception\Http; use WpOrg\Requests\Exception\Http; /** * Exception for 414 Request-URI Too Large responses * * @package Requests\Exceptions */ final class Status414 extends Http { /** * HTTP status code * * @var integer */ protected $code = 414; /** * Reason phrase * * @var string */ protected $reason = 'Request-URI Too Large'; } Http/Status400.php 0000644 00000000711 14720667544 0007721 0 ustar 00 <?php /** * Exception for 400 Bad Request responses * * @package Requests\Exceptions */ namespace WpOrg\Requests\Exception\Http; use WpOrg\Requests\Exception\Http; /** * Exception for 400 Bad Request responses * * @package Requests\Exceptions */ final class Status400 extends Http { /** * HTTP status code * * @var integer */ protected $code = 400; /** * Reason phrase * * @var string */ protected $reason = 'Bad Request'; } Http/Status511.php 0000644 00000001145 14720667544 0007726 0 ustar 00 <?php /** * Exception for 511 Network Authentication Required responses * * @link https://tools.ietf.org/html/rfc6585 * * @package Requests\Exceptions */ namespace WpOrg\Requests\Exception\Http; use WpOrg\Requests\Exception\Http; /** * Exception for 511 Network Authentication Required responses * * @link https://tools.ietf.org/html/rfc6585 * * @package Requests\Exceptions */ final class Status511 extends Http { /** * HTTP status code * * @var integer */ protected $code = 511; /** * Reason phrase * * @var string */ protected $reason = 'Network Authentication Required'; } Http/Status428.php 0000644 00000001107 14720667544 0007733 0 ustar 00 <?php /** * Exception for 428 Precondition Required responses * * @link https://tools.ietf.org/html/rfc6585 * * @package Requests\Exceptions */ namespace WpOrg\Requests\Exception\Http; use WpOrg\Requests\Exception\Http; /** * Exception for 428 Precondition Required responses * * @link https://tools.ietf.org/html/rfc6585 * * @package Requests\Exceptions */ final class Status428 extends Http { /** * HTTP status code * * @var integer */ protected $code = 428; /** * Reason phrase * * @var string */ protected $reason = 'Precondition Required'; } Http/Status403.php 0000644 00000000703 14720667544 0007725 0 ustar 00 <?php /** * Exception for 403 Forbidden responses * * @package Requests\Exceptions */ namespace WpOrg\Requests\Exception\Http; use WpOrg\Requests\Exception\Http; /** * Exception for 403 Forbidden responses * * @package Requests\Exceptions */ final class Status403 extends Http { /** * HTTP status code * * @var integer */ protected $code = 403; /** * Reason phrase * * @var string */ protected $reason = 'Forbidden'; } Http/Status504.php 0000644 00000000725 14720667544 0007733 0 ustar 00 <?php /** * Exception for 504 Gateway Timeout responses * * @package Requests\Exceptions */ namespace WpOrg\Requests\Exception\Http; use WpOrg\Requests\Exception\Http; /** * Exception for 504 Gateway Timeout responses * * @package Requests\Exceptions */ final class Status504 extends Http { /** * HTTP status code * * @var integer */ protected $code = 504; /** * Reason phrase * * @var string */ protected $reason = 'Gateway Timeout'; } Http/Status431.php 0000644 00000001145 14720667544 0007727 0 ustar 00 <?php /** * Exception for 431 Request Header Fields Too Large responses * * @link https://tools.ietf.org/html/rfc6585 * * @package Requests\Exceptions */ namespace WpOrg\Requests\Exception\Http; use WpOrg\Requests\Exception\Http; /** * Exception for 431 Request Header Fields Too Large responses * * @link https://tools.ietf.org/html/rfc6585 * * @package Requests\Exceptions */ final class Status431 extends Http { /** * HTTP status code * * @var integer */ protected $code = 431; /** * Reason phrase * * @var string */ protected $reason = 'Request Header Fields Too Large'; } Http/Status415.php 0000644 00000000752 14720667544 0007734 0 ustar 00 <?php /** * Exception for 415 Unsupported Media Type responses * * @package Requests\Exceptions */ namespace WpOrg\Requests\Exception\Http; use WpOrg\Requests\Exception\Http; /** * Exception for 415 Unsupported Media Type responses * * @package Requests\Exceptions */ final class Status415 extends Http { /** * HTTP status code * * @var integer */ protected $code = 415; /** * Reason phrase * * @var string */ protected $reason = 'Unsupported Media Type'; } Http.php 0000644 00000003006 14720667544 0006212 0 ustar 00 <?php /** * Exception based on HTTP response * * @package Requests\Exceptions */ namespace WpOrg\Requests\Exception; use WpOrg\Requests\Exception; use WpOrg\Requests\Exception\Http\StatusUnknown; /** * Exception based on HTTP response * * @package Requests\Exceptions */ class Http extends Exception { /** * HTTP status code * * @var integer */ protected $code = 0; /** * Reason phrase * * @var string */ protected $reason = 'Unknown'; /** * Create a new exception * * There is no mechanism to pass in the status code, as this is set by the * subclass used. Reason phrases can vary, however. * * @param string|null $reason Reason phrase * @param mixed $data Associated data */ public function __construct($reason = null, $data = null) { if ($reason !== null) { $this->reason = $reason; } $message = sprintf('%d %s', $this->code, $this->reason); parent::__construct($message, 'httpresponse', $data, $this->code); } /** * Get the status message. * * @return string */ public function getReason() { return $this->reason; } /** * Get the correct exception class for a given error code * * @param int|bool $code HTTP status code, or false if unavailable * @return string Exception class name to use */ public static function get_class($code) { if (!$code) { return StatusUnknown::class; } $class = sprintf('\WpOrg\Requests\Exception\Http\Status%d', $code); if (class_exists($class)) { return $class; } return StatusUnknown::class; } }
| ver. 1.4 |
Github
|
.
| PHP 8.0.30 | Génération de la page: 0 |
proxy
|
phpinfo
|
Réglages