<?php
abstract class ItemPrototypeAbstract
{
private $_id;
private $_name;
private $_price;
private $_detail;
public function __construct($id, $name, $price)
{
$this->_id = $id;
$this->_name = $name;
$this->_price = $price;
}
public function getId()
{
return $this->_id;
}
public function getName()
{
return $this->_name;
}
public function getPrice()
{
return $this->_price;
}
public function setDetail(stdClass $detail)
{
$this->_detail = $detail;
}
public function getDetail()
{
return $this->_detail;
}
public function dumpData()
{
echo '<dl>';
echo '<dt>' . $this->getName() . '</dt>';
echo '<dd>id:' . $this->getId() . '</dd>';
echo '<dd>price:' . $this->getPrice() . '</dd>';
echo '<dd>detail:' . $this->_detail->comment . '</dd>';
echo '</dl>';
}
public function newInstance()
{
return clone $this;
}
protected abstract function __clone();
}