/** * This method enforces that the specified class is a covariant. * * @access public * @static * @param IUnit\Type $x the class to be evaluated * @return IUnit\Type the class */ public static function covariant(IUnit\Type $x = null) : IUnit\Type { if ($x === null) { return IUnit\Type::instance(); } return $x; }
/** * This method tests the "toString" method. */ public function test_toString() { $p0 = IUnit\Type::instance()->toString(); $e0 = 'null'; $this->assertInstanceOf('\\Saber\\Data\\IString\\Type', $p0); $this->assertSame($e0, $p0->unbox()); }
/** * This method returns the latter value should the former value evaluates * to null. * * @access public * @static * @param IUnit\Type $x the value to be evaluated * @param IUnit\Type $y the default value * @return IUnit\Type the result */ public static function nvl(IUnit\Type $x = null, IUnit\Type $y = null) : IUnit\Type { return IUnit\Type::instance(); }
/** * This method returns an item after removing it from the collection. * * @access public * @final * @param Core\Type $key the key associated with the * item to be removed * @return Core\Type the item removed */ public final function removeKey(Core\Type $key) : Core\Type { $hashCode = $key->__hashCode(); $item = IUnit\Type::instance(); if (array_key_exists($hashCode, $this->value)) { $bucket = $this->value[$hashCode]; $buffer = array(); foreach ($bucket as $entry) { if ($entry->first()->__ne($key)) { $buffer[] = $entry; } else { $item = $entry->second(); } } if (empty($buffer)) { unset($this->value[$hashCode]); } else { $this->value[$hashCode] = $buffer; } } return $item; }
/** * This method tests the "min" method. */ public function test_min() { $p0 = IUnit\Module::min(IUnit\Type::instance(), IUnit\Type::instance()); $this->assertInstanceOf('\\Saber\\Data\\IUnit\\Type', $p0); $this->assertNull($p0->unbox()); }
/** * This method provides the data for testing that an item exists in the collection. * * @return array */ public function dataItem() { $data = array(array(array(IString\Type::box('key0')), array(IInt32\Type::zero())), array(array(IString\Type::box('key1')), array(IInt32\Type::one())), array(array(IString\Type::box('key2')), array(IInt32\Type::box(2))), array(array(IString\Type::box('key3')), array(IUnit\Type::instance()))); return $data; }
/** * This method returns a right node containing the specified value. * * @access public * @static * @param Core\Type $x the object to be boxed * @return IEither\Right\Type a right node */ public static function right(Core\Type $x = null) : IEither\Right\Type { if ($x === null) { $x = IUnit\Type::instance(); } return new IEither\Right\Type($x); }