@@ -50,8 +50,7 @@ |
||
| 50 | 50 | * Class HasMany |
| 51 | 51 | * @package Platine\Orm\Relation |
| 52 | 52 | */ |
| 53 | -class HasMany extends HasRelation |
|
| 54 | -{ |
|
| 53 | +class HasMany extends HasRelation { |
|
| 55 | 54 | /** |
| 56 | 55 | * {@inheritedoc} |
| 57 | 56 | */ |
@@ -54,8 +54,7 @@ discard block |
||
| 54 | 54 | * Class PrimaryKey |
| 55 | 55 | * @package Platine\Orm\Relation |
| 56 | 56 | */ |
| 57 | -class PrimaryKey |
|
| 58 | -{ |
|
| 57 | +class PrimaryKey { |
|
| 59 | 58 | /** |
| 60 | 59 | * |
| 61 | 60 | * @var array<int, string> |
@@ -72,8 +71,7 @@ discard block |
||
| 72 | 71 | * Create new instance |
| 73 | 72 | * @param string ...$columns |
| 74 | 73 | */ |
| 75 | - public function __construct(string ...$columns) |
|
| 76 | - { |
|
| 74 | + public function __construct(string ...$columns) { |
|
| 77 | 75 | $this->columns = $columns; |
| 78 | 76 | $this->composite = count($columns) > 1; |
| 79 | 77 | } |
@@ -103,8 +101,7 @@ discard block |
||
| 103 | 101 | * |
| 104 | 102 | * @return mixed|array<string, mixed>|null |
| 105 | 103 | */ |
| 106 | - public function getValue(array $columns, bool $map = false) |
|
| 107 | - { |
|
| 104 | + public function getValue(array $columns, bool $map = false) { |
|
| 108 | 105 | if (!$this->composite && !$map) { |
| 109 | 106 | return isset($columns[$this->columns[0]]) |
| 110 | 107 | ? $columns[$this->columns[0]] |
@@ -129,8 +126,7 @@ discard block |
||
| 129 | 126 | * |
| 130 | 127 | * @return mixed|array<string, mixed>|null |
| 131 | 128 | */ |
| 132 | - public function getValueFromDataMapper(DataMapper $mapper, bool $map = false) |
|
| 133 | - { |
|
| 129 | + public function getValueFromDataMapper(DataMapper $mapper, bool $map = false) { |
|
| 134 | 130 | return $this->getValue($mapper->getRawColumns(), $map); |
| 135 | 131 | } |
| 136 | 132 | |
@@ -140,8 +136,7 @@ discard block |
||
| 140 | 136 | * @param bool $map |
| 141 | 137 | * @return mixed|array<string, mixed>|null |
| 142 | 138 | */ |
| 143 | - public function getValueFromEntity(Entity $entity, bool $map = false) |
|
| 144 | - { |
|
| 139 | + public function getValueFromEntity(Entity $entity, bool $map = false) { |
|
| 145 | 140 | $columns = Proxy::instance()->getEntityColumns($entity); |
| 146 | 141 | return $this->getValue($columns, $map); |
| 147 | 142 | } |
@@ -50,8 +50,7 @@ discard block |
||
| 50 | 50 | * Class ForeignKey |
| 51 | 51 | * @package Platine\Orm\Relation |
| 52 | 52 | */ |
| 53 | -class ForeignKey |
|
| 54 | -{ |
|
| 53 | +class ForeignKey { |
|
| 55 | 54 | /** |
| 56 | 55 | * |
| 57 | 56 | * @var array<string, string> |
@@ -68,8 +67,7 @@ discard block |
||
| 68 | 67 | * Create new instance |
| 69 | 68 | * @param array<string, string> $columns |
| 70 | 69 | */ |
| 71 | - public function __construct(array $columns) |
|
| 72 | - { |
|
| 70 | + public function __construct(array $columns) { |
|
| 73 | 71 | $this->columns = $columns; |
| 74 | 72 | $this->composite = count($columns) > 1; |
| 75 | 73 | } |
@@ -99,8 +97,7 @@ discard block |
||
| 99 | 97 | * |
| 100 | 98 | * @return mixed|array<string, mixed>|null |
| 101 | 99 | */ |
| 102 | - public function getValue(array $columns, bool $map = false) |
|
| 103 | - { |
|
| 100 | + public function getValue(array $columns, bool $map = false) { |
|
| 104 | 101 | if (!$map && !$this->composite) { |
| 105 | 102 | $column = array_keys($this->columns); |
| 106 | 103 | |
@@ -127,8 +124,7 @@ discard block |
||
| 127 | 124 | * |
| 128 | 125 | * @return mixed|array<string, mixed>|null |
| 129 | 126 | */ |
| 130 | - public function getInverseValue(array $columns, bool $map = false) |
|
| 131 | - { |
|
| 127 | + public function getInverseValue(array $columns, bool $map = false) { |
|
| 132 | 128 | if (!$map && !$this->composite) { |
| 133 | 129 | $column = array_values($this->columns); |
| 134 | 130 | |
@@ -154,8 +150,7 @@ discard block |
||
| 154 | 150 | * |
| 155 | 151 | * @return mixed|array<string, mixed>|null |
| 156 | 152 | */ |
| 157 | - public function extractValue(array $columns, bool $map = false) |
|
| 158 | - { |
|
| 153 | + public function extractValue(array $columns, bool $map = false) { |
|
| 159 | 154 | if (!$map && !$this->composite) { |
| 160 | 155 | $column = array_values($this->columns); |
| 161 | 156 | |
@@ -50,8 +50,7 @@ discard block |
||
| 50 | 50 | * Class Junction |
| 51 | 51 | * @package Platine\Orm\Relation |
| 52 | 52 | */ |
| 53 | -class Junction |
|
| 54 | -{ |
|
| 53 | +class Junction { |
|
| 55 | 54 | /** |
| 56 | 55 | * |
| 57 | 56 | * @var array<string, string> |
@@ -69,8 +68,7 @@ discard block |
||
| 69 | 68 | * @param string $table |
| 70 | 69 | * @param array<string, string> $columns |
| 71 | 70 | */ |
| 72 | - public function __construct(string $table, array $columns) |
|
| 73 | - { |
|
| 71 | + public function __construct(string $table, array $columns) { |
|
| 74 | 72 | $this->table = $table; |
| 75 | 73 | $this->columns = $columns; |
| 76 | 74 | } |
@@ -189,9 +189,9 @@ |
||
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | /** |
| 192 | - * Map the entity information |
|
| 193 | - * @param EntityMapperInterface $mapper |
|
| 194 | - */ |
|
| 192 | + * Map the entity information |
|
| 193 | + * @param EntityMapperInterface $mapper |
|
| 194 | + */ |
|
| 195 | 195 | abstract public static function mapEntity(EntityMapperInterface $mapper): void; |
| 196 | 196 | |
| 197 | 197 | /** |
@@ -57,8 +57,7 @@ discard block |
||
| 57 | 57 | * Class Entity |
| 58 | 58 | * @package Platine\Orm |
| 59 | 59 | */ |
| 60 | -abstract class Entity implements JsonSerializable |
|
| 61 | -{ |
|
| 60 | +abstract class Entity implements JsonSerializable { |
|
| 62 | 61 | /** |
| 63 | 62 | * The instance of data mapper |
| 64 | 63 | * @var DataMapper|null |
@@ -102,8 +101,7 @@ discard block |
||
| 102 | 101 | * Convert entity to JSON array |
| 103 | 102 | * @return array<string, mixed> |
| 104 | 103 | */ |
| 105 | - public function jsonSerialize() |
|
| 106 | - { |
|
| 104 | + public function jsonSerialize() { |
|
| 107 | 105 | $rawColumns = $this->mapper()->getRawColumns(); |
| 108 | 106 | $data = []; |
| 109 | 107 | foreach ($rawColumns as $name => $value) { |
@@ -124,8 +122,7 @@ discard block |
||
| 124 | 122 | * @param string $name |
| 125 | 123 | * @return mixed |
| 126 | 124 | */ |
| 127 | - public function __get(string $name) |
|
| 128 | - { |
|
| 125 | + public function __get(string $name) { |
|
| 129 | 126 | if ($this->mapper()->hasRelation($name)) { |
| 130 | 127 | return $this->mapper()->getRelated($name); |
| 131 | 128 | } |
@@ -146,8 +143,7 @@ discard block |
||
| 146 | 143 | * @param mixed $value |
| 147 | 144 | * @return void |
| 148 | 145 | */ |
| 149 | - public function __set(string $name, $value) |
|
| 150 | - { |
|
| 146 | + public function __set(string $name, $value) { |
|
| 151 | 147 | if ($this->mapper()->hasRelation($name)) { |
| 152 | 148 | if (is_array($value)) { |
| 153 | 149 | foreach ($value as $entity) { |
@@ -166,8 +162,7 @@ discard block |
||
| 166 | 162 | * @param string $name |
| 167 | 163 | * @return bool |
| 168 | 164 | */ |
| 169 | - public function __isset(string $name) |
|
| 170 | - { |
|
| 165 | + public function __isset(string $name) { |
|
| 171 | 166 | return $this->mapper()->hasRelation($name) |
| 172 | 167 | || $this->mapper()->hasColumn($name); |
| 173 | 168 | } |
@@ -177,8 +172,7 @@ discard block |
||
| 177 | 172 | * @param string $name |
| 178 | 173 | * @return bool |
| 179 | 174 | */ |
| 180 | - public function __unset(string $name) |
|
| 181 | - { |
|
| 175 | + public function __unset(string $name) { |
|
| 182 | 176 | $this->mapper()->clearColumn($name, true); |
| 183 | 177 | } |
| 184 | 178 | |
@@ -57,8 +57,7 @@ discard block |
||
| 57 | 57 | * Class Query |
| 58 | 58 | * @package Platine\Orm\Query |
| 59 | 59 | */ |
| 60 | -class Query extends BaseStatement |
|
| 61 | -{ |
|
| 60 | +class Query extends BaseStatement { |
|
| 62 | 61 | /** |
| 63 | 62 | * |
| 64 | 63 | * @var HavingStatement |
@@ -94,8 +93,7 @@ discard block |
||
| 94 | 93 | * |
| 95 | 94 | * @param QueryStatement|null $queryStatement |
| 96 | 95 | */ |
| 97 | - public function __construct(QueryStatement $queryStatement = null) |
|
| 98 | - { |
|
| 96 | + public function __construct(QueryStatement $queryStatement = null) { |
|
| 99 | 97 | parent::__construct($queryStatement); |
| 100 | 98 | $this->havingStatement = new HavingStatement($this->queryStatement); |
| 101 | 99 | } |
@@ -103,8 +101,7 @@ discard block |
||
| 103 | 101 | /** |
| 104 | 102 | * Clone the object |
| 105 | 103 | */ |
| 106 | - public function __clone() |
|
| 107 | - { |
|
| 104 | + public function __clone() { |
|
| 108 | 105 | parent::__clone(); |
| 109 | 106 | $this->havingStatement = new HavingStatement($this->queryStatement); |
| 110 | 107 | } |
@@ -59,8 +59,7 @@ discard block |
||
| 59 | 59 | * Class Proxy |
| 60 | 60 | * @package Platine\Orm\Mapper |
| 61 | 61 | */ |
| 62 | -class Proxy |
|
| 63 | -{ |
|
| 62 | +class Proxy { |
|
| 64 | 63 | /** |
| 65 | 64 | * The Entity data mapper arguments property |
| 66 | 65 | * @var ReflectionProperty |
@@ -77,8 +76,7 @@ discard block |
||
| 77 | 76 | * Create new instance |
| 78 | 77 | * @throws ReflectionException |
| 79 | 78 | */ |
| 80 | - private function __construct() |
|
| 81 | - { |
|
| 79 | + private function __construct() { |
|
| 82 | 80 | $reflection = new ReflectionClass(Entity::class); |
| 83 | 81 | |
| 84 | 82 | $this->dataMapperArgs = $reflection->getProperty('dataMapperArgs'); |
@@ -52,8 +52,7 @@ |
||
| 52 | 52 | * Class DataMapperInterface |
| 53 | 53 | * @package Platine\Orm\Mapper |
| 54 | 54 | */ |
| 55 | -interface DataMapperInterface |
|
| 56 | -{ |
|
| 55 | +interface DataMapperInterface { |
|
| 57 | 56 | /** |
| 58 | 57 | * Whether the record is new |
| 59 | 58 | * @return bool |
@@ -50,8 +50,7 @@ |
||
| 50 | 50 | * Class ShareOne |
| 51 | 51 | * @package Platine\Orm\Relation |
| 52 | 52 | */ |
| 53 | -class ShareOne extends ShareRelation |
|
| 54 | -{ |
|
| 53 | +class ShareOne extends ShareRelation { |
|
| 55 | 54 | /** |
| 56 | 55 | * {@inheritedoc} |
| 57 | 56 | */ |