本文整理汇总了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);
}
示例2: rebind
public function rebind($name, $object)
{
Assert::isNotNull($object);
$this->map[$name] = $object;
$this->reverseMap[spl_object_hash($object)] = $name;
return $this;
}
示例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;
}
示例4: getStream
private function getStream()
{
if (!$this->stream) {
Assert::isNotNull($this->queue->getFileName());
$this->stream = FileOutputStream::create($this->queue->getFileName(), true);
}
return $this->stream;
}
示例5: getRequestGetter
public function getRequestGetter()
{
Assert::isNotNull($this->requestType);
if (!$this->requestGetter) {
$this->requestGetter = self::$requestGetterMap[$this->requestType->getId()];
}
return $this->requestGetter;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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]);
}
示例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;
}
示例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
}
示例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));
}
示例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;
}
示例15: poorReference
public function poorReference($url)
{
Assert::isNotNull($this->base, 'set base url first');
$parsedUrl = HttpUrl::create()->parse($url);
return $this->base->transform($parsedUrl);
}