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


PHP Type::equals方法代码示例

本文整理汇总了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);
 }
开发者ID:jdpanderson,项目名称:Tailor,代码行数:13,代码来源:Column.php

示例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;
 }
开发者ID:Tjoosten,项目名称:Tuli,代码行数:28,代码来源:TypeResolver.php

示例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;
 }
开发者ID:ircmaxell,项目名称:php-types,代码行数:62,代码来源:TypeResolver.php


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