| Total Complexity | 11 |
| Total Lines | 87 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | class Brand implements BrandInterface |
||
| 8 | { |
||
| 9 | use ProductsAwareTrait, |
||
| 10 | ImagesAwareTrait; |
||
| 11 | |||
| 12 | /** |
||
| 13 | * @var int |
||
| 14 | */ |
||
| 15 | protected $id; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @var string|null |
||
| 19 | */ |
||
| 20 | protected $slug; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @var string|null |
||
| 24 | */ |
||
| 25 | protected $name; |
||
| 26 | |||
| 27 | public function __construct() |
||
| 28 | { |
||
| 29 | $this->initializeImagesCollection(); |
||
| 30 | $this->initializeProductsCollection(); |
||
| 31 | } |
||
| 32 | |||
| 33 | /** |
||
| 34 | * {@inheritdoc} |
||
| 35 | */ |
||
| 36 | public function __toString(): string |
||
| 37 | { |
||
| 38 | return (string) $this->getName(); |
||
| 39 | } |
||
| 40 | |||
| 41 | /** |
||
| 42 | * {@inheritdoc} |
||
| 43 | */ |
||
| 44 | public function getId(): ?int |
||
| 45 | { |
||
| 46 | return $this->id; |
||
| 47 | } |
||
| 48 | |||
| 49 | /** |
||
| 50 | * {@inheritdoc} |
||
| 51 | */ |
||
| 52 | public function getSlug(): ?string |
||
| 53 | { |
||
| 54 | return $this->slug; |
||
| 55 | } |
||
| 56 | |||
| 57 | /** |
||
| 58 | * {@inheritdoc} |
||
| 59 | */ |
||
| 60 | public function setSlug(?string $slug): void |
||
| 61 | { |
||
| 62 | $this->slug = $slug; |
||
| 63 | } |
||
| 64 | |||
| 65 | /** |
||
| 66 | * {@inheritdoc} |
||
| 67 | */ |
||
| 68 | public function getName(): ?string |
||
| 69 | { |
||
| 70 | return $this->name; |
||
| 71 | } |
||
| 72 | |||
| 73 | /** |
||
| 74 | * {@inheritdoc} |
||
| 75 | */ |
||
| 76 | public function setName(?string $name): void |
||
| 77 | { |
||
| 78 | $this->name = $name; |
||
| 79 | } |
||
| 80 | |||
| 81 | public function addProduct(ProductInterface $product): void |
||
| 86 | } |
||
| 87 | } |
||
| 88 | |||
| 89 | public function removeProduct(ProductInterface $product): void |
||
| 94 | } |
||
| 95 | } |
||
| 96 | } |
||
| 97 |