public function __construct($file, $options = array()) { UtilFilesystem::checkFile($file); $this->file = fopen($file, 'r'); if (is_array($options)) { $this->options = array_merge(array('length' => 0, 'delimiter' => ',', 'enclosure' => '"', 'escape' => '\\', 'skip' => 0), $options); } }
public function ver() { if (!$this->ver) { $root = AbstractApp::getRootDir(); $file = $root . '/app/cache/prod/appProdUrlMatcher.php'; try { UtilFilesystem::checkFile($file); } catch (\Exception $e) { $file = $root . '/vendor/autoload.php'; try { UtilFilesystem::checkFile($file); } catch (\Exception $e) { echo "File '{$file}'' not exists, please run project in production mode once to create it\n"; die($e->getMessage()); } } $d = new DateTime(date("c", filemtime($file))); $this->ver = $d->format('Y-m-d-H-i-s'); } return $this->ver; }
public static function getStpaConfig($key = null, $default = null) { if (static::$stpaconfig === null) { $root = static::getRootDir(); $config = "{$root}/stpaconfig.ini"; try { UtilFilesystem::checkFile($config); } catch (Exception $ex) { $config = "{$root}/vendor/stopsopa/utils/src/Stopsopa/UtilsBundle/Resources/config/stpaconfig.ini"; } static::$stpaconfig = parse_ini_file($config, true); $root = static::getRootDir(); static::_bindConfig(static::$stpaconfig, $root); } return UtilArray::cascadeGet(static::$stpaconfig, $key, $default); }