1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61:
<?php
namespace Coast\App\Access;
trait Implementation
{
protected $_app;
public function app(\Coast\App $app = null)
{
if (func_num_args() > 0 && !isset($this->_app)) {
$this->_app = $app;
return $this;
}
return $this->_app;
}
public function __get($name)
{
if (!isset($this->_app)) {
throw new \Exception("Property '" . __CLASS__ . "::\${$name}' does not exist and \$app has not been set");
}
return $this->_app->__get($name);
}
public function __set($name, $value)
{
if (!isset($this->_app)) {
throw new \Exception("Property '" . __CLASS__ . "::\${$name}' does not exist and \$app has not been set");
}
$this->_app->__set($name, $value);
}
public function __isset($name)
{
if (!isset($this->_app)) {
throw new \Exception("Property '" . __CLASS__ . "::\${$name}' does not exist and \$app has not been set");
}
return $this->_app->__isset($name);
}
public function __unset($name)
{
if (!isset($this->_app)) {
throw new \Exception("Property '" . __CLASS__ . "::\${$name}' does not exist and \$app has not been set");
}
$this->_app->__unset($name);
}
public function __call($name, array $args)
{
if (!isset($this->_app)) {
throw new \Exception("Method '" . __CLASS__ . "::{$name}()' does not exist and \$app has not been set");
}
return $this->_app->__call($name, $args);
}
}