/** * Testing the setSize method to see if validation fails. * * @since 1.0 */ public function testSetSizeInvalid() { $this->dbl1 = new Double(); $this->dbl1->setSize(2); try { $this->dbl1->setValue(200); $this->fail('testing passing invalid data to setValue'); } catch (IllegalArguementException $e) { $this->assertEquals('Not a valid double value!', $e->getMessage(), 'testing passing invalid data to setValue'); } }
/** * Set the Flattening for this Reference Ellipsoid object * This will nullify the Semi-Minor (Polar) Axis, * and force a recalculation from the Semi-Major (Equatorial) axis and the specified flattening * * @param integer|float $flattening Flattening to use for this ellipsoid * @throws Exception */ public function setFlattening($flattening = null) { if (is_null($flattening)) { throw new Exception('Missing Flattening value'); } elseif (!is_numeric($flattening)) { throw new Exception('Flattening is not a numeric value'); } $this->inverseFlattening = (double) 1 / $flattening; $this->semiMinorAxis->setValue(); $this->dirty = true; return $this; }