예제 #1
0
 /**
  * Magic/overload property getter.
  *
  * @param string $property Property to get.
  *
  * @throws \exception If the `$___overload` property is undefined.
  *
  * @return mixed The value of `$this->___overload->{$property}`.
  *
  * @see http://php.net/manual/en/language.oop5.overloading.php
  */
 public function __get($property)
 {
     $property = (string) $property;
     if (strpos($property, 'utils_') === 0) {
         $class_property = ucfirst(preg_replace_callback('/_(.)/', function ($m) {
             return strtoupper($m[1]);
         }, $property));
         $ns_class_property = '\\' . __NAMESPACE__ . '\\' . $class_property;
         if (class_exists($ns_class_property)) {
             if (!isset($this->___overload->{$property})) {
                 $this->___overload->{$property} = new $ns_class_property();
             }
         }
     }
     return parent::__get($property);
 }