Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Message.php
Go to the documentation of this file.
1 <?php
26 #require_once 'Zend/Mail/Part.php';
27 
31 #require_once 'Zend/Mail/Message/Interface.php';
32 
40 {
45  protected $_flags = array();
46 
57  public function __construct(array $params)
58  {
59  if (isset($params['file'])) {
60  if (!is_resource($params['file'])) {
61  $params['raw'] = @file_get_contents($params['file']);
62  if ($params['raw'] === false) {
66  #require_once 'Zend/Mail/Exception.php';
67  throw new Zend_Mail_Exception('could not open file');
68  }
69  } else {
70  $params['raw'] = stream_get_contents($params['file']);
71  }
72  $params['raw'] = preg_replace("/(?<!\r)\n/", "\r\n", $params['raw']);
73  }
74 
75  if (!empty($params['flags'])) {
76  // set key and value to the same value for easy lookup
77  $this->_flags = array_merge($this->_flags, array_combine($params['flags'],$params['flags']));
78  }
79 
80  parent::__construct($params);
81  }
82 
88  public function getTopLines()
89  {
90  return $this->_topLines;
91  }
92 
99  public function hasFlag($flag)
100  {
101  return isset($this->_flags[$flag]);
102  }
103 
109  public function getFlags()
110  {
111  return $this->_flags;
112  }
113 }
__construct(array $params)
Definition: Message.php:57
hasFlag($flag)
Definition: Message.php:99
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]
Definition: website.php:18