1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Oliverde8\Component\PhpEtl\Builder\Factories\Transformer; |
4
|
|
|
|
5
|
|
|
use Oliverde8\Component\PhpEtl\Builder\Factories\AbstractFactory; |
6
|
|
|
use Oliverde8\Component\PhpEtl\ChainOperation\ChainOperationInterface; |
7
|
|
|
use Oliverde8\Component\PhpEtl\ChainOperation\Transformer\SimpleHttpOperation; |
8
|
|
|
use Symfony\Component\HttpClient\HttpClient; |
|
|
|
|
9
|
|
|
use Symfony\Component\Validator\Constraint; |
10
|
|
|
use Symfony\Component\Validator\Constraints as Assert; |
11
|
|
|
use Symfony\Contracts\HttpClient\HttpClientInterface; |
|
|
|
|
12
|
|
|
|
13
|
|
|
class SimpleHttpOperationWithClientFactory extends AbstractFactory |
14
|
|
|
{ |
15
|
|
|
private HttpClientInterface $httpClient; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* @param HttpClientInterface $httpClient |
19
|
|
|
*/ |
20
|
|
|
public function __construct(string $operation, HttpClientInterface $httpClient) |
21
|
|
|
{ |
22
|
|
|
$this->httpClient = $httpClient; |
23
|
|
|
|
24
|
|
|
parent::__construct($operation, SimpleHttpOperation::class); |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
protected function build(string $operation, array $options): ChainOperationInterface |
28
|
|
|
{ |
29
|
|
|
return new SimpleHttpOperation( |
30
|
|
|
$this->httpClient, |
31
|
|
|
$options['method'], |
32
|
|
|
$options['url'], |
33
|
|
|
$options['response_is_json'] ?? false, |
34
|
|
|
$options['option_key'] ?? null, |
35
|
|
|
$options['response_key'] ?? null, |
36
|
|
|
); |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
protected function configureValidator(): Constraint |
40
|
|
|
{ |
41
|
|
|
return new Assert\Collection([ |
42
|
|
|
'method' => [ |
43
|
|
|
new Assert\Choice(['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'HEAD']), |
44
|
|
|
new Assert\NotBlank(), |
45
|
|
|
], |
46
|
|
|
'url' => [ |
47
|
|
|
new Assert\Type(["type" => "string"]), |
48
|
|
|
new Assert\NotBlank(), |
49
|
|
|
], |
50
|
|
|
'response_is_json' => [ |
51
|
|
|
new Assert\Type(["type" => "boolean"]), |
52
|
|
|
], |
53
|
|
|
'option_key' => [ |
54
|
|
|
new Assert\Type(["type" => "string"]), |
55
|
|
|
], |
56
|
|
|
'response_key' => [ |
57
|
|
|
new Assert\Type(["type" => "string"]), |
58
|
|
|
], |
59
|
|
|
'options' => [ |
60
|
|
|
new Assert\Type(["type" => "array"]), |
61
|
|
|
], |
62
|
|
|
]); |
63
|
|
|
} |
64
|
|
|
} |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths