These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | namespace GoetasWebservices\Xsd\XsdToPhpRuntime\Jms\Handler; |
||
3 | |||
4 | use JMS\Serializer\Context; |
||
5 | use JMS\Serializer\GraphNavigator; |
||
6 | use JMS\Serializer\Handler\SubscribingHandlerInterface; |
||
7 | use JMS\Serializer\XmlDeserializationVisitor; |
||
8 | use JMS\Serializer\XmlSerializationVisitor; |
||
9 | |||
10 | class BaseTypesHandler implements SubscribingHandlerInterface |
||
11 | { |
||
12 | |||
13 | public static function getSubscribingMethods() |
||
14 | { |
||
15 | return array( |
||
16 | array( |
||
17 | 'direction' => GraphNavigator::DIRECTION_SERIALIZATION, |
||
18 | 'format' => 'xml', |
||
19 | 'type' => 'GoetasWebservices\Xsd\XsdToPhp\Jms\SimpleListOf', |
||
20 | 'method' => 'simpleListOfToXml' |
||
21 | ), |
||
22 | array( |
||
23 | 'direction' => GraphNavigator::DIRECTION_DESERIALIZATION, |
||
24 | 'format' => 'xml', |
||
25 | 'type' => 'GoetasWebservices\Xsd\XsdToPhp\Jms\SimpleListOf', |
||
26 | 'method' => 'simpleListOfFromXML' |
||
27 | ) |
||
28 | ); |
||
29 | } |
||
30 | |||
31 | View Code Duplication | public function simpleListOfToXml(XmlSerializationVisitor $visitor, $object, array $type, Context $context) |
|
32 | { |
||
33 | |||
34 | $newType = array( |
||
35 | 'name' => $type["params"][0]["name"], |
||
36 | 'params' => array() |
||
37 | ); |
||
38 | |||
39 | $navigator = $context->getNavigator(); |
||
40 | $ret = array(); |
||
41 | foreach ($object as $v) { |
||
42 | $ret[] = $navigator->accept($v, $newType, $context)->data; |
||
0 ignored issues
–
show
|
|||
43 | } |
||
44 | |||
45 | return $visitor->getDocument()->createTextNode(implode(" ", $ret)); |
||
46 | } |
||
47 | |||
48 | View Code Duplication | public function simpleListOfFromXml(XmlDeserializationVisitor $visitor, $node, array $type, Context $context) |
|
49 | { |
||
50 | $newType = array( |
||
51 | 'name' => $type["params"][0]["name"], |
||
52 | 'params' => array() |
||
53 | ); |
||
54 | $ret = array(); |
||
55 | $navigator = $context->getNavigator(); |
||
56 | foreach (explode(" ", (string)$node) as $v) { |
||
57 | $ret[] = $navigator->accept($v, $newType, $context); |
||
0 ignored issues
–
show
The call to
GraphNavigatorInterface::accept() has too many arguments starting with $context .
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue. If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. In this case you can add the
Loading history...
|
|||
58 | } |
||
59 | return $ret; |
||
60 | } |
||
61 | } |
||
62 | |||
63 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.
In this case you can add the
@ignore
PhpDoc annotation to the duplicate definition and it will be ignored.