1: <?php
2: /*
3: You may not change or alter any portion of this comment or credits
4: of supporting developers from this source code or any supporting source code
5: which is considered copyrighted (c) material of the original comment or credit authors.
6:
7: This program is distributed in the hope that it will be useful,
8: but WITHOUT ANY WARRANTY; without even the implied warranty of
9: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10: */
11:
12: namespace Xoops\Core;
13:
14: /**
15: * AttributeInterface - standard access to attributes
16: *
17: * @category Xoops\Core
18: * @package AttributeInterface
19: * @author Richard Griffith <richard@geekwright.com>
20: * @copyright 2015 XOOPS Project (http://xoops.org)
21: * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
22: * @link http://xoops.org
23: */
24: interface AttributeInterface
25: {
26: /**
27: * Retrieve an attribute value.
28: *
29: * @param string $name Name of the attribute
30: * @param mixed $default A default value returned if the requested attribute is not set.
31: *
32: * @return mixed The value of the session variable, or $default if not set.
33: */
34: public function get($name, $default = null);
35:
36: /**
37: * Set an attribute value.
38: *
39: * @param string $name Name of the attribute option
40: * @param mixed $value Value of the attribute option
41: *
42: * @return void
43: */
44: public function set($name, $value);
45:
46: /**
47: * Determine if an attribute exists.
48: *
49: * @param string $name An attribute name.
50: *
51: * @return boolean TRUE if the given attribute exists, otherwise FALSE.
52: */
53: public function has($name);
54:
55: /**
56: * Remove an attribute.
57: *
58: * @param string $name An attribute name.
59: *
60: * @return mixed An attribute value, if the named attribute existed and
61: * has been removed, otherwise NULL.
62: */
63: public function remove($name);
64:
65: /**
66: * Remove all attributes, return previous values.
67: *
68: * @return array old attributes values
69: */
70: public function clear();
71: }
72: