IItem Interface:
Code: Select all
interface IItem
{
function Load();
function Create();
function Fill();
function GetId();
function Exist(Identifier $Identifier);
function Exists();
}
Code: Select all
class Item implements IItem
{
protected $Id;
protected $Exists = FALSE;
function __construct()
{
$Count = func_num_args();
if($Count == 1 && func_get_arg(0) instanceof Identifier)
{
$this->Load(func_get_arg(0));
} else {
call_user_func_array(array($this, 'Create'), func_get_args());
}
}
function Load() { }
function Create() { }
function Fill() { }
function GetId()
{
return $this->Id;
}
function Exist(Identifier $Identifier)
{
$this->Id = $Id->Value;
$this->Exists = TRUE;
}
function Exists()
{
return $this->Exists;
}
}
Code: Select all
interface ICollection
{
function Listed();
function Parameters();
function Exists($Id);
function Length();
}
Code: Select all
class Collection implements ICollection
{
public $Items = array();
function __construct()
{
$Count = func_num_args();
if($Count == 1 && func_get_arg(0) instanceof Identifiers)
{
$this->Listed(func_get_arg(0));
} else {
call_user_func_array(array($this, 'Parameters'), func_get_args());
}
}
function __set($Name, $Value) { }
private function Listed(Identifiers $Identifiers) { }
private function Parameters() { }
function Exists($Id)
{
return !empty($this->Items[$Id]);
}
function Length()
{
return count($this->Items);
}
}