Beispiel #1
0
 /**
  * IniFile constructor.
  *
  * @param string|null $file
  *
  * @throws FileException
  */
 public function __construct($file = null)
 {
     $rawContents = '';
     $this->parser = IniParser::i();
     if (!is_null($file)) {
         $this->file = IniFileLocator::i()->locate($file);
         $rawContents = file_get_contents($this->file);
     }
     $this->sections = $this->parser->parseIniString($rawContents);
 }
Beispiel #2
0
 /**
  * @depends test_i_returnsIniFileLocatorInstance
  * @expectedException \Retrinko\Ini\Exceptions\FileException
  * @throws \Retrinko\Ini\Exceptions\FileException
  */
 public function test_locate_unexistingFile_throwsException()
 {
     $file = __DIR__ . '/data/nofile.ini';
     \Retrinko\Ini\IniFileLocator::i()->i()->locate($file);
 }