| Total Complexity | 8 |
| Total Lines | 56 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 11 | class User extends DataLayer |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * User constructor. |
||
| 15 | */ |
||
| 16 | public function __construct() |
||
| 19 | } |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @param bool $obj |
||
| 23 | * @return User |
||
| 24 | */ |
||
| 25 | public function address(bool $obj = false): User |
||
| 26 | { |
||
| 27 | $this->relational_fields[] = 'address'; |
||
| 28 | |||
| 29 | if ($obj) { |
||
| 30 | $this->address = (new Address())->findByUser($this->id); |
||
| 31 | return $this; |
||
| 32 | } |
||
| 33 | |||
| 34 | $address = (new Address())->findByUser($this->id); |
||
| 35 | if (empty($address)) { |
||
| 36 | $this->address = null; |
||
| 37 | } else { |
||
| 38 | $this->address = (new Address())->findByUser($this->id)->data(); |
||
| 39 | } |
||
| 40 | return $this; |
||
| 41 | } |
||
| 42 | |||
| 43 | /** |
||
| 44 | * @param bool $obj |
||
| 45 | * @return User |
||
| 46 | */ |
||
| 47 | public function socials(bool $obj = false): User |
||
| 67 | } |
||
| 68 | } |