public function castToExchange($value, $type) { if (Caster::castExists($type, 'ExchangeFormat')) { $value = Caster::cast($value, 'ExchangeFormat'); } return $value; }
/** * @param $from * @param $to * @param $expected * * @dataProvider castExistsProvider */ public function testCastExists($from, $to, $expected) { $this->assertEquals($expected, Caster::castExists($from, $to)); }