25 lines
628 B
PHP
25 lines
628 B
PHP
<?php
|
|
|
|
namespace App\Entities\Part;
|
|
|
|
use App\Entities\CommonEntity;
|
|
|
|
abstract class PartEntity extends CommonEntity
|
|
{
|
|
public function __construct(array|null $data = null)
|
|
{
|
|
parent::__construct($data);
|
|
}
|
|
abstract public function getAvailable(): int;
|
|
abstract public function getUsed(): int;
|
|
//기본기능용
|
|
public function getCustomTitle(mixed $title = null): string
|
|
{
|
|
return sprintf("%s %s원", $title ? $title : $this->getTitle(), number_format($this->getPrice()));
|
|
}
|
|
final public function getPrice(): int
|
|
{
|
|
return $this->attributes['price'] ?? 0;
|
|
}
|
|
}
|