Completed
Push — master ( 4f4939...8e0ded )
by Romain
14s
created

NlpRequest::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Kerox\Messenger\Request;
6
7
use Kerox\Messenger\Helper\UtilityTrait;
8
9
class NlpRequest extends AbstractRequest
10
{
11
    use UtilityTrait;
12
13
    /**
14
     * @var array
15
     */
16
    protected $configs;
17
18
    /**
19
     * CodeRequest constructor.
20
     *
21
     * @param string $pageToken
22
     * @param array  $configs
23
     */
24
    public function __construct(string $pageToken, array $configs)
25
    {
26
        parent::__construct($pageToken);
27
28
        $this->configs = $configs;
29
    }
30
31
    protected function buildHeaders(): void
32
    {
33
    }
34
35
    protected function buildBody(): void
36
    {
37
    }
38
39
    /**
40
     * @return array
41
     */
42
    protected function buildQuery(): array
43
    {
44
        $query = parent::buildQuery();
45
        $query += [
46
            'nlp_enabled'  => $this->configs['nlp_enabled'] ?? null,
47
            'model'        => $this->configs['model'] ?? null,
48
            'custom_token' => $this->configs['custom_token'] ?? null,
49
            'verbose'      => $this->configs['verbose'] ?? null,
50
            'n_best'       => $this->configs['n_best'] ?? null,
51
        ];
52
53
        return $this->arrayFilter($query);
54
    }
55
}
56