ipagdevs /
ipag-sdk-php
| 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\SchemaBoolAttribute; |
||
| 8 | use Ipag\Sdk\Model\Schema\SchemaDateAttribute; |
||
| 9 | use Ipag\Sdk\Model\Schema\SchemaIntegerAttribute; |
||
| 10 | use Ipag\Sdk\Model\Schema\SchemaRelationAttribute; |
||
| 11 | use Ipag\Sdk\Model\Schema\SchemaStringAttribute; |
||
| 12 | |||
| 13 | /** |
||
| 14 | * @codeCoverageIgnore |
||
| 15 | */ |
||
| 16 | final class Schema |
||
| 17 | { |
||
| 18 | protected array $props; |
||
| 19 | protected ?string $name; |
||
| 20 | |||
| 21 | public function __construct(?string $name = null) |
||
| 22 | { |
||
| 23 | $this->props = []; |
||
| 24 | $this->name = $name; |
||
| 25 | } |
||
| 26 | |||
| 27 | public function any(string $attribute): SchemaAttribute |
||
| 28 | { |
||
| 29 | return $this->set(SchemaAttribute::from($this, $attribute)); |
||
| 30 | } |
||
| 31 | |||
| 32 | public function int(string $attribute): SchemaIntegerAttribute |
||
| 33 | { |
||
| 34 | return $this->set(SchemaIntegerAttribute::from($this, $attribute)); |
||
| 35 | } |
||
| 36 | |||
| 37 | public function string(string $attribute): SchemaStringAttribute |
||
| 38 | { |
||
| 39 | return $this->set(SchemaStringAttribute::from($this, $attribute)); |
||
| 40 | } |
||
| 41 | |||
| 42 | public function date(string $attribute, string $format = DateTimeInterface::RFC3339): SchemaDateAttribute |
||
| 43 | { |
||
| 44 | return $this->set(SchemaDateAttribute::from($this, $attribute)->format($format)); |
||
| 45 | } |
||
| 46 | |||
| 47 | public function bool(string $attribute): SchemaBoolAttribute |
||
| 48 | { |
||
| 49 | return $this->set(SchemaBoolAttribute::from($this, $attribute)); |
||
| 50 | } |
||
| 51 | |||
| 52 | public function enum(string $attribute, array $values): SchemaEnumAttribute |
||
| 53 | { |
||
| 54 | return $this->set(SchemaEnumAttribute::from($this, $attribute)->values($values)); |
||
| 55 | } |
||
| 56 | |||
| 57 | public function float(string $attribute): SchemaFloatAttribute |
||
| 58 | { |
||
| 59 | return $this->set(SchemaFloatAttribute::from($this, $attribute)); |
||
| 60 | } |
||
| 61 | |||
| 62 | public function has(string $attribute, string $class = Model::class): SchemaRelationAttribute |
||
|
0 ignored issues
–
show
|
|||
| 63 | { |
||
| 64 | return $this->set(SchemaRelationAttribute::from($this, $attribute, $class)); |
||
| 65 | } |
||
| 66 | |||
| 67 | public function hasMany(string $attribute, string $class = Model::class): SchemaRelationAttribute |
||
| 68 | { |
||
| 69 | return $this->set(SchemaRelationAttribute::from($this, $attribute, $class)->many()); |
||
| 70 | } |
||
| 71 | |||
| 72 | public function array(string $attribute, ?SchemaAttribute $schema = null): SchemaArrayAttribute |
||
| 73 | { |
||
| 74 | return $this->set(SchemaArrayAttribute::from($this, $attribute, $schema)); |
||
| 75 | } |
||
| 76 | |||
| 77 | // |
||
| 78 | |||
| 79 | public function builder(): SchemaBuilder |
||
| 80 | { |
||
| 81 | if (!empty($this->props)) { |
||
| 82 | $this->props = []; |
||
| 83 | } |
||
| 84 | |||
| 85 | return SchemaBuilder::from($this); |
||
| 86 | } |
||
| 87 | |||
| 88 | public function query(string $attribute): ?SchemaAttribute |
||
| 89 | { |
||
| 90 | return $this->props[$attribute] ?? null; |
||
| 91 | } |
||
| 92 | |||
| 93 | public function getAttributes(): iterable |
||
| 94 | { |
||
| 95 | return $this->props; |
||
| 96 | } |
||
| 97 | |||
| 98 | public function getName(): string |
||
| 99 | { |
||
| 100 | return $this->name; |
||
|
0 ignored issues
–
show
|
|||
| 101 | } |
||
| 102 | |||
| 103 | public function setName(string $name): void |
||
| 104 | { |
||
| 105 | $this->name = $name; |
||
| 106 | } |
||
| 107 | |||
| 108 | // |
||
| 109 | |||
| 110 | protected function set(SchemaAttribute $schemaAttribute): SchemaAttribute |
||
| 111 | { |
||
| 112 | $this->props[$schemaAttribute->getName()] = $schemaAttribute; |
||
| 113 | return $schemaAttribute; |
||
| 114 | } |
||
| 115 | |||
| 116 | protected function unset(SchemaAttribute $schemaAttribute): SchemaAttribute |
||
| 117 | { |
||
| 118 | unset($this->props[$schemaAttribute->getName()]); |
||
| 119 | return $schemaAttribute; |
||
| 120 | } |
||
| 121 | } |
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