Total Complexity | 5 |
Total Lines | 48 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
12 | class CustomSql |
||
13 | { |
||
14 | /** |
||
15 | * @var mixed|null |
||
16 | */ |
||
17 | private $entity = []; |
||
18 | private $isEnabled; |
||
19 | |||
20 | /** |
||
21 | * CustomSql constructor. |
||
22 | * @param string $entity |
||
23 | */ |
||
24 | public function __construct(string $entity) |
||
25 | { |
||
26 | $this->entity = ConfigHelper::getNestedParam(ConfigInterface::CUSTOM_SQL, MigrationsHelper::getTableName($entity)); |
||
27 | if (empty($this->entity[ConfigInterface::ENABLED]) === false) { |
||
28 | $this->isEnabled = $this->entity[ConfigInterface::ENABLED]; |
||
29 | } |
||
30 | } |
||
31 | |||
32 | /** |
||
33 | * Whether custom sql is enabled or not on this entity |
||
34 | * |
||
35 | * @return mixed |
||
36 | */ |
||
37 | public function isEnabled() |
||
38 | { |
||
39 | return $this->isEnabled; |
||
40 | } |
||
41 | |||
42 | /** |
||
43 | * Gets the exact query from config for this entity |
||
44 | * |
||
45 | * @return mixed |
||
46 | */ |
||
47 | public function getQuery() |
||
50 | } |
||
51 | |||
52 | /** |
||
53 | * Gets bindings for query |
||
54 | * |
||
55 | * @return mixed |
||
56 | */ |
||
57 | public function getBindings() |
||
60 | } |
||
61 | } |