/**
  * {@inheritdoc}
  */
 public function parse(Configuration $configuration = null)
 {
     if (is_null($configuration)) {
         $configuration = new Configuration();
     }
     // Suppress error to handle it
     if (!($ini = @parse_ini_string($this->text, true, INI_SCANNER_RAW))) {
         throw new ParsingFailed('Given data cannot be parsed as INI string');
     }
     $sections = $this->parseArray($ini);
     $configuration->addSections($sections);
     return $configuration;
 }
 /**
  * {@inheritdoc}
  */
 public function parse(Configuration $configuration = null)
 {
     if (!is_file($this->file)) {
         throw new ParsingFailed(sprintf('File "%s" not found', $this->file));
     }
     if (is_null($configuration)) {
         $configuration = new Configuration();
     }
     // Suppress error to handle it
     if (!($ini = @parse_ini_file($this->file, true, INI_SCANNER_RAW))) {
         throw new ParsingFailed(sprintf('File "%s" cannot be parsed as INI', $this->file));
     }
     $sections = $this->parseArray($ini);
     $configuration->addSections($sections);
     return $configuration;
 }
 function it_parses_configuration(Flysystem $filesystem, Configuration $configuration)
 {
     $configuration->addSections(Argument::type('array'))->shouldBeCalled();
     $filesystem->read(Argument::type('string'))->willReturn("[supervisord]\nidentifier = supervisor");
     $this->parse($configuration);
 }
 function it_parses_configuration(Configuration $configuration)
 {
     $configuration->addSections(Argument::type('array'))->shouldBeCalled();
     $this->parse($configuration);
 }