| Total Complexity | 8 |
| Total Lines | 76 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | class WorkspaceDto |
||
| 8 | { |
||
| 9 | private $hourlyRate; |
||
| 10 | private $id; |
||
| 11 | private $imageUrl; |
||
| 12 | private $memberships; |
||
| 13 | private $name; |
||
| 14 | private $workspaceSettings; |
||
| 15 | |||
| 16 | public static function fromArray(array $data): self |
||
| 17 | { |
||
| 18 | return new self( |
||
| 19 | HourlyRateDto::fromArray($data['hourlyRate']), |
||
| 20 | $data['id'], |
||
| 21 | $data['imageUrl'], |
||
| 22 | array_map( |
||
| 23 | static function(array $data): MembershipDto { |
||
| 24 | return MembershipDto::fromArray($data); |
||
| 25 | }, |
||
| 26 | $data['memberships'] |
||
| 27 | ), |
||
| 28 | $data['name'], |
||
| 29 | WorkspaceSettingsDto::fromArray($data['workspaceSettings']) |
||
| 30 | ); |
||
| 31 | } |
||
| 32 | |||
| 33 | /** |
||
| 34 | * @param MembershipDto[] $memberships |
||
| 35 | */ |
||
| 36 | public function __construct( |
||
| 37 | ?HourlyRateDto $hourlyRate, |
||
| 38 | string $id, |
||
| 39 | string $imageUrl, |
||
| 40 | array $memberships, |
||
| 41 | string $name, |
||
| 42 | WorkspaceSettingsDto $workspaceSettings |
||
| 43 | ) { |
||
| 44 | $this->hourlyRate = $hourlyRate; |
||
| 45 | $this->id = $id; |
||
| 46 | $this->imageUrl = $imageUrl; |
||
| 47 | $this->memberships = $memberships; |
||
| 48 | $this->name = $name; |
||
| 49 | $this->workspaceSettings = $workspaceSettings; |
||
| 50 | } |
||
| 51 | |||
| 52 | public function hourlyRate(): ?HourlyRateDto |
||
| 53 | { |
||
| 54 | return $this->hourlyRate; |
||
| 55 | } |
||
| 56 | |||
| 57 | public function id(): string |
||
| 60 | } |
||
| 61 | |||
| 62 | public function imageUrl(): string |
||
| 63 | { |
||
| 64 | return $this->imageUrl; |
||
| 65 | } |
||
| 66 | |||
| 67 | /** |
||
| 68 | * @return MembershipDto[] |
||
| 69 | */ |
||
| 70 | public function memberships() |
||
| 71 | { |
||
| 72 | return $this->memberships; |
||
| 73 | } |
||
| 74 | |||
| 75 | public function name(): string |
||
| 76 | { |
||
| 77 | return $this->name; |
||
| 78 | } |
||
| 79 | |||
| 80 | public function workspaceSettings(): WorkspaceSettingsDto |
||
| 83 | } |
||
| 84 | } |
||
| 85 |