Example #1
0
 public function __call($method, $argument)
 {
     //Если геттера или сеттера нет - вызываем родительский
     if (!method_exists($this, 'set' . $method) && !method_exists($this, 'get' . $method)) {
         parent::__call($method, $argument);
     }
     if (boolval($argument)) {
         $newMethod = 'set' . $method;
         return $this->{$newMethod}($argument[0]);
     } else {
         $newMethod = 'get' . $method;
         return $this->{$newMethod}();
     }
 }
Example #2
0
 public function __call($method, $arguments)
 {
     if (($prefix = substr($method, 0, 3)) == 'get') {
         $property = Text::uncamelize(substr($method, 3));
         if (null !== ($result = $this->getData($property)) || $this->checkDataColumn($property)) {
             return $result;
         }
     } elseif ($prefix == 'set') {
         $property = Text::uncamelize(substr($method, 3));
         return $this->setData($property, fnGet($arguments, 0));
     }
     // @codeCoverageIgnoreStart
     return parent::__call($method, $arguments);
     // @codeCoverageIgnoreEnd
 }