attributes['name']; } public function getCategory(): string { return $this->attributes['category']; } public function getPrice(): int { return $this->attributes['price']; } //추가기능 //판매금액표시용 public function getTitleWithPrice(array $attrs = []): string { $format = array_key_exists('format', $attrs) ? $attrs['format'] : "%s원 %s"; return sprintf($format, number_format($this->getPrice()), $this->getTitle()); } }