Total Complexity | 6 |
Total Lines | 45 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php declare(strict_types=1); |
||
7 | class BlueGreenDeploymentService |
||
8 | { |
||
9 | public const ENV_NAME = 'BLUE_GREEN_DEPLOYMENT'; |
||
10 | |||
11 | /** |
||
12 | * @var Connection |
||
13 | */ |
||
14 | private $connection; |
||
15 | |||
16 | public function __construct(Connection $connection) |
||
17 | { |
||
18 | $this->connection = $connection; |
||
19 | } |
||
20 | |||
21 | public function setEnvironmentVariable(): void |
||
22 | { |
||
23 | $_ENV[self::ENV_NAME] = $_SESSION[self::ENV_NAME] = $this->checkIfMayCreateTrigger(); |
||
24 | } |
||
25 | |||
26 | private function checkIfMayCreateTrigger(): bool |
||
38 | } |
||
39 | |||
40 | private function getCreateTableQuery(): string |
||
41 | { |
||
42 | return <<<SQL |
||
43 | CREATE TABLE IF NOT EXISTS `example` ( |
||
44 | `id` int NOT NULL |
||
45 | ); |
||
46 | SQL; |
||
47 | } |
||
48 | |||
49 | private function getTriggerQuery(): string |
||
52 | CREATE TRIGGER example_trigger BEFORE UPDATE ON `example` |
||
53 | FOR EACH ROW |
||
54 | BEGIN |
||
59 |