/** * @param $name * @return mixed * @throws \OutOfBoundsException */ public function __get($name) { $fn = 'get' . Inflector::classify($name); if (method_exists($this, $fn)) { return $this->{$fn}(); } else { throw new \OutOfBoundsException("getter '{$fn}' does not exist"); } }
/** * @param $tname * @return string */ protected function table2model($tname) { return $this->prefix . Inflector::classify($tname); }
public function testClassify() { $this->assertEquals('TableName', \Dja\Util\Inflector::classify('table_name')); }
/** * @param \ReflectionClass $refl */ protected function collectGettersSetters(\ReflectionClass $refl) { foreach (array_keys($this->fieldsTmp) as $fName) { $cc = Inflector::classify($fName); $getter = 'get' . $cc; if ($refl->hasMethod($getter)) { $this->gettersAndSetters['get'][$fName] = $getter; } $setter = 'set' . $cc; if ($refl->hasMethod($setter)) { $this->gettersAndSetters['set'][$fName] = $setter; } } }