|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Ipag\Sdk\Model\Schema; |
|
4
|
|
|
|
|
5
|
|
|
use DateTimeInterface; |
|
6
|
|
|
use Ipag\Sdk\Model\Schema\SchemaAttribute; |
|
7
|
|
|
use Ipag\Sdk\Model\Schema\SchemaDateAttribute; |
|
8
|
|
|
use Ipag\Sdk\Model\Schema\SchemaIntegerAttribute; |
|
9
|
|
|
use Ipag\Sdk\Model\Schema\SchemaRelationAttribute; |
|
10
|
|
|
use Ipag\Sdk\Model\Schema\SchemaStringAttribute; |
|
11
|
|
|
|
|
12
|
|
|
/** |
|
13
|
|
|
* @codeCoverageIgnore |
|
14
|
|
|
*/ |
|
15
|
|
|
final class SchemaBuilder |
|
16
|
|
|
{ |
|
17
|
|
|
protected Schema $target; |
|
18
|
|
|
|
|
19
|
|
|
public function __construct(Schema $target) |
|
20
|
|
|
{ |
|
21
|
|
|
$this->target = $target; |
|
22
|
|
|
} |
|
23
|
|
|
|
|
24
|
|
|
public function any(string $attribute): SchemaAttribute |
|
25
|
|
|
{ |
|
26
|
|
|
return $this->target->any($attribute); |
|
27
|
|
|
} |
|
28
|
|
|
|
|
29
|
|
|
public function int(string $attribute): SchemaIntegerAttribute |
|
30
|
|
|
{ |
|
31
|
|
|
return $this->target->int($attribute); |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
public function string(string $attribute): SchemaStringAttribute |
|
35
|
|
|
{ |
|
36
|
|
|
return $this->target->string($attribute); |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
public function date(string $attribute, string $format = DateTimeInterface::RFC3339): SchemaDateAttribute |
|
40
|
|
|
{ |
|
41
|
|
|
return $this->target->date($attribute)->format($format); |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
public function bool(string $attribute): SchemaBoolAttribute |
|
45
|
|
|
{ |
|
46
|
|
|
return $this->target->bool($attribute); |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
public function enum(string $attribute, array $values): SchemaEnumAttribute |
|
50
|
|
|
{ |
|
51
|
|
|
return $this->target->enum($attribute, $values); |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
public function float(string $attribute): SchemaFloatAttribute |
|
55
|
|
|
{ |
|
56
|
|
|
return $this->target->float($attribute); |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
public function has(string $attribute, string $class = Model::class): SchemaRelationAttribute |
|
|
|
|
|
|
60
|
|
|
{ |
|
61
|
|
|
return $this->target->has($attribute, $class); |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
public function hasMany(string $attribute, string $class = Model::class): SchemaRelationAttribute |
|
65
|
|
|
{ |
|
66
|
|
|
return $this->target->hasMany($attribute, $class)->many(); |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
// |
|
70
|
|
|
|
|
71
|
|
|
public function build(): Schema |
|
72
|
|
|
{ |
|
73
|
|
|
return $this->target; |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
|
|
// |
|
77
|
|
|
|
|
78
|
|
|
public static function from(Schema $target): self |
|
79
|
|
|
{ |
|
80
|
|
|
return new self($target); |
|
81
|
|
|
} |
|
82
|
|
|
} |
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