image = new NullMedia(); $this->mainAddress = new NullAddress(); } /** * Get the main contact element by type * * @param int $type Contact element type * * @return Contact * * @since 1.0.0 */ public function getContactByType(int $type) : Contact { foreach ($this->contacts as $element) { if ($element->type === $type) { return $element; } } return new NullContact(); } /** * {@inheritdoc} */ public function toArray() : array { return [ 'id' => $this->id, 'name' => $this->name, 'status' => $this->status, 'description' => $this->description, 'descriptionRaw' => $this->descriptionRaw, 'parent' => $this->parent, 'image' => $this->image, ]; } /** * {@inheritdoc} */ public function jsonSerialize() : mixed { return $this->toArray(); } use \Modules\Attribute\Models\AttributeHolderTrait; }