コード例 #1
0
ファイル: LiskDAO.php プロジェクト: netcomtec/phabricator
 /**
  *  Build an empty object.
  *
  *  @return obj Empty object.
  */
 public function __construct()
 {
     $id_key = $this->getIDKey();
     if ($id_key) {
         $this->{$id_key} = null;
     }
     if ($this->getConfigOption(self::CONFIG_PARTIAL_OBJECTS)) {
         $this->resetDirtyFields();
         $this_class = get_class($this);
         if (empty(self::$__checkedClasses[$this_class])) {
             self::$__checkedClasses = true;
             if (PhabricatorEnv::getEnvConfig('lisk.check_property_methods')) {
                 $class = new ReflectionClass(get_class($this));
                 $methods = $class->getMethods();
                 $properties = $this->getProperties();
                 foreach ($methods as $method) {
                     $name = strtolower($method->getName());
                     if (!(strncmp($name, 'get', 3) && strncmp($name, 'set', 3))) {
                         $name = substr($name, 3);
                         $declaring_class_name = $method->getDeclaringClass()->getName();
                         if (isset($properties[$name]) && $declaring_class_name !== 'LiskDAO') {
                             throw new Exception("Cannot implement method {$method->getName()} in " . "{$declaring_class_name}.");
                         }
                     }
                 }
             }
         }
     }
 }