예제 #1
0
파일: Hermit.php 프로젝트: nowelium/Hermit
 public function __construct($class = null)
 {
     if (is_null($class)) {
         $e = new Exception();
         $trace = $e->getTrace();
         $class = HermitDaoManager::get($trace[1]['class']);
     } else {
         if (HermitDaoManager::has($class)) {
             $class = HermitDaoManager::get($class);
         }
     }
     $this->proxy = self::__create($this, $class);
 }
예제 #2
0
    public function of($target)
    {
        return HermitDaoManager::get($target);
    }
}
class Foo
{
    public function get()
    {
        return HermitDaoManager::get(__CLASS__);
    }
}
class Bar
{
    public function get()
    {
        return HermitDaoManager::get(__CLASS__);
    }
}
$hoge = new Hoge();
$foo = new Foo();
$bar = new Bar();
$test->is($hoge->get(), 'A01Dao');
$test->is($hoge->of('Foo'), 'A02Dao');
$test->is($foo->get(), 'A02Dao');
$test->is($bar->get(), null);
$test->is(HermitDaoManager::has('Hoge'), true);
$test->is(HermitDaoManager::has('Foo'), true);
$test->is(HermitDaoManager::has('A01Dao'), false);
$test->is(HermitDaoManager::has('A02Dao'), false);