@@ -48,8 +48,8 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | public function setAttributeJoined(string $name): void |
| 50 | 50 | { |
| 51 | - if(!$this->isAttribute($name)) return; |
|
| 52 | - if(!$this->isAttributeJoined($name)) |
|
| 51 | + if (!$this->isAttribute($name)) return; |
|
| 52 | + if (!$this->isAttributeJoined($name)) |
|
| 53 | 53 | { |
| 54 | 54 | $this->joins[] = $name; |
| 55 | 55 | } |
@@ -62,8 +62,8 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | public function setAttributeSelected(string $name): void |
| 64 | 64 | { |
| 65 | - if(!$this->isAttribute($name)) return; |
|
| 66 | - if(!$this->isAttributeJoined($name)) |
|
| 65 | + if (!$this->isAttribute($name)) return; |
|
| 66 | + if (!$this->isAttributeJoined($name)) |
|
| 67 | 67 | { |
| 68 | 68 | $this->selected[] = $name; |
| 69 | 69 | } |
@@ -48,7 +48,9 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | public function setAttributeJoined(string $name): void |
| 50 | 50 | { |
| 51 | - if(!$this->isAttribute($name)) return; |
|
| 51 | + if(!$this->isAttribute($name)) { |
|
| 52 | + return; |
|
| 53 | + } |
|
| 52 | 54 | if(!$this->isAttributeJoined($name)) |
| 53 | 55 | { |
| 54 | 56 | $this->joins[] = $name; |
@@ -62,7 +64,9 @@ discard block |
||
| 62 | 64 | |
| 63 | 65 | public function setAttributeSelected(string $name): void |
| 64 | 66 | { |
| 65 | - if(!$this->isAttribute($name)) return; |
|
| 67 | + if(!$this->isAttribute($name)) { |
|
| 68 | + return; |
|
| 69 | + } |
|
| 66 | 70 | if(!$this->isAttributeJoined($name)) |
| 67 | 71 | { |
| 68 | 72 | $this->selected[] = $name; |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | public function getValue($allowNull = false) : mixed |
| 53 | 53 | { |
| 54 | - if($allowNull) { |
|
| 54 | + if ($allowNull) { |
|
| 55 | 55 | return $this->isValue() |
| 56 | 56 | ? $this->getValue() |
| 57 | 57 | : null; |
@@ -96,12 +96,12 @@ discard block |
||
| 96 | 96 | $name = $this->getName(); |
| 97 | 97 | $attributes = $this->getGroup()->getAttributes(); |
| 98 | 98 | |
| 99 | - if(!$attributes->isAttribute($name)) |
|
| 99 | + if (!$attributes->isAttribute($name)) |
|
| 100 | 100 | { |
| 101 | 101 | return $query; |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | - if(!$attributes->isAttributeJoined($name)) |
|
| 104 | + if (!$attributes->isAttributeJoined($name)) |
|
| 105 | 105 | { |
| 106 | 106 | $query = $this->makeJoin($query); |
| 107 | 107 | $attributes->setAttributeJoined($name); |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | $group = $this->getGroup(); |
| 117 | 117 | $attributes = $group->getAttributes(); |
| 118 | 118 | |
| 119 | - if(!$attributes->isAttribute($name)) |
|
| 119 | + if (!$attributes->isAttribute($name)) |
|
| 120 | 120 | { |
| 121 | 121 | return $query; |
| 122 | 122 | } |
@@ -11,14 +11,14 @@ |
||
| 11 | 11 | |
| 12 | 12 | enum QB_CONDITION |
| 13 | 13 | { |
| 14 | - case AND; |
|
| 15 | - case OR; |
|
| 14 | + case AND ; |
|
| 15 | + case OR ; |
|
| 16 | 16 | |
| 17 | 17 | public function sql() : string |
| 18 | 18 | { |
| 19 | 19 | return match ($this) { |
| 20 | - self::AND => "and", |
|
| 21 | - self::OR => "or" |
|
| 20 | + self:: AND => "and", |
|
| 21 | + self:: OR => "or" |
|
| 22 | 22 | }; |
| 23 | 23 | } |
| 24 | 24 | } |
| 25 | 25 | \ No newline at end of file |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | |
| 43 | 43 | public static function isValid(string $type): bool |
| 44 | 44 | { |
| 45 | - if($type === self::MANUAL->value()) return false; |
|
| 45 | + if ($type === self::MANUAL->value()) return false; |
|
| 46 | 46 | $cases = array_map(fn($case) => $case->value(), self::cases()); |
| 47 | 47 | return in_array($type, $cases); |
| 48 | 48 | } |
@@ -42,7 +42,9 @@ |
||
| 42 | 42 | |
| 43 | 43 | public static function isValid(string $type): bool |
| 44 | 44 | { |
| 45 | - if($type === self::MANUAL->value()) return false; |
|
| 45 | + if($type === self::MANUAL->value()) { |
|
| 46 | + return false; |
|
| 47 | + } |
|
| 46 | 48 | $cases = array_map(fn($case) => $case->value(), self::cases()); |
| 47 | 49 | return in_array($type, $cases); |
| 48 | 50 | } |
@@ -122,20 +122,20 @@ |
||
| 122 | 122 | self::LESS_OR_EQUAL, self::GREATER, self::GREATER_OR_EQUAL, self::BETWEEN, |
| 123 | 123 | self::NOT_BETWEEN => |
| 124 | 124 | [ATTR_TYPE::INTEGER, |
| 125 | - ATTR_TYPE::DECIMAL, |
|
| 126 | - ATTR_TYPE::DATETIME], |
|
| 125 | + ATTR_TYPE::DECIMAL, |
|
| 126 | + ATTR_TYPE::DATETIME], |
|
| 127 | 127 | |
| 128 | 128 | self::BEGINS_WITH, self::NOT_BEGINS_WITH, self::CONTAINS, self::NOT_CONTAINS, |
| 129 | 129 | self::ENDS_WITH, self::NOT_ENDS_WITH, self::IS_EMPTY, self::IS_NOT_EMPTY => |
| 130 | 130 | [ATTR_TYPE::STRING, |
| 131 | - ATTR_TYPE::TEXT], |
|
| 131 | + ATTR_TYPE::TEXT], |
|
| 132 | 132 | |
| 133 | 133 | self::IS_NULL, self::IS_NOT_NULL => |
| 134 | 134 | [ATTR_TYPE::STRING, |
| 135 | - ATTR_TYPE::TEXT, |
|
| 136 | - ATTR_TYPE::INTEGER, |
|
| 137 | - ATTR_TYPE::DECIMAL, |
|
| 138 | - ATTR_TYPE::DATETIME], |
|
| 135 | + ATTR_TYPE::TEXT, |
|
| 136 | + ATTR_TYPE::INTEGER, |
|
| 137 | + ATTR_TYPE::DECIMAL, |
|
| 138 | + ATTR_TYPE::DATETIME], |
|
| 139 | 139 | }; |
| 140 | 140 | } |
| 141 | 141 | |
@@ -56,7 +56,7 @@ |
||
| 56 | 56 | $records = $stmt->process($csv); |
| 57 | 57 | $outputSize = $records->count(); |
| 58 | 58 | |
| 59 | - if($outputSize == 0) |
|
| 59 | + if ($outputSize == 0) |
|
| 60 | 60 | { |
| 61 | 61 | return null; |
| 62 | 62 | } |
@@ -57,7 +57,7 @@ |
||
| 57 | 57 | foreach ($attributes as $attribute) |
| 58 | 58 | { |
| 59 | 59 | $name = $attribute->getName(); |
| 60 | - if(in_array($name, $columns)) |
|
| 60 | + if (in_array($name, $columns)) |
|
| 61 | 61 | { |
| 62 | 62 | $this->appendAttribute($attribute); |
| 63 | 63 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | $value->setType($attribute->getTypeEnum()); |
| 71 | 71 | $value->setAttributeKey($attribute->getKey()); |
| 72 | 72 | $value->setAttributeName($attribute->getName()); |
| 73 | - if(!is_null($entityKey)) |
|
| 73 | + if (!is_null($entityKey)) |
|
| 74 | 74 | { |
| 75 | 75 | $value->setEntityKey($entityKey); |
| 76 | 76 | } else |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | |
| 84 | 84 | public function parseLine(array $line): void |
| 85 | 85 | { |
| 86 | - if(!key_exists(_ENTITY::ID->column(), $line)) |
|
| 86 | + if (!key_exists(_ENTITY::ID->column(), $line)) |
|
| 87 | 87 | { |
| 88 | 88 | EntityException::mustBeEntityKey(); |
| 89 | 89 | } |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | $this->incrementLineIndex(); |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - foreach($line as $name => $content) |
|
| 101 | + foreach ($line as $name => $content) |
|
| 102 | 102 | { |
| 103 | 103 | $this->parseCell($name, $content, $entityKey); |
| 104 | 104 | } |
@@ -139,9 +139,9 @@ discard block |
||
| 139 | 139 | /** |
| 140 | 140 | * @var Value $value |
| 141 | 141 | */ |
| 142 | - foreach($valueSet->forNewEntities() as $value) |
|
| 142 | + foreach ($valueSet->forNewEntities() as $value) |
|
| 143 | 143 | { |
| 144 | - if($value->isEmptyValue()) continue; |
|
| 144 | + if ($value->isEmptyValue()) continue; |
|
| 145 | 145 | $value->setEntityKey($entities[$value->getLineIndex() - 1]->getKey()); |
| 146 | 146 | $bulkCreateSet->appendValue($value); |
| 147 | 147 | } |
@@ -158,17 +158,17 @@ discard block |
||
| 158 | 158 | /** |
| 159 | 159 | * @var Value $value |
| 160 | 160 | */ |
| 161 | - foreach($valueSet->forExistingEntities() as $attributeValue) |
|
| 161 | + foreach ($valueSet->forExistingEntities() as $attributeValue) |
|
| 162 | 162 | { |
| 163 | 163 | $value = $attributeValue->getValue(); |
| 164 | 164 | $entityKey = $attributeValue->getEntityKey(); |
| 165 | 165 | $attribute = $attrSet->getAttribute($attributeValue->getAttributeName()); |
| 166 | 166 | $attributeKey = $attribute->getKey(); |
| 167 | 167 | $attributeType = $attribute->getTypeEnum(); |
| 168 | - if($value == '') |
|
| 169 | - $repository->destroy($domainKey,$entityKey,$attributeKey,$attributeType); |
|
| 168 | + if ($value == '') |
|
| 169 | + $repository->destroy($domainKey, $entityKey, $attributeKey, $attributeType); |
|
| 170 | 170 | else |
| 171 | - $repository->updateOrCreate($domainKey,$entityKey,$attributeKey,$attributeType,$value); |
|
| 171 | + $repository->updateOrCreate($domainKey, $entityKey, $attributeKey, $attributeType, $value); |
|
| 172 | 172 | } |
| 173 | 173 | } |
| 174 | 174 | |
@@ -141,7 +141,9 @@ discard block |
||
| 141 | 141 | */ |
| 142 | 142 | foreach($valueSet->forNewEntities() as $value) |
| 143 | 143 | { |
| 144 | - if($value->isEmptyValue()) continue; |
|
| 144 | + if($value->isEmptyValue()) { |
|
| 145 | + continue; |
|
| 146 | + } |
|
| 145 | 147 | $value->setEntityKey($entities[$value->getLineIndex() - 1]->getKey()); |
| 146 | 148 | $bulkCreateSet->appendValue($value); |
| 147 | 149 | } |
@@ -165,10 +167,11 @@ discard block |
||
| 165 | 167 | $attribute = $attrSet->getAttribute($attributeValue->getAttributeName()); |
| 166 | 168 | $attributeKey = $attribute->getKey(); |
| 167 | 169 | $attributeType = $attribute->getTypeEnum(); |
| 168 | - if($value == '') |
|
| 169 | - $repository->destroy($domainKey,$entityKey,$attributeKey,$attributeType); |
|
| 170 | - else |
|
| 171 | - $repository->updateOrCreate($domainKey,$entityKey,$attributeKey,$attributeType,$value); |
|
| 170 | + if($value == '') { |
|
| 171 | + $repository->destroy($domainKey,$entityKey,$attributeKey,$attributeType); |
|
| 172 | + } else { |
|
| 173 | + $repository->updateOrCreate($domainKey,$entityKey,$attributeKey,$attributeType,$value); |
|
| 174 | + } |
|
| 172 | 175 | } |
| 173 | 176 | } |
| 174 | 177 | |
@@ -106,14 +106,14 @@ |
||
| 106 | 106 | { |
| 107 | 107 | $config = $this->getConfig(); |
| 108 | 108 | $attributes = []; |
| 109 | - foreach($this->getRequiredAttributes() as $name) |
|
| 109 | + foreach ($this->getRequiredAttributes() as $name) |
|
| 110 | 110 | { |
| 111 | - if(!$config->hasAttribute($name)) |
|
| 111 | + if (!$config->hasAttribute($name)) |
|
| 112 | 112 | { |
| 113 | 113 | $attributes[] = $name; |
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | - if(count($attributes) > 0) |
|
| 116 | + if (count($attributes) > 0) |
|
| 117 | 117 | { |
| 118 | 118 | ImportException::configMissedAttributes($attributes); |
| 119 | 119 | } |