Files
myep-team/src/BusProNet/Model/CrmAttributesResponse.php
T

105 lines
2.2 KiB
PHP

<?php
namespace App\BusProNet\Model;
class CrmAttributesResponse
{
private ?array $attributeGroups = null;
private bool $admin = false;
private bool $manager = false;
private bool $houseManager = false;
private bool $teamer = false;
private array $hotelCodes = [];
public function getAttributeGroups(): ?array
{
return $this->attributeGroups;
}
public function setAttributeGroups(?array $attributeGroups): static{
$this->attributeGroups = $attributeGroups;
return $this;
}
public function isTeamer(): bool
{
return $this->teamer;
}
public function setTeamer(bool $teamer): static
{
$this->teamer = $teamer;
return $this;
}
public function isAdmin(): bool
{
return $this->admin;
}
public function setAdmin(bool $admin): static
{
$this->admin = $admin;
return $this;
}
public function isManager(): bool
{
return $this->manager;
}
public function setManager(bool $manager): static
{
$this->manager = $manager;
return $this;
}
public function isHouseManager(): bool
{
return $this->houseManager;
}
public function setHouseManager(bool $houseManager): static
{
$this->houseManager = $houseManager;
return $this;
}
public function getHotelCodes(): array
{
return $this->hotelCodes;
}
public function setHotelCodes(array $hotelCodes): static
{
$this->hotelCodes = $hotelCodes;
return $this;
}
public function toArray(): array
{
$crmSelections = [];
foreach ($this->getAttributeGroups() as $group) {
/** @var CrmAttributeGroup $group */
if (false === isset($crmSelections[$group->getLabel()])) {
$crmSelections[$group->getLabel()] = [];
}
foreach ($group->getAttributes() as $attribute) {
/** @var CrmAttribute $attribute */
if (false === $attribute->isSelected()) {
continue;
}
$crmSelections[$group->getLabel()][] = $attribute->getLabel();
}
}
return $crmSelections;
}
}