示例#1
0
 /**
  * This method evaluates whether the specified object is identical to the current object.
  *
  * @access public
  * @static
  * @param IOption\Type $xs                                  the left operand
  * @param Core\Type $ys                                     the object to be evaluated
  * @return IBool\Type                                       whether the specified object is identical
  *                                                          to the current object
  */
 public static function id(IOption\Type $xs, Core\Type $ys) : IBool\Type
 {
     if ($ys !== null) {
         if ($xs->__typeOf() === $ys->__typeOf()) {
             if ($ys instanceof IOption\Some\Type) {
                 $x = $xs->item();
                 $y = $ys->item();
                 if ($x === null) {
                     return IBool\Type::box($y === null);
                 } else {
                     if ($x instanceof Core\Equality\Type) {
                         return $x->id($y);
                     }
                 }
                 return IBool\Type::box(spl_object_hash($x) === spl_object_hash($y));
             } else {
                 if ($ys instanceof IOption\None\Type) {
                     return IBool\Type::true();
                 }
             }
         }
     }
     return IBool\Type::false();
 }