| Total Complexity | 11 |
| Total Lines | 52 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | trait AttachTrait |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * 属性数组 |
||
| 11 | * |
||
| 12 | * @var array |
||
| 13 | */ |
||
| 14 | protected $attribute; |
||
| 15 | /** |
||
| 16 | * 附加数组 |
||
| 17 | * |
||
| 18 | * @var array |
||
| 19 | */ |
||
| 20 | protected $attach; |
||
| 21 | |||
| 22 | |||
| 23 | public function mergeAttribute(array $value) |
||
| 26 | } |
||
| 27 | |||
| 28 | protected function analyse(array $context) |
||
| 29 | { |
||
| 30 | $replace = []; |
||
| 31 | foreach ($context as $key => $val) { |
||
| 32 | if (!is_array($val) && (!is_object($val) || method_exists($val, '__toString'))) { |
||
| 33 | $replace['{' . $key . '}'] = $val; |
||
| 34 | } else { |
||
| 35 | $this->attach[$key] = $val; |
||
| 36 | } |
||
| 37 | } |
||
| 38 | return $replace; |
||
| 39 | } |
||
| 40 | |||
| 41 | public function interpolate(string $message, array $context) |
||
| 59 | } |
||
| 60 | } |
||
| 61 |