31 lines
467 B
PHP
31 lines
467 B
PHP
<?php
|
|
namespace Mocha\Core;
|
|
class InstanceSet
|
|
{
|
|
|
|
private $_Instances;
|
|
public function __construct()
|
|
{
|
|
$this->_Instances = array();
|
|
}
|
|
|
|
public function add($inst)
|
|
{
|
|
$this->_Instances[] = $inst;
|
|
}
|
|
public function contains($inst)
|
|
{
|
|
foreach ($this->_Instances as $needle)
|
|
{
|
|
if ($needle === $inst)
|
|
return true;
|
|
}
|
|
/*
|
|
if (in_array($inst, $this->_Instances))
|
|
trigger_error("needle is equal to inst");
|
|
return true;
|
|
*/
|
|
return false;
|
|
}
|
|
|
|
} |