These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * @ingroup SMWDataValues |
||
4 | */ |
||
5 | |||
6 | /** |
||
7 | * This datavalue is used as a container for concept descriptions as used |
||
8 | * on Concept pages with the #concept parserfunction. It has a somewhat |
||
9 | * non-standard interface as compared to other datavalues, but this is not |
||
10 | * an issue. |
||
11 | * |
||
12 | * @author Markus Krötzsch |
||
13 | * @ingroup SMWDataValues |
||
14 | */ |
||
15 | class SMWConceptValue extends SMWDataValue { |
||
16 | |||
17 | protected function parseUserValue( $value ) { |
||
18 | throw new Exception( 'Concepts cannot be initialized from user-provided strings. This should not happen.' ); |
||
19 | } |
||
20 | |||
21 | /** |
||
22 | * @see SMWDataValue::loadDataItem() |
||
23 | * @param $dataItem SMWDataItem |
||
24 | * @return boolean |
||
25 | */ |
||
26 | protected function loadDataItem( SMWDataItem $dataItem ) { |
||
27 | |||
28 | if ( $dataItem->getDIType() !== SMWDataItem::TYPE_CONCEPT ) { |
||
29 | return false; |
||
30 | } |
||
31 | |||
32 | $this->m_dataitem = $dataItem; |
||
33 | $this->m_caption = $dataItem->getConceptQuery(); // probably useless |
||
34 | |||
35 | return true; |
||
36 | } |
||
37 | |||
38 | protected function clear() { |
||
39 | $this->m_dataitem = new \SMW\DIConcept( '', '', 0, -1, -1, $this->m_typeid ); |
||
0 ignored issues
–
show
|
|||
40 | } |
||
41 | |||
42 | public function getShortWikiText( $linked = null ) { |
||
43 | return $this->m_caption; |
||
44 | } |
||
45 | |||
46 | public function getShortHTMLText( $linker = null ) { |
||
47 | return $this->getShortWikiText( $linker ); // should be save (based on xsdvalue) |
||
48 | } |
||
49 | |||
50 | public function getLongWikiText( $linked = null ) { |
||
51 | if ( !$this->isValid() ) { |
||
52 | return $this->getErrorText(); |
||
53 | } else { |
||
54 | return $this->m_caption; |
||
55 | } |
||
56 | } |
||
57 | |||
58 | public function getLongHTMLText( $linker = null ) { |
||
59 | if ( !$this->isValid() ) { |
||
60 | return $this->getErrorText(); |
||
61 | } else { |
||
62 | return $this->m_caption; // should be save (based on xsdvalue) |
||
63 | } |
||
64 | } |
||
65 | |||
66 | public function getWikiValue() { |
||
67 | /// This should not be used for anything. This class does not support wiki values. |
||
68 | return str_replace( array( '<', '>', '&' ), array( '<', '>', '&' ), $this->m_dataitem->getConceptQuery() ); |
||
69 | } |
||
70 | |||
71 | /// Return the concept's defining text (in SMW query syntax) |
||
72 | public function getConceptText() { |
||
73 | return $this->m_dataitem->getConceptQuery(); |
||
74 | } |
||
75 | |||
76 | /// Return the optional concept documentation. |
||
77 | public function getDocu() { |
||
78 | return $this->m_dataitem->getDocumentation(); |
||
79 | } |
||
80 | |||
81 | /// Return the concept's size (a metric used to estimate computation complexity). |
||
82 | public function getSize() { |
||
83 | return $this->m_dataitem->getSize(); |
||
84 | } |
||
85 | |||
86 | /// Return the concept's depth (a metric used to estimate computation complexity). |
||
87 | public function getDepth() { |
||
88 | return $this->m_dataitem->getDepth(); |
||
89 | } |
||
90 | |||
91 | /// Return the concept's query feature bit field (a metric used to estimate computation complexity). |
||
92 | public function getQueryFeatures() { |
||
93 | return $this->m_dataitem->getQueryFeatures(); |
||
94 | } |
||
95 | |||
96 | } |
||
97 |
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.