function __construct($file, $debug = null) { parent::__construct($debug); if (($this->_file_handler = fopen($file, "r")) == false) { throw new \Exception("Error: Invalid file"); } }
/** * Constructor. * * @param string $filepath a relative or absolute path to the file. * * @param string $delimiter the delimiter that separates columns in the file. * * @param string $enclosure (optional, default value is '"') the character that is used for * enclosing column values. * * @param string $escape (optional, default value is '\') the character used for escaping. * * For `$delimiter`, `$enclosure`, and `$escape` see also http://php.net/manual/en/function.str-getcsv.php. */ public function __construct($filepath, $delimiter, $enclosure = '"', $escape = "\\") { parent::__construct($filepath); $this->delimiter = $delimiter; $this->enclosure = $enclosure; $this->escape = $escape; $this->header = null; }
/** * Constructor. Creates a new TextReader on an underlying input * stream with a given charset. * * @param io.streams.InputStream stream * @param string charset the charset the stream is encoded in or NULL to trigger autodetection by BOM */ public function __construct(InputStream $stream, $charset = NULL) { parent::__construct($stream); $this->in = Streams::readableFd($stream); if (NULL === $charset) { $charset = $this->detectCharset(); } if (!stream_filter_append($this->in, 'convert.iconv.' . $charset . '/' . xp::ENCODING, STREAM_FILTER_READ)) { throw new IOException('Could not append stream filter'); } $this->charset = $charset; }
function __construct($file, $delimiter, $debug = null) { parent::__construct($debug); if (($this->_file_handler = fopen($file, "r")) == false) { throw new \Exception("Error: Invalid file"); } if (isset($delimiter)) { $this->_delimiter = $delimiter; } else { throw new \Exception("Error: Not defined delimiter"); } if (($this->_header = fgetcsv($this->_file_handler, 0, $this->_delimiter)) == false) { throw new \Exception("Reading of Header was failed"); } if ($this->_env->isDebugEnv() & ENV_DEBUG_PRINTED) { var_dump($this->_file_handler); echo PHP_EOL; } }
public function __construct() { parent::__construct(); $render_ids = Config::render_ids(); if ($render_ids !== NULL) { if (is_array($render_ids)) { $this->partial = $render_ids; } else { $this->partial[$render_ids] = 1; } $skip_ids = Config::skip_ids(); if ($skip_ids !== NULL) { if (is_array($skip_ids)) { $this->skip = $skip_ids; } else { $this->skip[$skip_ids] = 1; } } } else { throw new \Exception("Didn't get any IDs to seek"); } $parents = array(); if (file_exists(Config::output_dir() . "index.sqlite")) { $sqlite = new \SQLite3(Config::output_dir() . "index.sqlite"); // Fetch all ancestors of the ids we should render foreach ($render_ids as $p => $v) { do { $id = $sqlite->escapeString($p); $row = $sqlite->query("SELECT parent_id FROM ids WHERE docbook_id = '{$id}'")->fetchArray(SQLITE3_ASSOC); if ($row["parent_id"]) { $parents[] = $p = $row["parent_id"]; continue; } break; } while (1); } } $this->parents = $parents; }
public function __construct() { parent::__construct(); $render_ids = Config::render_ids(); if ($render_ids !== NULL) { if (is_array($render_ids)) { $this->partial = $render_ids; } else { $this->partial[$render_ids] = 1; } $skip_ids = Config::skip_ids(); if ($skip_ids !== NULL) { if (is_array($skip_ids)) { $this->skip = $skip_ids; } else { $this->skip[$skip_ids] = 1; } } } else { throw new \Exception("Didn't get any IDs to seek"); } }
public function __construct($filename) { parent::__construct(); $this->_f = fopen($filename, 'rb'); }
/** * Create iterator instance. * * @param Archive $archive * @param array $options */ public function __construct(Archive $archive, $options = array()) { parent::__construct($archive->getFilename(), $archive->getCompression()); $this->options = $options; }
public function __construct($str = '') { parent::__construct(); $this->_str = $str; $this->_pos = 0; }
/** * Construct the Lexer object */ public function __construct() { parent::__construct(); $this->line = 1; $this->column = 1; }