Ejemplo n.º 1
0
 /**
  * Create an instance of a Mathematician adapter instance
  *
  * @param mixed $number
  * @param int $scale
  * @static
  * @access public
  * @return AdapterInterface
  */
 public static function factory($number, $scale = 0)
 {
     if (is_float($number) || (int) $scale !== 0) {
         // TODO: Floating-point/decimal adapter
         throw new AdapterSupportException('Floating point adapter not yet implemented');
     } else {
         return Integer::factory($number);
     }
 }
Ejemplo n.º 2
0
 public function testFactory()
 {
     $result = Integer::factory(PHP_INT_MAX);
     $this->assertInternalType('object', $result);
     $this->assertTrue($result instanceof AdapterInterface);
 }