/** * This method returns the value as an IInteger. Note: Using this method may result in * lost of precision. * * @access public * @static * @param ITrit\Type $x the object to be converted * @return IInteger\Type the value as an IInteger */ public static function toInteger(ITrit\Type $x) : IInteger\Type { return IInteger\Type::make($x->unbox()); }
/** * This method tests the "make" method. * * @dataProvider data_make */ public function test_make(array $provided, array $expected) { $p0 = IInteger\Type::make($provided[0]); $this->assertInstanceOf('\\Saber\\Data\\IInteger\\Type', $p0); $p1 = $p0->unbox(); $e1 = $expected[0]; $this->assertInternalType('string', $p1); $this->assertRegExp('/^[+-]?(0|([1-9][0-9]*))$/', $p1); $this->assertSame($e1, $p1); }