Esempio n. 1
0
 /**
  * @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");
     }
 }
Esempio n. 2
0
 /**
  * @param $tname
  * @return string
  */
 protected function table2model($tname)
 {
     return $this->prefix . Inflector::classify($tname);
 }
Esempio n. 3
0
 public function testClassify()
 {
     $this->assertEquals('TableName', \Dja\Util\Inflector::classify('table_name'));
 }
Esempio n. 4
0
 /**
  * @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;
         }
     }
 }