Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Capture.php
Go to the documentation of this file.
1 <?php
27 #require_once 'Zend/Cache/Core.php';
28 
29 
37 {
42  protected $_idStack = array();
43 
48  protected $_tags = array();
49 
50  protected $_extension = null;
51 
58  public function start($id, array $tags, $extension = null)
59  {
60  $this->_tags = $tags;
61  $this->_extension = $extension;
62  ob_start(array($this, '_flush'));
63  ob_implicit_flush(false);
64  $this->_idStack[] = $id;
65  return false;
66  }
67 
75  public function _flush($data)
76  {
77  $id = array_pop($this->_idStack);
78  if ($id === null) {
79  Zend_Cache::throwException('use of _flush() without a start()');
80  }
81  if ($this->_extension) {
82  $this->save(serialize(array($data, $this->_extension)), $id, $this->_tags);
83  } else {
84  $this->save($data, $id, $this->_tags);
85  }
86  return $data;
87  }
88 }
start($id, array $tags, $extension=null)
Definition: Capture.php:58
$id
Definition: fieldset.phtml:14
save($data, $id=null, $tags=array(), $specificLifetime=false, $priority=8)
Definition: Core.php:348
static throwException($msg, Exception $e=null)
Definition: Cache.php:205