/** * Obtiene el arreglo de excepciones configuradas in el fichero primero yml y si no está xml * * @param $direccionFile * @return array * @throws \InvalidArgumentException En caso de no encontrar el fichero o no estar bien estructurado. */ public function getArrayExcepcionesInFile($direccionFile) { $locator = new FileLocator($direccionFile); try { $loader = new YamlFileReader($locator); $locator->locate("excepciones.yml"); $excepciones = $loader->load('excepciones.yml'); return $excepciones['excepciones']; } catch (\InvalidArgumentException $exc) { try { $loader = new XmlFileReader($locator); $locator->locate("excepciones.xml"); $excepciones = $loader->load('excepciones.xml'); return $excepciones; } catch (\InvalidArgumentException $exc) { throw $exc; } } }
public function testSupports() { $loader = new XmlFileReader(new FileLocator()); $this->assertTrue($loader->supports('foo.xml'), '->supports() returns true if the resource is loadable'); $this->assertFalse($loader->supports('foo.foo'), '->supports() returns true if the resource is loadable'); }