| 1 |
<?php |
| 2 |
/** |
| 3 |
* @package WPEmerge |
| 4 |
* @author Atanas Angelov <hi@atanas.dev> |
| 5 |
* @copyright 2017-2019 Atanas Angelov |
| 6 |
* @license https://www.gnu.org/licenses/gpl-2.0.html GPL-2.0 |
| 7 |
* @link https://wpemerge.com/ |
| 8 |
*/ |
| 9 |
|
| 10 |
namespace WPEmerge\Helpers; |
| 11 |
|
| 12 |
/** |
| 13 |
* Represent an object which has an array of attributes. |
| 14 |
*/ |
| 15 |
interface HasAttributesInterface { |
| 16 |
/** |
| 17 |
* Get attribute. |
| 18 |
* |
| 19 |
* @param string $attribute |
| 20 |
* @param mixed $default |
| 21 |
* @return mixed |
| 22 |
*/ |
| 23 |
public function getAttribute( $attribute, $default = '' ); |
| 24 |
|
| 25 |
/** |
| 26 |
* Get all attributes. |
| 27 |
* |
| 28 |
* @return array<string, mixed> |
| 29 |
*/ |
| 30 |
public function getAttributes(); |
| 31 |
|
| 32 |
/** |
| 33 |
* Set attribute. |
| 34 |
* |
| 35 |
* @param string $attribute |
| 36 |
* @param mixed $value |
| 37 |
* @return void |
| 38 |
*/ |
| 39 |
public function setAttribute( $attribute, $value ); |
| 40 |
|
| 41 |
/** |
| 42 |
* Fluent alias for setAttribute(). |
| 43 |
* |
| 44 |
* @param string $attribute |
| 45 |
* @param mixed $value |
| 46 |
* @return static $this |
| 47 |
*/ |
| 48 |
public function attribute( $attribute, $value ); |
| 49 |
|
| 50 |
/** |
| 51 |
* Set attributes. |
| 52 |
* No attempt to merge attributes is done - this is a direct overwrite operation. |
| 53 |
* |
| 54 |
* @param array<string, mixed> $attributes |
| 55 |
* @return void |
| 56 |
*/ |
| 57 |
public function setAttributes( $attributes ); |
| 58 |
|
| 59 |
/** |
| 60 |
* Fluent alias for setAttributes(). |
| 61 |
* |
| 62 |
* @param array<string, mixed> $attributes |
| 63 |
* @return static $this |
| 64 |
*/ |
| 65 |
public function attributes( $attributes ); |
| 66 |
} |
| 67 |
|