| Total Complexity | 5 |
| Total Lines | 55 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | class UpdateQueryBuilder |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * @var ClientRegistry |
||
| 15 | */ |
||
| 16 | private $clientRegistry; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @var Config |
||
| 20 | */ |
||
| 21 | private $config; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @param Config $config |
||
| 25 | * @param ClientRegistry $clientRegistry |
||
| 26 | */ |
||
| 27 | public function __construct(Config $config, ClientRegistry $clientRegistry) |
||
| 28 | { |
||
| 29 | $this->config = $config; |
||
| 30 | $this->clientRegistry = $clientRegistry; |
||
| 31 | } |
||
| 32 | |||
| 33 | /** |
||
| 34 | * @param string $schemaName |
||
| 35 | * @return UpdateQuery |
||
| 36 | * @throws \InvalidArgumentException |
||
| 37 | * @throws SchemaNotFoundException |
||
| 38 | */ |
||
| 39 | public function buildUpdateQueryBySchemaName($schemaName) |
||
| 40 | { |
||
| 41 | if (!is_string($schemaName)) { |
||
|
|
|||
| 42 | throw new \InvalidArgumentException('Argument $schemaName must be a string'); |
||
| 43 | } |
||
| 44 | |||
| 45 | $schema = $this->config->getSchemaByName($schemaName); |
||
| 46 | if (!$schema) { |
||
| 47 | throw new SchemaNotFoundException( |
||
| 48 | sprintf('Schema "%s" is not found', $schemaName) |
||
| 49 | ); |
||
| 50 | } |
||
| 51 | |||
| 52 | return $this->buildUpdateQuery($schema); |
||
| 53 | } |
||
| 54 | |||
| 55 | /** |
||
| 56 | * @param Schema $schema |
||
| 57 | * @return UpdateQuery |
||
| 58 | */ |
||
| 59 | public function buildUpdateQuery(Schema $schema) |
||
| 66 | ); |
||
| 67 | } |
||
| 68 | } |