本文整理汇总了PHP中Type::equals方法的典型用法代码示例。如果您正苦于以下问题:PHP Type::equals方法的具体用法?PHP Type::equals怎么用?PHP Type::equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Type
的用法示例。
在下文中一共展示了Type::equals方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: equals
public function equals(Column $column)
{
foreach (['name', 'primary', 'sequence', 'null', 'unique', 'default'] as $prop) {
if ($this->{$prop} !== $column->{$prop}) {
return false;
}
}
/* If one, the other, or both aren't set, they're only equal if they're exactly equal */
if (!isset($this->type, $column->type)) {
return $this->type === $column->type;
}
return $this->type->equals($column->type);
}
示例2: resolves
public function resolves(Type $a, Type $b)
{
if ($a->equals($b)) {
return true;
}
if ($a->type === Type::TYPE_LONG && $b->type === Type::TYPE_DOUBLE) {
return true;
}
if ($a->type === Type::TYPE_USER && $b->type === Type::TYPE_USER) {
foreach ($b->userTypes as $bt) {
$bt = strtolower($bt);
foreach ($a->userTypes as $at) {
$at = strtolower($at);
if (!isset($this->components['resolves'][$bt][$at])) {
continue 2;
}
}
// We got here, means we found an B type that's resolved by all A types
return true;
}
// That means there is no A type that fully resolves at least one B type
return false;
}
if (($b->type & $a->type) === $a->type) {
return true;
}
return false;
}
示例3: resolves
public function resolves(Type $a, Type $b)
{
if ($a->equals($b)) {
return true;
}
if ($b->type === Type::TYPE_CALLABLE) {
return $this->resolves($a, $this->callableUnion);
}
if ($a->type === Type::TYPE_OBJECT && $b->type === Type::TYPE_OBJECT) {
return $this->checkUserTypes($a->userType, $b->userType);
}
if ($a->type === Type::TYPE_LONG && $b->type === Type::TYPE_DOUBLE) {
return true;
}
if ($a->type === Type::TYPE_ARRAY && $b->type === Type::TYPE_ARRAY) {
if (!$b->subTypes) {
return true;
}
if (!$a->subTypes) {
// We need a specific array
return false;
}
return $this->resolves($a->subTypes[0], $b->subTypes[0]);
}
if ($a->type === Type::TYPE_UNION) {
foreach ($a->subTypes as $st) {
if ($this->resolves($st, $b)) {
// All must resolve
return false;
}
}
return true;
}
if ($a->type === Type::TYPE_INTERSECTION) {
foreach ($a->subTypes as $st) {
if ($this->resolves($st, $b)) {
// At least one resolves it
return true;
}
}
return false;
}
if ($b->type === Type::TYPE_UNION) {
foreach ($b->subTypes as $st) {
if ($this->resolves($a, $st)) {
// At least one resolves it
return true;
}
}
return false;
}
if ($b->type === Type::TYPE_INTERSECTION) {
foreach ($b->subTypes as $st) {
if (!$this->resolves($a, $st)) {
// At least one resolves it
return false;
}
}
return true;
}
return false;
}