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


PHP Assert::isNotNull方法代码示例

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


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

示例1: setValue

 /**
  * @throws WrongArgumentException
  * @return IdentifiablePrimitive
  **/
 public function setValue($value)
 {
     $className = $this->className;
     Assert::isNotNull($this->className);
     Assert::isTrue($value instanceof $className);
     return parent::setValue($value);
 }
开发者ID:justthefish,项目名称:hesper,代码行数:11,代码来源:IdentifiablePrimitive.php

示例2: rebind

 public function rebind($name, $object)
 {
     Assert::isNotNull($object);
     $this->map[$name] = $object;
     $this->reverseMap[spl_object_hash($object)] = $name;
     return $this;
 }
开发者ID:justthefish,项目名称:hesper,代码行数:7,代码来源:DirectoryContext.php

示例3: getStream

 /**
  * @return FileInputStream
  **/
 private function getStream()
 {
     if (!$this->stream) {
         Assert::isNotNull($this->queue->getFileName());
         $this->stream = FileInputStream::create($this->queue->getFileName())->seek($this->queue->getOffset());
     }
     return $this->stream;
 }
开发者ID:justthefish,项目名称:hesper,代码行数:11,代码来源:TextFileReceiver.php

示例4: getStream

 private function getStream()
 {
     if (!$this->stream) {
         Assert::isNotNull($this->queue->getFileName());
         $this->stream = FileOutputStream::create($this->queue->getFileName(), true);
     }
     return $this->stream;
 }
开发者ID:justthefish,项目名称:hesper,代码行数:8,代码来源:TextFileSender.php

示例5: getRequestGetter

 public function getRequestGetter()
 {
     Assert::isNotNull($this->requestType);
     if (!$this->requestGetter) {
         $this->requestGetter = self::$requestGetterMap[$this->requestType->getId()];
     }
     return $this->requestGetter;
 }
开发者ID:justthefish,项目名称:hesper,代码行数:8,代码来源:ProxyController.php

示例6: validate

 /**
  * @return ArgumentParser
  **/
 public function validate()
 {
     Assert::isNotNull($this->result);
     $this->form->import($this->result);
     if ($errors = $this->form->getErrors()) {
         throw new WrongArgumentException("\nArguments wrong:\n" . print_r($errors, true));
     }
     return $this;
 }
开发者ID:justthefish,项目名称:hesper,代码行数:12,代码来源:ArgumentParser.php

示例7: disablePrefix

 /**
  * @return MultiPrefixPhpViewResolver
  **/
 public function disablePrefix($alias = null, $disabled = true)
 {
     if (!$alias) {
         $alias = $this->lastAlias;
     }
     Assert::isNotNull($alias, 'nothing to disable');
     Assert::isIndexExists($this->prefixes, $alias, 'no such alias: ' . $alias);
     $this->disabled[$alias] = $disabled;
     return $this;
 }
开发者ID:justthefish,项目名称:hesper,代码行数:13,代码来源:MultiPrefixPhpViewResolver.php

示例8: makeTag

 public static function makeTag(SgmlToken $tag)
 {
     if ($tag instanceof Cdata) {
         $result = $tag->getData();
     } elseif ($tag instanceof SgmlIgnoredTag) {
         Assert::isNotNull($tag->getId());
         $result = '<' . $tag->getId() . $tag->getCdata()->getData() . $tag->getEndMark() . '>';
     } elseif ($tag instanceof SgmlOpenTag) {
         Assert::isNotNull($tag->getId());
         $attributes = self::getAttributes($tag);
         $result = '<' . $tag->getId() . ($attributes ? ' ' . $attributes : null) . ($tag->isEmpty() ? '/' : null) . '>';
     } elseif ($tag instanceof SgmlEndTag) {
         $result = '</' . $tag->getId() . '>';
     } else {
         throw new WrongArgumentException("don't know how to assemble tag class '" . get_class($tag) . "'");
     }
     return $result;
 }
开发者ID:justthefish,项目名称:hesper,代码行数:18,代码来源:HtmlAssembler.php

示例9: merge

 public function merge(Identifiable $object, $cacheOnly = true)
 {
     Assert::isNotNull($object->getId());
     $this->checkObjectType($object);
     $old = Cache::worker($this)->getCachedById($object->getId());
     if (!$old) {
         // unlikely
         if ($cacheOnly) {
             return $this->save($object);
         } else {
             $old = Cache::worker($this)->getById($object->getId());
         }
     }
     if ($object === $old) {
         return $this->save($object);
     }
     return $this->unite($object, $old);
 }
开发者ID:justthefish,项目名称:hesper,代码行数:18,代码来源:StorableDAO.php

示例10: __construct

 public function __construct()
 {
     $wsdlUrl = $this->getWsdlUrl();
     Assert::isNotNull($wsdlUrl);
     $this->soapClient = new \SoapClient($wsdlUrl, ['soap_version' => SOAP_1_1, 'classmap' => $this->classMap(), 'trace' => true, 'exceptions' => true]);
 }
开发者ID:justthefish,项目名称:hesper,代码行数:6,代码来源:PrototypedSoapClient.php

示例11: makeResponse

 /**
  * @return CurlHttpClient
  **/
 protected function makeResponse($handle, CurlHttpResponse $response)
 {
     Assert::isNotNull($handle);
     $httpCode = curl_getinfo($handle, CURLINFO_HTTP_CODE);
     try {
         $response->setStatus(new HttpStatus($httpCode));
     } catch (MissingElementException $e) {
         throw new NetworkException('curl error, strange http code: ' . $httpCode);
     }
     return $this;
 }
开发者ID:avid,项目名称:hesper,代码行数:14,代码来源:CurlHttpClient.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([$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([$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:justthefish,项目名称:hesper,代码行数:72,代码来源:ProtoDAO.php

示例13: process

 /**
  * @return JoinCapableQuery
  **/
 public function process(Criteria $criteria, JoinCapableQuery $query)
 {
     Assert::isNotNull($this->property);
     return $query->get(SQLFunction::create($this->getFunctionName(), $criteria->getDao()->guessAtom($this->property, $query))->setAlias($this->alias));
 }
开发者ID:justthefish,项目名称:hesper,代码行数:8,代码来源:AggregateProjection.php

示例14: fillQuery

 /**
  * @return InsertOrUpdateQuery
  **/
 public function fillQuery(InsertOrUpdateQuery $query, Prototyped $object, Prototyped $old = null)
 {
     if ($old) {
         if ($object instanceof Identifiable) {
             Assert::isNotNull($object->getId());
             Assert::isTypelessEqual($object->getId(), $old->getId(), 'cannot merge different objects');
         }
     }
     foreach ($this->getPropertyList() as $property) {
         $property->fillQuery($query, $object, $old);
     }
     return $query;
 }
开发者ID:justthefish,项目名称:hesper,代码行数:16,代码来源:AbstractProtoClass.php

示例15: poorReference

 public function poorReference($url)
 {
     Assert::isNotNull($this->base, 'set base url first');
     $parsedUrl = HttpUrl::create()->parse($url);
     return $this->base->transform($parsedUrl);
 }
开发者ID:justthefish,项目名称:hesper,代码行数:6,代码来源:ApplicationUrl.php


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