| 1 | <?php |
||
| 10 | abstract class EscapeAttribute |
||
| 11 | { |
||
| 12 | const ANSI_ESCAPE_CODE_BEGIN = "\033["; |
||
| 13 | const ANSI_ESCAPE_CODE_END = 'm'; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * @var string |
||
| 17 | */ |
||
| 18 | private $escapeCharacter; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * @param string $code |
||
| 22 | */ |
||
| 23 | public function __construct($code) |
||
| 32 | |||
| 33 | /** |
||
| 34 | * @return string |
||
| 35 | */ |
||
| 36 | public function getEscapeCharacter() |
||
| 40 | |||
| 41 | /** |
||
| 42 | * @param EscapeAttribute $escapeAttribute |
||
| 43 | * |
||
| 44 | * @return bool |
||
| 45 | */ |
||
| 46 | public function equals(EscapeAttribute $escapeAttribute) |
||
| 50 | |||
| 51 | /** |
||
| 52 | * Build escape character to be print |
||
| 53 | * |
||
| 54 | * @param string $escapeCode |
||
| 55 | * |
||
| 56 | * @return string |
||
| 57 | */ |
||
| 58 | protected function buildEscapeCharacter($escapeCode) |
||
| 64 | |||
| 65 | /** |
||
| 66 | * Get allowed escape codes |
||
| 67 | * |
||
| 68 | * @return string[] |
||
| 69 | */ |
||
| 70 | abstract protected function getAllowedEscapeCodes(); |
||
| 71 | } |
||
| 72 |