Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| SchemaBuilder | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * @license MIT |
| 5 | * @author hazuki3417<hazuki3417@gmail.com> |
| 6 | * @copyright 2022 hazuki3417 all rights reserved. |
| 7 | */ |
| 8 | |
| 9 | namespace Selen\MongoDB; |
| 10 | |
| 11 | use ReflectionClass; |
| 12 | use Selen\MongoDB\Attribute\SchemaLoader; |
| 13 | use Selen\MongoDB\Builder\InsertSchema; |
| 14 | use Selen\MongoDB\Builder\UpdateSchema; |
| 15 | |
| 16 | class SchemaBuilder |
| 17 | { |
| 18 | /** @var string */ |
| 19 | public $schemaClassName; |
| 20 | /** @var InsertSchema */ |
| 21 | public $insert; |
| 22 | /** @var UpdateSchema */ |
| 23 | public $update; |
| 24 | |
| 25 | public function __construct(string $schemaClassName) |
| 26 | { |
| 27 | $this->schemaClassName = $schemaClassName; |
| 28 | $schemaLoader = new SchemaLoader(new ReflectionClass($schemaClassName)); |
| 29 | $this->insert = new InsertSchema($schemaLoader); |
| 30 | $this->update = new UpdateSchema($schemaLoader); |
| 31 | } |
| 32 | } |