65 $pathInfo = pathinfo($filePath);
67 $this->_filePath = $filePath;
68 $this->_fileLocation = isset($pathInfo[
'dirname']) ? $pathInfo[
'dirname'] :
'';
69 $this->_fileName = isset($pathInfo[
'basename']) ? $pathInfo[
'basename'] :
'';
77 if ($this->_fileHandler) {
95 if ($this->_isInWriteMode) {
99 'You don\'t have permissions to write to the "%1" file.',
100 [$this->_fileLocation]
108 'You don\'t have the permissions to open the "%1" file for writing access.',
116 if (!
is_file($this->_filePath)) {
119 'The "%1" file doesn\'t exist. Verify the file and try again.',
128 'You don\'t have permissions to read the "%1" file.',
137 $this->_chmod = $chmod;
158 public function read($length = 4096)
177 return $this->
_eof();
189 $this->_fileHandler =
false;
191 if ($this->_isInWriteMode && isset($this->_chmod)) {
192 @
chmod($this->_filePath, $this->_chmod);
205 $this->_fileHandler = @
fopen($this->_filePath,
$mode);
207 if (
false === $this->_fileHandler) {
209 new \
Magento\Framework\
Phrase(
'The "%1" file failed to open.', [$this->_filePath])
227 new \
Magento\Framework\
Phrase(
'The data failed to write to "%1".', [$this->_filePath])
241 $result = fread($this->_fileHandler, $length);
245 new \
Magento\Framework\
Phrase(
'Failed to read data from %1', [$this->_filePath])
259 return feof($this->_fileHandler);
269 fclose($this->_fileHandler);
280 return preg_match(
'/(^[waxc])|(\+$)/',
$mode);
302 if (!$this->_fileHandler) {
open($mode='w+', $chmod=null)
if($exist=($block->getProductCollection() && $block->getProductCollection() ->getSize())) $mode