Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Gz.php
Go to the documentation of this file.
1 <?php
11 
12 class Gz extends \Magento\Framework\Archive\Helper\File
13 {
18  protected function _open($mode)
19  {
20  if (!extension_loaded('zlib')) {
21  throw new \RuntimeException('PHP extension zlib is required.');
22  }
23  $this->_fileHandler = gzopen($this->_filePath, $mode);
24 
25  if (false === $this->_fileHandler) {
26  throw new \Magento\Framework\Exception\LocalizedException(
27  new \Magento\Framework\Phrase('The "%1" file failed to open.', [$this->_filePath])
28  );
29  }
30  }
31 
35  protected function _write($data)
36  {
37  $result = gzwrite($this->_fileHandler, $data);
38 
39  if (empty($result) && !empty($data)) {
40  throw new \Magento\Framework\Exception\LocalizedException(
41  new \Magento\Framework\Phrase('The data failed to write to "%1".', [$this->_filePath])
42  );
43  }
44  }
45 
49  protected function _read($length)
50  {
51  return gzread($this->_fileHandler, $length);
52  }
53 
57  protected function _eof()
58  {
59  return gzeof($this->_fileHandler);
60  }
61 
65  protected function _close()
66  {
67  gzclose($this->_fileHandler);
68  }
69 }
if($exist=($block->getProductCollection() && $block->getProductCollection() ->getSize())) $mode
Definition: grid.phtml:15