当前位置: 首页>>代码示例>>PHP>>正文


PHP Assert::classExists方法代码示例

本文整理汇总了PHP中Assert::classExists方法的典型用法代码示例。如果您正苦于以下问题:PHP Assert::classExists方法的具体用法?PHP Assert::classExists怎么用?PHP Assert::classExists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Assert的用法示例。


在下文中一共展示了Assert::classExists方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: of

 /**
  * @throws WrongArgumentException
  * @return PrimitiveForm
  * 
  * @deprecated You should use ofProto() instead
  **/
 public function of($className)
 {
     Assert::classExists($className);
     $protoClass = EntityProto::PROTO_CLASS_PREFIX . $className;
     Assert::classExists($protoClass);
     return $this->ofProto(Singleton::getInstance($protoClass));
 }
开发者ID:onphp-framework,项目名称:onphp-framework,代码行数:13,代码来源:PrimitiveForm.class.php

示例2: __construct

 public function __construct($root, $path)
 {
     Assert::isString($path, 'non-string path given');
     if (is_object($root)) {
         $className = get_class($root);
     } else {
         Assert::classExists($root);
         $className = $root;
     }
     $this->root = $className;
     $this->path = $path;
     $this->fetchHelpers($className);
     $proto = self::$protos[$className];
     $path = explode('.', $path);
     for ($i = 0, $size = count($path); $i < $size; ++$i) {
         $this->properties[$i] = $property = $proto->getPropertyByName($path[$i]);
         if ($className = $property->getClassName()) {
             $this->fetchHelpers($className);
             $proto = self::$protos[$className];
         } elseif ($i < $size) {
             continue;
         } else {
             throw new WrongArgumentException('corrupted path');
         }
     }
 }
开发者ID:onphp-framework,项目名称:onphp-framework,代码行数:26,代码来源:PropertyPath.class.php

示例3: ofBase

 /**
  * @throws WrongArgumentException
  * @return PrimitivePolymorphicIdentifier
  **/
 public function ofBase($className)
 {
     Assert::classExists($className);
     Assert::isInstance($className, 'DAOConnected', "class '{$className}' must implement DAOConnected interface");
     $this->baseClassName = $className;
     return $this;
 }
开发者ID:onphp-framework,项目名称:onphp-framework,代码行数:11,代码来源:PrimitivePolymorphicIdentifier.class.php

示例4: of

 /**
  * @throws WrongArgumentException
  * @return PrimitiveEnum
  **/
 public function of($class)
 {
     $className = $this->guessClassName($class);
     Assert::classExists($className);
     Assert::isInstance($className, 'Enum');
     $this->className = $className;
     return $this;
 }
开发者ID:onphp-framework,项目名称:onphp-framework,代码行数:12,代码来源:PrimitiveEnum.class.php

示例5: dropWith

 public function dropWith($worker)
 {
     Assert::classExists($worker);
     if ($this->modifiedIds) {
         $workerObject = new $worker($this->dao);
         $workerObject->uncacheByIds($this->modifiedIds);
         $this->modifiedIds = array();
     }
     return $this;
 }
开发者ID:rero26,项目名称:onphp-framework,代码行数:10,代码来源:DalayedDropDaoWorker.class.php

示例6: setDefaultLocker

 public static function setDefaultLocker($name)
 {
     Assert::classExists($name);
     self::$lockerName = $name;
     self::$locker = Singleton::getInstance($name);
 }
开发者ID:onphp-framework,项目名称:onphp-framework,代码行数:6,代码来源:SemaphorePool.class.php

示例7: spawn

 /**
  * @return BasePrimitive
  **/
 public static function spawn($primitive, $name)
 {
     Assert::classExists($primitive);
     return new $primitive($name);
 }
开发者ID:rero26,项目名称:onphp-framework,代码行数:8,代码来源:Primitive.class.php

示例8: setDefaultHandler

 public static function setDefaultHandler($handler)
 {
     Assert::classExists($handler);
     self::$defaultHandler = $handler;
 }
开发者ID:onphp-framework,项目名称:onphp-framework,代码行数:5,代码来源:VoodooDaoWorker.class.php

示例9: __construct

 public function __construct($controllerName)
 {
     Assert::classExists($controllerName);
     $this->url = $controllerName;
 }
开发者ID:onphp-framework,项目名称:onphp-framework,代码行数:5,代码来源:RedirectToView.class.php

示例10: toValue

 public function toValue(ProtoDAO $dao = null, $array, $prefix = null)
 {
     $raw = $array[$prefix . $this->columnName];
     if ($this->type == 'binary') {
         return DBPool::getByDao($dao)->getDialect()->unquoteBinary($raw);
     }
     if ($this->className == 'HttpUrl') {
         return HttpUrl::create()->parse($raw);
     }
     if (!$this->identifier && $this->generic && $this->className) {
         return call_user_func(array($this->className, 'create'), $raw);
     } elseif (!$this->identifier && $this->className) {
         // BOVM: prevents segfault on >=php-5.2.5
         Assert::classExists($this->className);
         if (!is_subclass_of($this->className, 'Enumeration')) {
             $remoteDao = call_user_func(array($this->className, 'dao'));
             $joinPrefix = $remoteDao->getJoinPrefix($this->columnName, $prefix);
             $joined = $this->strategyId == FetchStrategy::JOIN || isset($array[$joinPrefix . $remoteDao->getIdName()]);
             if ($joined) {
                 return $remoteDao->makeObject($array, $joinPrefix);
             } else {
                 // will be fetched later
                 // by AbstractProtoClass::fetchEncapsulants
                 $object = new $this->className();
                 $object->setId($raw);
                 return $object;
             }
         } else {
             return new $this->className($raw);
         }
     }
     // veeeeery "special" handling, by tradition.
     // MySQL returns 0/1, others - t/f
     if ($this->type == 'boolean') {
         return (bool) strtr($raw, array('f' => null));
     }
     return $raw;
 }
开发者ID:rero26,项目名称:onphp-framework,代码行数:38,代码来源:LightMetaProperty.class.php

示例11: setDefaultWorker

 public static function setDefaultWorker($worker)
 {
     Assert::classExists($worker);
     self::$worker = $worker;
 }
开发者ID:onphp-framework,项目名称:onphp-framework,代码行数:5,代码来源:Cache.class.php

示例12: processPath

 private function processPath(AbstractProtoClass $proto, $probablyPath, JoinCapableQuery $query, $table, $parentRequired = true, $prefix = null)
 {
     $path = explode('.', $probablyPath);
     try {
         $property = $proto->getPropertyByName($path[0]);
     } catch (MissingElementException $e) {
         // oh, it's a value, not a property
         return new DBValue($probablyPath);
     }
     unset($path[0]);
     Assert::isTrue($property->getRelationId() != null && !$property->isGenericType());
     Assert::classExists($property->getClassName());
     // checking whether we're playing with value object
     if (!method_exists($property->getClassName(), 'dao')) {
         if (method_exists($property->getClassName(), 'proto') && count($path) > 1) {
             return $this->processPath($property->getProto(), implode('.', $path), $query, $table);
         } else {
             return $this->guessAtom(implode('.', $path), $query, $table, $prefix);
         }
     } else {
         $propertyDao = call_user_func(array($property->getClassName(), 'dao'));
         Assert::isNotNull($propertyDao, 'can not find target dao for "' . $property->getName() . '" property at "' . get_class($proto) . '"');
     }
     $alias = $propertyDao->getJoinName($property->getColumnName(), $prefix);
     if ($property->getRelationId() == MetaRelation::ONE_TO_MANY || $property->getRelationId() == MetaRelation::MANY_TO_MANY) {
         $remoteName = $property->getClassName();
         $selfName = $this->getObjectName();
         $self = new $selfName();
         $getter = $property->getGetter();
         $dao = call_user_func(array($remoteName, 'dao'));
         if ($property->getRelationId() == MetaRelation::MANY_TO_MANY) {
             $helperTable = $self->{$getter}()->getHelperTable();
             $helperAlias = $helperTable;
             if (!$query->hasJoinedTable($helperAlias)) {
                 $logic = Expression::eq(DBField::create($this->getIdName(), $table), DBField::create($self->{$getter}()->getParentIdField(), $helperAlias));
                 if ($property->isRequired()) {
                     $query->join($helperTable, $logic, $helperAlias);
                 } else {
                     $query->leftJoin($helperTable, $logic, $helperAlias);
                 }
             }
             $logic = Expression::eq(DBField::create($propertyDao->getIdName(), $alias), DBField::create($self->{$getter}()->getChildIdField(), $helperAlias));
         } else {
             $logic = Expression::eq(DBField::create($self->{$getter}()->getParentIdField(), $alias), DBField::create($this->getIdName(), $table));
         }
         if (!$query->hasJoinedTable($alias)) {
             if ($property->isRequired() && $parentRequired) {
                 $query->join($dao->getTable(), $logic, $alias);
             } else {
                 $query->leftJoin($dao->getTable(), $logic, $alias);
             }
         }
     } else {
         // OneToOne, lazy OneToOne
         // prevents useless joins
         if (isset($path[1]) && count($path) == 1 && $path[1] == $propertyDao->getIdName()) {
             return new DBField($property->getColumnName(), $table);
         }
         if (!$query->hasJoinedTable($alias)) {
             $logic = Expression::eq(DBField::create($property->getColumnName(), $table), DBField::create($propertyDao->getIdName(), $alias));
             if ($property->isRequired() && $parentRequired) {
                 $query->join($propertyDao->getTable(), $logic, $alias);
             } else {
                 $query->leftJoin($propertyDao->getTable(), $logic, $alias);
             }
         }
     }
     if ($path) {
         return $propertyDao->guessAtom(implode('.', $path), $query, $alias, $property->isRequired() && $parentRequired, $propertyDao->getJoinPrefix($property->getColumnName(), $prefix));
     }
     // ok, we're done
 }
开发者ID:onphp-framework,项目名称:onphp-framework,代码行数:72,代码来源:ProtoDAO.class.php


注:本文中的Assert::classExists方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。