| Conditions | 4 |
| Paths | 4 |
| Total Lines | 20 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 47 | public function socials(bool $obj = false): User |
||
| 48 | { |
||
| 49 | $this->relational_fields[] = 'socials'; |
||
| 50 | $socials = (new Socials())->getUserSocials($this->id); |
||
| 51 | |||
| 52 | if ($obj) { |
||
| 53 | $this->socials = $socials; |
||
| 54 | return $this; |
||
| 55 | } |
||
| 56 | |||
| 57 | if (empty($socials)) { |
||
| 58 | $this->socials = null; |
||
| 59 | return $this; |
||
| 60 | } |
||
| 61 | |||
| 62 | foreach ($socials as $key => $value) { |
||
| 63 | $user_socials[] = $value->data(); |
||
| 64 | } |
||
| 65 | $this->socials = $user_socials; |
||
| 66 | return $this; |
||
| 67 | } |
||
| 68 | } |