| Total Complexity | 12 |
| Total Lines | 67 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 5 | class ExpressionAttributeNames |
||
| 6 | { |
||
| 7 | /** |
||
| 8 | * @var array |
||
| 9 | */ |
||
| 10 | protected $mapping; |
||
| 11 | |||
| 12 | /** |
||
| 13 | * @var array |
||
| 14 | */ |
||
| 15 | protected $nested; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @var string |
||
| 19 | */ |
||
| 20 | protected $prefix; |
||
| 21 | |||
| 22 | 14 | public function __construct($prefix = '#') |
|
| 26 | 14 | } |
|
| 27 | |||
| 28 | 6 | public function set($name) |
|
| 36 | 5 | } |
|
| 37 | |||
| 38 | 1 | public function get($placeholder) |
|
| 39 | { |
||
| 40 | 1 | return $this->mapping[$placeholder]; |
|
| 41 | } |
||
| 42 | |||
| 43 | 5 | public function placeholder($name) |
|
| 44 | { |
||
| 45 | 5 | $placeholder = "{$this->prefix}{$name}"; |
|
| 46 | 5 | if (isset($this->mapping[$placeholder])) { |
|
| 47 | 4 | return $placeholder; |
|
| 48 | } |
||
| 49 | |||
| 50 | 1 | return $name; |
|
| 51 | } |
||
| 52 | |||
| 53 | 7 | public function all() |
|
| 54 | { |
||
| 55 | 7 | return $this->mapping; |
|
| 56 | } |
||
| 57 | |||
| 58 | 1 | public function placeholders() |
|
| 61 | } |
||
| 62 | |||
| 63 | 14 | public function reset() |
|
| 64 | { |
||
| 69 | } |
||
| 70 | |||
| 71 | 6 | private function isNested($name) |
|
| 72 | { |
||
| 76 |