| 1 | <?php |
||
| 5 | abstract class AbstractPart |
||
| 6 | { |
||
| 7 | /** |
||
| 8 | * @var string the wrapped value |
||
| 9 | */ |
||
| 10 | protected $value; |
||
| 11 | |||
| 12 | /** |
||
| 13 | * constructor allows passing the value to wrap |
||
| 14 | * |
||
| 15 | * @param $value |
||
| 16 | */ |
||
| 17 | public function __construct($value) |
||
| 21 | |||
| 22 | /** |
||
| 23 | * set the value to wrap |
||
| 24 | * (can take string or part instance) |
||
| 25 | * |
||
| 26 | * @param string|AbstractPart $value |
||
| 27 | * @return $this |
||
| 28 | */ |
||
| 29 | public function setValue($value): AbstractPart |
||
| 39 | |||
| 40 | /** |
||
| 41 | * get the wrapped value |
||
| 42 | * |
||
| 43 | * @return string |
||
| 44 | */ |
||
| 45 | public function getValue(): string |
||
| 49 | |||
| 50 | /** |
||
| 51 | * get the normalized value |
||
| 52 | * |
||
| 53 | * @return string |
||
| 54 | */ |
||
| 55 | public function normalize(): string |
||
| 59 | |||
| 60 | /** |
||
| 61 | * helper for camelization of values |
||
| 62 | * to be used during normalize |
||
| 63 | * |
||
| 64 | * @param $word |
||
| 65 | * @return mixed |
||
| 66 | */ |
||
| 67 | protected function camelcase($word): string |
||
| 75 | |||
| 76 | /** |
||
| 77 | * camelcasing callback |
||
| 78 | * |
||
| 79 | * @param $matches |
||
| 80 | * @return string |
||
| 81 | */ |
||
| 82 | protected function camelcaseReplace($matches): string |
||
| 90 | } |
||
| 91 |