/** * This method returns the current object. * * @access public * @final * @return mixed the current object */ public final function current() { return $this->xs->item(); }
/** * This method compares the specified object with the current object for order. * * @access public * @static * @param IOption\Type $xs the left operand * @param IOption\Type $ys the object to be compared * @return ITrit\Type whether the current object is less than, * equal to, or greater than the specified * object */ public static function compare(IOption\Type $xs, IOption\Type $ys) : ITrit\Type { $x = $xs->__isDefined(); $y = $ys->__isDefined(); if (!$x && $y) { return ITrit\Type::negative(); } if (!$x && !$y) { return ITrit\Type::zero(); } if ($x && !$y) { return ITrit\Type::positive(); } $x = $xs->item(); $y = $ys->item(); if ($x === null && $y !== null) { return ITrit\Type::negative(); } if ($x === null && $y === null) { return ITrit\Type::zero(); } if ($x !== null && $y === null) { return ITrit\Type::positive(); } if ($x instanceof Core\Comparable\Type) { return call_user_func_array(array($x, 'compare'), array($y)); } return IString\Module::compare(Core\Module::hashCode($x), Core\Module::hashCode($y)); }