These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | namespace Chubbyphp\Deserialization\Decoder; |
||
6 | |||
7 | use Chubbyphp\Deserialization\DeserializerRuntimeException; |
||
8 | use Symfony\Component\Yaml\Exception\ParseException; |
||
9 | use Symfony\Component\Yaml\Yaml; |
||
10 | |||
11 | final class YamlTypeDecoder implements TypeDecoderInterface |
||
12 | { |
||
13 | /** |
||
14 | * @return string |
||
15 | */ |
||
16 | 3 | public function getContentType(): string |
|
17 | { |
||
18 | 3 | return 'application/x-yaml'; |
|
19 | } |
||
20 | |||
21 | /** |
||
22 | * @param string $data |
||
23 | * |
||
24 | * @return array |
||
25 | * |
||
26 | * @throws DeserializerRuntimeException |
||
27 | */ |
||
28 | 4 | public function decode(string $data): array |
|
29 | { |
||
30 | try { |
||
31 | 4 | $decoded = Yaml::parse($data); |
|
32 | 1 | } catch (ParseException $e) { |
|
0 ignored issues
–
show
|
|||
33 | 1 | throw DeserializerRuntimeException::createNotParsable($this->getContentType()); |
|
34 | } |
||
35 | |||
36 | 3 | if (!is_array($decoded)) { |
|
37 | 1 | throw DeserializerRuntimeException::createNotParsable($this->getContentType()); |
|
38 | } |
||
39 | |||
40 | 2 | return $decoded; |
|
41 | } |
||
42 | } |
||
43 |
Scrutinizer analyzes your
composer.json
/composer.lock
file if available to determine the classes, and functions that are defined by your dependencies.It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis.