1 | <?php |
||
14 | class RepresentProcessor implements RepresentProcessorInterface |
||
15 | { |
||
16 | /** |
||
17 | * @var array |
||
18 | */ |
||
19 | protected $representation = []; |
||
20 | |||
21 | /** |
||
22 | * @param RepresentationInterface $representation |
||
23 | * @param string $className |
||
24 | * @param string $type |
||
25 | */ |
||
26 | 4 | public function addRepresentation( |
|
27 | RepresentationInterface $representation, |
||
28 | $className = null, |
||
29 | $type = self::REPRESENT_TYPE_JSON |
||
30 | ) { |
||
31 | 4 | if (null === $className) { |
|
32 | 4 | $className = $representation::getEntityClassName(); |
|
33 | 4 | } |
|
34 | 4 | $this->representation[$type][$className] = $representation; |
|
35 | 4 | } |
|
36 | |||
37 | /** |
||
38 | * @param PagerDutyEntityInterface $pagerDutyEntity |
||
39 | * |
||
40 | * @return string |
||
41 | * |
||
42 | * @throws RepresentProcessorException |
||
43 | */ |
||
44 | 4 | public function representJson(PagerDutyEntityInterface $pagerDutyEntity) |
|
51 | |||
52 | /** |
||
53 | * @param PagerDutyEntityInterface $pagerDutyEntity |
||
54 | * |
||
55 | * @return string |
||
56 | * |
||
57 | * @throws RepresentProcessorException |
||
58 | */ |
||
59 | 4 | public function getRESTResourcePath(PagerDutyEntityInterface $pagerDutyEntity) |
|
66 | |||
67 | /** |
||
68 | * @param string $className |
||
69 | * @param string $type |
||
70 | * |
||
71 | * @return RepresentationInterface |
||
72 | * |
||
73 | * @throws RepresentProcessorException |
||
74 | */ |
||
75 | 4 | protected function getRepresentation($className, $type) |
|
83 | } |
||
84 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: