1: <?php
2: /**
3: * Magento
4: *
5: * NOTICE OF LICENSE
6: *
7: * This source file is subject to the Open Software License (OSL 3.0)
8: * that is bundled with this package in the file LICENSE.txt.
9: * It is also available through the world-wide-web at this URL:
10: * http://opensource.org/licenses/osl-3.0.php
11: * If you did not receive a copy of the license and are unable to
12: * obtain it through the world-wide-web, please send an email
13: * to license@magentocommerce.com so we can send you a copy immediately.
14: *
15: * DISCLAIMER
16: *
17: * Do not edit or add to this file if you wish to upgrade Magento to newer
18: * versions in the future. If you wish to customize Magento for your
19: * needs please refer to http://www.magentocommerce.com for more information.
20: *
21: * @category Mage
22: * @package Mage_Core
23: * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24: * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25: */
26:
27: /**
28: * Abstract message model
29: *
30: * @category Mage
31: * @package Mage_Core
32: * @author Magento Core Team <core@magentocommerce.com>
33: */
34: abstract class Mage_Core_Model_Message_Abstract
35: {
36: protected $_type;
37: protected $_code;
38: protected $_class;
39: protected $_method;
40: protected $_identifier;
41: protected $_isSticky = false;
42:
43: public function __construct($type, $code='')
44: {
45: $this->_type = $type;
46: $this->_code = $code;
47: }
48:
49: public function getCode()
50: {
51: return $this->_code;
52: }
53:
54: public function getText()
55: {
56: return $this->getCode();
57: }
58:
59: public function getType()
60: {
61: return $this->_type;
62: }
63:
64: public function setClass($class)
65: {
66: $this->_class = $class;
67: }
68:
69: public function setMethod($method)
70: {
71: $this->_method = $method;
72: }
73:
74: public function toString()
75: {
76: $out = $this->getType().': '.$this->getText();
77: return $out;
78: }
79:
80: /**
81: * Set message identifier
82: *
83: * @param string $id
84: * @return Mage_Core_Model_Message_Abstract
85: */
86: public function setIdentifier($id)
87: {
88: $this->_identifier = $id;
89: return $this;
90: }
91:
92: /**
93: * Get message identifier
94: *
95: * @return string
96: */
97: public function getIdentifier()
98: {
99: return $this->_identifier;
100: }
101:
102: /**
103: * Set message sticky status
104: *
105: * @param bool $isSticky
106: * @return Mage_Core_Model_Message_Abstract
107: */
108: public function setIsSticky($isSticky = true)
109: {
110: $this->_isSticky = $isSticky;
111: return $this;
112: }
113:
114: /**
115: * Get whether message is sticky
116: *
117: * @return bool
118: */
119: public function getIsSticky()
120: {
121: return $this->_isSticky;
122: }
123:
124: /**
125: * Set code
126: *
127: * @param string $code
128: * @return Mage_Core_Model_Message_Abstract
129: */
130: public function setCode($code)
131: {
132: $this->_code = $code;
133: return $this;
134: }
135: }
136: