public function __construct($buffer, $fileName, \browserfs\Runtime &$runtime) { parent::__construct($buffer); $this->setFileName($fileName); $this->runtime = $runtime; $this->parse(); }
/** * Class constructor. Parses a fileName. * @param fileName - string - path to the ini file * @param allowDuplicatePropertyNames - boolean - whether to allow inside a ini section * instances of the same property with the same property name. */ public function __construct($fileName, $allowDuplicatePropertyNames = false) { if (!is_string($fileName) || !strlen($fileName)) { throw new \browserfs\Exception('Invalid argument. Expected a non-empty string!'); } if (!file_exists($fileName)) { throw new \browserfs\Exception('File ' . $fileName . ' not found!'); } if (!is_readable($fileName)) { throw new \browserfs\Exception('File ' . $fileName . ' is not readable!'); } $buffer = file_get_contents($fileName); if (!is_string($buffer)) { throw new \browserfs\Exception('Could not read file ' . $fileName . '!'); } parent::__construct($buffer); $this->setFileName($fileName); $this->parse($allowDuplicatePropertyNames); }