本文整理汇总了PHP中Hesper\Core\Base\Assert::isFalse方法的典型用法代码示例。如果您正苦于以下问题:PHP Assert::isFalse方法的具体用法?PHP Assert::isFalse怎么用?PHP Assert::isFalse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hesper\Core\Base\Assert
的用法示例。
在下文中一共展示了Assert::isFalse方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add
/**
* @throws WrongArgumentException
* @return Form
**/
public function add(BasePrimitive $prm)
{
$name = $prm->getName();
Assert::isFalse(isset($this->primitives[$name]), 'i am already exists!');
$this->primitives[$name] = $prm;
return $this;
}
示例2: getOpenPoint
/**
* @throws WrongArgumentException
* @return LogicalChain
**/
public static function getOpenPoint($left, $right, $point)
{
Assert::isFalse($point === null, 'how can i build logic from emptyness?');
$point = new DBValue($point);
$chain = new LogicalChain();
$chain->expOr(Expression::orBlock(Expression::andBlock(Expression::notNull($left), Expression::notNull($right), Expression::between($point, $left, $right)), Expression::andBlock(Expression::isNull($left), Expression::ltEq($point, $right)), Expression::andBlock(Expression::isNull($right), Expression::ltEq($left, $point)), Expression::andBlock(Expression::isNull($left), Expression::isNull($right))));
return $chain;
}
示例3: addColumn
/**
* @throws WrongArgumentException
* @return DBTable
**/
public function addColumn(DBColumn $column)
{
$name = $column->getName();
Assert::isFalse(isset($this->columns[$name]), "column '{$name}' already exist");
$this->order[] = $this->columns[$name] = $column;
$column->setTable($this);
return $this;
}
示例4: addTable
/**
* @throws WrongArgumentException
* @return DBSchema
**/
public function addTable(DBTable $table)
{
$name = $table->getName();
Assert::isFalse(isset($this->tables[$name]), "table '{$name}' already exist");
$this->tables[$table->getName()] = $table;
$this->order[] = $name;
return $this;
}
示例5: add
/**
* @return ProjectionChain
**/
public function add(ObjectProjection $projection, $name = null)
{
if ($name) {
Assert::isFalse(isset($this->list[$name]));
$this->list[$name] = $projection;
} else {
$this->list[] = $projection;
}
return $this;
}
示例6: run
/**
* @throws BaseException
* @return ModelAndView
**/
public function run(Prototyped $subject, Form $form, HttpRequest $request)
{
Assert::isFalse($this->running, 'command already running');
Assert::isTrue($subject instanceof DAOConnected);
$this->transaction = InnerTransaction::begin($subject->dao());
try {
$mav = $this->command->run($subject, $form, $request);
$this->running = true;
return $mav;
} catch (BaseException $e) {
$this->transaction->rollback();
throw $e;
}
}
示例7: split
public function split()
{
Assert::isFalse($this->isOpen(), "open range can't be splitted");
$dates = [];
$start = new Date($this->start->getDayStartStamp());
$endStamp = $this->end->getDayEndStamp();
for ($current = $start; $current->toStamp() < $endStamp; $current->modify('+1 day')) {
$dates[] = new Date($current->getDayStartStamp());
}
return $dates;
}
示例8: processClasses
/**
* @return MetaConfiguration
**/
private function processClasses(\SimpleXMLElement $xml, $metafile, $generate)
{
$attrs = $xml->classes->attributes();
if (!isset($attrs['namespace'])) {
throw new WrongStateException('Element classes should contain a `namespace` attribute');
}
$namespace = strval($attrs['namespace']);
foreach ($xml->classes[0] as $xmlClass) {
$name = (string) $xmlClass['name'];
Assert::isFalse(isset($this->classes[$name]), 'class name collision found for ' . $name);
$class = new MetaClass($name, $namespace);
if (isset($xmlClass['source'])) {
$class->setSourceLink((string) $xmlClass['source']);
}
if (isset($xmlClass['table'])) {
$class->setTableName((string) $xmlClass['table']);
}
if (isset($xmlClass['type'])) {
$type = (string) $xmlClass['type'];
if ($type == 'spooked') {
$this->getOutput()->warning($class->getName(), true)->warningLine(': uses obsoleted "spooked" type.')->newLine();
}
$class->setType(new MetaClassType((string) $xmlClass['type']));
}
// lazy existence checking
if (isset($xmlClass['extends'])) {
$this->liaisons[$class->getName()] = (string) $xmlClass['extends'];
}
// populate implemented interfaces
foreach ($xmlClass->implement as $xmlImplement) {
$class->addInterface((string) $xmlImplement['interface']);
}
if (isset($xmlClass->properties[0]->identifier)) {
$id = $xmlClass->properties[0]->identifier;
if (!isset($id['name'])) {
$name = 'id';
} else {
$name = (string) $id['name'];
}
if (!isset($id['type'])) {
$type = 'BigInteger';
} else {
$type = (string) $id['type'];
}
$property = $this->makeProperty($name, $type, $class, (string) $id['size']);
if (isset($id['column'])) {
$property->setColumnName((string) $id['column']);
} elseif ($property->getType() instanceof ObjectType && !$property->getType()->isGeneric()) {
$property->setColumnName($property->getConvertedName() . '_id');
} else {
$property->setColumnName($property->getConvertedName());
}
$property->setIdentifier(true)->required();
$class->addProperty($property);
unset($xmlClass->properties[0]->identifier);
}
$class->setPattern($this->guessPattern((string) $xmlClass->pattern['name']));
if ((string) $xmlClass->pattern['fetch'] == 'cascade') {
$class->setFetchStrategy(FetchStrategy::cascade());
}
if ($class->getPattern() instanceof InternalClassPattern) {
Assert::isTrue($metafile === HESPER_META . 'internal.xml', 'internal classes can be defined only in onPHP, sorry');
} elseif ($class->getPattern() instanceof SpookedClassPattern || $class->getPattern() instanceof SpookedEnumerationPattern || $class->getPattern() instanceof SpookedEnumPattern || $class->getPattern() instanceof SpookedRegistryPattern) {
$class->setType(new MetaClassType(MetaClassType::CLASS_SPOOKED));
}
// populate properties
foreach ($xmlClass->properties[0] as $xmlProperty) {
$property = $this->makeProperty((string) $xmlProperty['name'], (string) $xmlProperty['type'], $class, (string) $xmlProperty['size']);
if (isset($xmlProperty['column'])) {
$property->setColumnName((string) $xmlProperty['column']);
} elseif ($property->getType() instanceof ObjectType && !$property->getType()->isGeneric()) {
if (isset($this->classes[$property->getType()->getClassName()]) && $property->getType()->getClass()->getPattern() instanceof InternalClassPattern) {
throw new UnimplementedFeatureException('you can not use internal classes directly atm');
}
$property->setColumnName($property->getConvertedName() . '_id');
} else {
$property->setColumnName($property->getConvertedName());
}
if ((string) $xmlProperty['required'] == 'true') {
$property->required();
}
if (isset($xmlProperty['identifier'])) {
throw new WrongArgumentException('obsoleted identifier description found in ' . "{$class->getName()} class;\n" . 'you must use <identifier /> instead.');
}
if (!$property->getType()->isGeneric() && !$class->getPattern() instanceof ValueObjectPattern) {
if (!isset($xmlProperty['relation'])) {
throw new MissingElementException('relation should be set for non-generic ' . "property '{$property->getName()}' type '" . get_class($property->getType()) . "'" . " of '{$class->getName()}' class");
} else {
$property->setRelation(MetaRelation::makeFromName((string) $xmlProperty['relation']));
if ($fetch = (string) $xmlProperty['fetch']) {
Assert::isTrue($property->getRelationId() == MetaRelation::ONE_TO_ONE, 'fetch mode can be specified
only for OneToOne relations');
if ($fetch == 'lazy') {
$property->setFetchStrategy(FetchStrategy::lazy());
} elseif ($fetch == 'cascade') {
$property->setFetchStrategy(FetchStrategy::cascade());
} else {
//.........这里部分代码省略.........
示例9: resolveViewName
/**
* @return SimplePhpView
**/
public function resolveViewName($viewName)
{
Assert::isFalse($this->prefixes === [], 'specify at least one prefix');
if ($prefix = $this->findPrefix($viewName)) {
return $this->makeView($prefix, $viewName);
}
if (!$this->findPrefix($viewName, false)) {
throw new WrongArgumentException('can not resolve view: ' . $viewName);
}
return EmptyView::create();
}