|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace sergeymakinen\facades; |
|
4
|
|
|
|
|
5
|
|
|
/** @noinspection PhpUnnecessaryFullyQualifiedNameInspection */ |
|
6
|
|
|
/** |
|
7
|
|
|
* Http facade. |
|
8
|
|
|
* |
|
9
|
|
|
* Facades Yii::$app->get('httpClient') component. |
|
10
|
|
|
* |
|
11
|
|
|
* @method static afterSend(\yii\httpclient\Request $request, \yii\httpclient\Response $response) This method is invoked right after request is sent. |
|
12
|
|
|
* @method static \yii\base\Behavior attachBehavior(string $name, string|array|\yii\base\Behavior $behavior) Attaches a behavior to this component. |
|
13
|
|
|
* @method static attachBehaviors(array $behaviors) Attaches a list of behaviors to the component. |
|
14
|
|
|
* @method static \yii\httpclient\Response[] batchSend(\yii\httpclient\Request[] $requests) Performs multiple HTTP requests in parallel. |
|
15
|
|
|
* @method static beforeSend(\yii\httpclient\Request $request) This method is invoked right before request is sent. |
|
16
|
|
|
* @method static array behaviors() Returns a list of behaviors that this component should behave as. |
|
17
|
|
|
* @method static \yii\httpclient\Request createRequest() |
|
18
|
|
|
* @method static string createRequestLogToken(string $method, string $url, array $headers, string $content) Composes the log/profiling message token for the given HTTP request parameters. |
|
19
|
|
|
* @method static \yii\httpclient\Response createResponse(string $content = null, array $headers = []) Creates a response instance. |
|
20
|
|
|
* @method static \yii\httpclient\Request delete(string $url, array|string $data = null, array $headers = [], array $options = []) Creates 'DELETE' request. |
|
21
|
|
|
* @method static null|\yii\base\Behavior detachBehavior(string $name) Detaches a behavior from the component. |
|
22
|
|
|
* @method static detachBehaviors() Detaches all behaviors from the component. |
|
23
|
|
|
* @method static ensureBehaviors() Makes sure that the behaviors declared in [[behaviors()]] are attached to this component. |
|
24
|
|
|
* @method static \yii\httpclient\Request get(string $url, array|string $data = null, array $headers = [], array $options = []) Creates 'GET' request. |
|
25
|
|
|
* @method static null|\yii\base\Behavior getBehavior(string $name) Returns the named behavior object. |
|
26
|
|
|
* @method static \yii\base\Behavior[] getBehaviors() Returns all behaviors attached to this component. |
|
27
|
|
|
* @method static \yii\httpclient\FormatterInterface getFormatter(string $format) Returns HTTP message formatter instance for the specified format. |
|
28
|
|
|
* @method static \yii\httpclient\ParserInterface getParser(string $format) Returns HTTP message parser instance for the specified format. |
|
29
|
|
|
* @method static \yii\httpclient\Transport getTransport() |
|
30
|
|
|
* @method static string getBaseUrl() Returns $baseUrl - base request URL. |
|
31
|
|
|
* @method static int getContentLoggingMaxSize() Returns $contentLoggingMaxSize - maximum symbols count of the request content, which should be taken to compose a log and profile messages. |
|
32
|
|
|
* @method static array getFormatters() Returns $formatters - the formatters for converting data into the content of the specified [[format]]. |
|
33
|
|
|
* @method static array getParsers() Returns $parsers - the parsers for converting content of the specified [[format]] into the data. |
|
34
|
|
|
* @method static array getRequestConfig() Returns $requestConfig - request object configuration. |
|
35
|
|
|
* @method static array getResponseConfig() Returns $responseConfig - response config configuration. |
|
36
|
|
|
* @method static bool hasEventHandlers(string $name) Returns a value indicating whether there is any handler attached to the named event. |
|
37
|
|
|
* @method static \yii\httpclient\Request head(string $url, array $headers = [], array $options = []) Creates 'HEAD' request. |
|
38
|
|
|
* @method static bool off(string $name, callable $handler = null) Detaches an existing event handler from this component. |
|
39
|
|
|
* @method static on(string $name, callable $handler, mixed $data = null, bool $append = true) Attaches an event handler to an event. |
|
40
|
|
|
* @method static \yii\httpclient\Request options(string $url, array $options = []) Creates 'OPTIONS' request. |
|
41
|
|
|
* @method static \yii\httpclient\Request patch(string $url, array|string $data = null, array $headers = [], array $options = []) Creates 'PATCH' request. |
|
42
|
|
|
* @method static \yii\httpclient\Request post(string $url, array|string $data = null, array $headers = [], array $options = []) Creates 'POST' request. |
|
43
|
|
|
* @method static \yii\httpclient\Request put(string $url, array|string $data = null, array $headers = [], array $options = []) Creates 'PUT' request. |
|
44
|
|
|
* @method static \yii\httpclient\Response send(\yii\httpclient\Request $request) Performs given request. |
|
45
|
|
|
* @method static setTransport(\yii\httpclient\Transport|array|string $transport) Sets the HTTP message transport. |
|
46
|
|
|
* @method static setBaseUrl(string $value) Sets $baseUrl - base request URL. |
|
47
|
|
|
* @method static setContentLoggingMaxSize(int $value) Sets $contentLoggingMaxSize - maximum symbols count of the request content, which should be taken to compose a log and profile messages. |
|
48
|
|
|
* @method static setFormatters(array $value) Sets $formatters - the formatters for converting data into the content of the specified [[format]]. |
|
49
|
|
|
* @method static setParsers(array $value) Sets $parsers - the parsers for converting content of the specified [[format]] into the data. |
|
50
|
|
|
* @method static setRequestConfig(array $value) Sets $requestConfig - request object configuration. |
|
51
|
|
|
* @method static setResponseConfig(array $value) Sets $responseConfig - response config configuration. |
|
52
|
|
|
* @method static trigger(string $name, \yii\base\Event $event = null) Triggers an event. |
|
53
|
|
|
*/ |
|
54
|
|
|
class Http extends Facade |
|
55
|
|
|
{ |
|
56
|
|
|
/** |
|
57
|
|
|
* @inheritdoc |
|
58
|
|
|
*/ |
|
59
|
|
|
public static function getFacadeComponentId() |
|
60
|
|
|
{ |
|
61
|
|
|
return 'httpClient'; |
|
62
|
|
|
} |
|
63
|
|
|
} |
|
64
|
|
|
|