| 6 | | class HermitClassProxy implements HermitDao { |
| 7 | | protected $target; |
| 8 | | protected $pdo; |
| 9 | | protected function __construct(ReflectionClass $reflector, $targetClass, PDO $pdo = null){ |
| 10 | | $this->target = $targetClass; |
| 11 | | $this->reflector = $reflector; |
| 12 | | $this->pdo = $pdo; |
| 13 | | } |
| 14 | | public static function delegate(PDO $pdo, ReflectionClass $reflector, $instance = null){ |
| 15 | | return new self($reflector, $instance, $pdo); |
| 16 | | } |
| 17 | | public function __call($name, $params = array()){ |
| 18 | | $annote = HermitAnnote::create($this->reflector); |
| 19 | | if($annote->hasMethod($name, true)){ |
| 20 | | $method = $annote->getMethod($name); |
| 21 | | return $method->invokeArgs($this->target, $params); |
| 22 | | } |
| 23 | | throw new BadMethodCallException(get_class($this->target) . '::' . $name); |
| | 6 | class HermitClassProxy implements HermitProxy { |
| | 7 | public function request($name, array $params){ |