| Total Complexity | 3 |
| Total Lines | 64 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 4 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 12 | final class ReferencesArray |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * A usage example |
||
| 16 | * |
||
| 17 | * ```php |
||
| 18 | * //params.php |
||
| 19 | * return [ |
||
| 20 | * 'yiisoft/data-response' => [ |
||
| 21 | * 'contentFormatters' => [ |
||
| 22 | * 'text/html' => HtmlDataResponseFormatter::class, |
||
| 23 | * 'application/xml' => XmlDataResponseFormatter::class, |
||
| 24 | * 'application/json' => JsonDataResponseFormatter::class, |
||
| 25 | * ], |
||
| 26 | * ], |
||
| 27 | * ]; |
||
| 28 | * ``` |
||
| 29 | * |
||
| 30 | * This definition |
||
| 31 | * |
||
| 32 | * ```php |
||
| 33 | * //web.php |
||
| 34 | * |
||
| 35 | * ContentNegotiator::class => [ |
||
| 36 | * '__construct()' => [ |
||
| 37 | * 'contentFormatters' => ReferencesArray::from($params['yiisoft/data-response']['contentFormatters']), |
||
| 38 | * ], |
||
| 39 | * ], |
||
| 40 | * ``` |
||
| 41 | * |
||
| 42 | * equals to |
||
| 43 | * |
||
| 44 | * ```php |
||
| 45 | * //web.php |
||
| 46 | * |
||
| 47 | * ContentNegotiator::class => [ |
||
| 48 | * '__construct()' => [ |
||
| 49 | * 'contentFormatters' => [ |
||
| 50 | * 'text/html' => Reference::to(HtmlDataResponseFormatter())), |
||
| 51 | * 'application/xml' => Reference::to(XmlDataResponseFormatter()), |
||
| 52 | * 'application/json' => Reference::to(JsonDataResponseFormatter()), |
||
| 53 | * ], |
||
| 54 | * ], |
||
| 55 | * ], |
||
| 56 | * ``` |
||
| 57 | * |
||
| 58 | * @param string[] $ids |
||
| 59 | * |
||
| 60 | * @throws InvalidConfigException |
||
| 61 | * |
||
| 62 | * @return Reference[] |
||
| 63 | */ |
||
| 64 | 2 | public static function from(array $ids) |
|
| 78 |