<?php

namespace Inoby;
use ReflectionProperty;
use ReflectionMethod;

class InobyReflection {
  private $_instance;

  public function __construct($instance) {
    $this->_instance = $instance;
  }

  public function __get($name) {
    $reflectionObject = new ReflectionProperty($this->_instance, $name);
    $reflectionObject->setAccessible(true);
    return $reflectionObject->getValue($this->_instance);
  }

  public function __call($name, $arguments) {
    $reflectionObject = new ReflectionMethod($this->_instance, $name);
    $reflectionObject->setAccessible(true);
    return $reflectionObject->invoke($this->_instance, $arguments);
  }
}
