Completed
Push — master ( 9cb597...d2d2ad )
by mw
13s
created

includes/dataitems/DIConcept.php (1 issue)

Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace SMW;
4
5
use SMWDataItem;
6
7
/**
8
 * This class implements Concept data items.
9
 *
10
 * @note These special data items for storing concept declaration data in SMW
11
 * should vanish at some point since Container values could encode this data
12
 * just as well.
13
 *
14
 * @since 1.6
15
 *
16
 * @ingroup SMWDataItems
17
 *
18
 * @author Markus Krötzsch
19
 * @author mwjames
20
 */
21
class DIConcept extends \SMWDataItem {
22
23
	/**
24
	 * Query string for this concept. Possibly long.
25
	 * @var string
26
	 */
27
	protected $m_concept;
28
	/**
29
	 * Documentation for this concept. Possibly long.
30
	 * @var string
31
	 */
32
	protected $m_docu;
33
	/**
34
	 * Flags of query features.
35
	 * @var integer
36
	 */
37
	protected $m_features;
38
	/**
39
	 * Size of the query.
40
	 * @var integer
41
	 */
42
	protected $m_size;
43
	/**
44
	 * Depth of the query.
45
	 * @var integer
46
	 */
47
	protected $m_depth;
48
49
	/**
50
	 * Status
51
	 * @var integer
52
	 */
53
	protected $cacheStatus;
54
55
	/**
56
	 * Date
57
	 * @var integer
58
	 */
59
	protected $cacheDate;
60
61
	/**
62
	 * Count
63
	 * @var integer
64
	 */
65
	protected $cacheCount;
66
67
	/**
68
	 * @param string $concept the concept query string
69
	 * @param string $docu user documentation
70
	 * @param integer $queryefeatures flags about query features
0 ignored issues
show
There is no parameter named $queryefeatures. Did you maybe mean $queryfeatures?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit.

Consider the following example. The parameter $ireland is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $ireland
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was changed, but the annotation was not.

Loading history...
71
	 * @param integer $size concept query size
72
	 * @param integer $depth concept query depth
73
	 */
74 9
	public function __construct( $concept, $docu, $queryfeatures, $size, $depth ) {
75 9
		$this->m_concept  = $concept;
76 9
		$this->m_docu     = $docu;
77 9
		$this->m_features = $queryfeatures;
78 9
		$this->m_size     = $size;
79 9
		$this->m_depth    = $depth;
80 9
	}
81
82 7
	public function getDIType() {
83 7
		return SMWDataItem::TYPE_CONCEPT;
84
	}
85
86 6
	public function getConceptQuery() {
87 6
		return $this->m_concept;
88
	}
89
90 6
	public function getDocumentation() {
91 6
		return $this->m_docu;
92
	}
93
94 6
	public function getQueryFeatures() {
95 6
		return $this->m_features;
96
	}
97
98 6
	public function getSize() {
99 6
		return $this->m_size;
100
	}
101
102 6
	public function getDepth() {
103 6
		return $this->m_depth;
104
	}
105
106
	public function getSortKey() {
107
		return $this->m_docu;
108
	}
109
110 8
	public function getSerialization() {
111 8
		return serialize( $this );
112
	}
113
114
	/**
115
	 * Sets cache status
116
	 *
117
	 * @since 1.9
118
	 *
119
	 * @param string
120
	 */
121 7
	public function setCacheStatus( $status ) {
122 7
		$this->cacheStatus = $status;
123 7
	}
124
125
	/**
126
	 * Sets cache date
127
	 *
128
	 * @since 1.9
129
	 *
130
	 * @param string
131
	 */
132 7
	public function setCacheDate( $date ) {
133 7
		$this->cacheDate = $date;
134 7
	}
135
136
	/**
137
	 * Sets cache count
138
	 *
139
	 * @since 1.9
140
	 *
141
	 * @param int
142
	 */
143 7
	public function setCacheCount( $count ) {
144 7
		$this->cacheCount = $count;
145 7
	}
146
147
	/**
148
	 * Returns cache status
149
	 *
150
	 * @since 1.9
151
	 *
152
	 * @return string
153
	 */
154 3
	public function getCacheStatus() {
155 3
		return $this->cacheStatus;
156
	}
157
158
	/**
159
	 * Returns cache date
160
	 *
161
	 * @since 1.9
162
	 *
163
	 * @return string
164
	 */
165 3
	public function getCacheDate() {
166 3
		return $this->cacheDate;
167
	}
168
169
	/**
170
	 * Returns cache count
171
	 *
172
	 * @since 1.9
173
	 *
174
	 * @return int
175
	 */
176 6
	public function getCacheCount() {
177 6
		return $this->cacheCount;
178
	}
179
180
	/**
181
	 * Create a data item from the provided serialization string and type
182
	 * ID.
183
	 * @return DIConcept
184
	 */
185 1
	public static function doUnserialize( $serialization ) {
186 1
		$result = unserialize( $serialization );
187 1
		if ( $result === false ) {
188
			throw new DataItemException( "Unserialization failed." );
189
		}
190 1
		return $result;
191
	}
192
193 2
	public function equals( SMWDataItem $di ) {
194 2
		if ( $di->getDIType() !== SMWDataItem::TYPE_CONCEPT ) {
195 1
			return false;
196
		}
197 1
		return $di->getSerialization() === $this->getSerialization();
198
	}
199
200
}
201