HttpClient::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 7
rs 10
1
<?php
2
3
namespace Fecony\YandexSpeller\Http;
4
5
use GuzzleHttp\Client;
6
7
class HttpClient
8
{
9
    /** @var string API JSON interface */
10
    protected const API_URL = 'https://speller.yandex.net/services/spellservice.json/';
11
12
    /** @var string API endpoint to check single string */
13
    protected const CHECK_TEXT_ENDPOINT = 'checkText';
14
15
    /** @var string API endpoint to check array of strings */
16
    protected const CHECK_TEXTS_ENDPOINT = 'checkTexts';
17
18
    /** @var Client Guzzle http client */
19
    protected $client;
20
21
    public function __construct()
22
    {
23
        $this->client = new Client([
24
            'base_uri' => self::API_URL,
25
            'headers' => [
26
                'Content-Type' => 'application/json',
27
                'Accept' => 'application/json',
28
            ],
29
        ]);
30
    }
31
}
32