Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ContentStream.php
Go to the documentation of this file.
1 <?php
24 #require_once 'Zend/Pdf/Element/Object.php';
25 #require_once 'Zend/Pdf/Element/Dictionary.php';
26 #require_once 'Zend/Pdf/Element/Name.php';
27 #require_once 'Zend/Pdf/Element/Numeric.php';
28 
29 
31 #require_once 'Zend/Pdf/Resource.php';
32 
33 
42 {
48  protected $_bufferedContent = '';
49 
56  public function __construct($contentStreamObject = '')
57  {
58  if ($contentStreamObject !== null &&
59  !$contentStreamObject instanceof Zend_Pdf_Element_Object_Stream &&
60  !is_string($contentStreamObject)
61  ) {
62  #require_once 'Zend/Pdf/Exception.php';
63  throw new Zend_Pdf_Exception('Content stream parameter must be a string or stream object');
64  }
65 
66  parent::__construct($contentStreamObject);
67  }
68 
75  public function addInstructions($instructions)
76  {
77  $this->_bufferedContent .= $instructions;
78  return $this;
79  }
80 
86  public function getInstructions()
87  {
88  $this->flush();
89  return $this->_resource->value;
90  }
91 
97  public function clear()
98  {
99  $this->_resource->value = '';
100  $this->_bufferedContent = '';
101  return $this;
102  }
103 
107  public function flush()
108  {
109  $this->_resource->value .= $this->_bufferedContent;
110  $this->_bufferedContent = '';
111 
112  return $this;
113  }
114 }
__construct($contentStreamObject='')
$instructions