field = $field; $this->value = $value; if ($this->classExists()) { $ref = new ReflectionClass($this->getClassName()); $result = $ref->newInstance($field, $value, $number); } else { $result = new DbField($field, $value, $number); } return $result; } private function getClassName() { return 'DbField'.$this->field; } private function getFileName() { return dirname(__FILE__)."/DbField/".$this->getClassName().".class.php"; } private function classExists() { if ( $this->fileExists() ) { require_once($this->getFileName()); } return class_exists($this->getClassName()); } private function fileExists() { return file_exists($this->getFileName()); } }