| Conditions | 4 |
| Paths | 2 |
| Total Lines | 14 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 23 | static function disambiguation($items, string $label, ?string $property = null) { |
||
| 24 | if($items instanceof \CharlotteDunois\Collect\Collection) { |
||
| 25 | $items = $items->all(); |
||
| 26 | } |
||
| 27 | |||
| 28 | $itemList = \array_map(function ($item) use ($property) { |
||
| 29 | if($property !== null) { |
||
| 30 | $item = (\is_array($item) ? $item[$property] : $item->$property); |
||
| 31 | } |
||
| 32 | |||
| 33 | return '`'.\str_replace(' ', "\u{00A0}", \CharlotteDunois\Yasmin\Utils\MessageHelpers::escapeMarkdown($item)).'`'; |
||
| 34 | }, $items); |
||
| 35 | |||
| 36 | return 'Multiple '.$label.' found, please be more specific: '.\implode(', ', $itemList); |
||
| 37 | } |
||
| 39 |