public function MultiresponseJsonNormalizer::supportsNormalization in Subrequests 3.x
Same name and namespace in other branches
- 8.2 src/Normalizer/MultiresponseJsonNormalizer.php \Drupal\subrequests\Normalizer\MultiresponseJsonNormalizer::supportsNormalization()
File
- src/
Normalizer/ MultiresponseJsonNormalizer.php, line 46
Class
- MultiresponseJsonNormalizer
- Normalizes multiple response objects into a single string.
Namespace
Drupal\subrequests\NormalizerCode
public function supportsNormalization($data, $format = NULL) {
if ($format !== 'json') {
return FALSE;
}
if (!is_array($data)) {
return FALSE;
}
$responses = array_filter($data, function ($response) {
return $response instanceof Response;
});
if (count($responses) !== count($data)) {
return FALSE;
}
return TRUE;
}