Ejemplo n.º 1
0
 /**
  * @param string $path
  * @param int|null $format
  * @return $this
  */
 protected function loadConfiguration($path, $format = null)
 {
     $readerRegistry = ReaderRegistry::getDefaultInstance();
     $reader = $readerRegistry->getInstanceForFormat($format ?: Format::guessFormatFromPath($path));
     $this->configuration = $reader->readFromFile($path);
     return $this;
 }
Ejemplo n.º 2
0
 /**
  * @return array
  * @throws TaskException
  */
 protected function readFromBoilerplate()
 {
     if (is_string($this->boilerplatePath)) {
         if (!file_exists($this->boilerplatePath) || !is_file($this->boilerplatePath)) {
             throw new TaskException($this, 'Cannot open boilerplate file ' . $this->boilerplatePath);
         }
         $format = $this->boilerplateFormat ?: Format::guessFormatFromPath($this->boilerplatePath);
         $reader = $this->getReaderRegistry()->getInstanceForFormat($format);
         return $reader->readFromFile($this->boilerplatePath);
     } else {
         return array();
     }
 }
Ejemplo n.º 3
0
 /**
  * @test
  * @expectedException \NordCode\RoboParameters\Exception\FormatException
  */
 public function testGuessFormatFormPathFailsForUnknownFormat()
 {
     Format::guessFormatFromPath('nope');
 }