當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。