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 SMWDataItems |
||
4 | */ |
||
5 | |||
6 | /** |
||
7 | * This class implements blob (long string) data items. |
||
8 | * |
||
9 | * @since 1.6 |
||
10 | * |
||
11 | * @author Markus Krötzsch |
||
12 | * @ingroup SMWDataItems |
||
13 | */ |
||
14 | class SMWDIBlob extends SMWDataItem { |
||
0 ignored issues
–
show
|
|||
15 | |||
16 | /** |
||
17 | * Internal value. |
||
18 | * @var string |
||
19 | */ |
||
20 | protected $m_string; |
||
21 | |||
22 | 220 | public function __construct( $string ) { |
|
23 | 220 | $this->m_string = trim( $string ); |
|
24 | 220 | } |
|
25 | |||
26 | 208 | public function getDIType() { |
|
27 | 208 | return SMWDataItem::TYPE_BLOB; |
|
28 | } |
||
29 | |||
30 | 198 | public function getString() { |
|
31 | 198 | return $this->m_string; |
|
32 | } |
||
33 | |||
34 | 14 | public function getSortKey() { |
|
35 | 14 | return $this->m_string; |
|
36 | } |
||
37 | |||
38 | /** |
||
39 | * @see SMWDataItem::getSortKeyDataItem() |
||
40 | * @return SMWDataItem |
||
41 | */ |
||
42 | public function getSortKeyDataItem() { |
||
43 | return $this; |
||
44 | } |
||
45 | |||
46 | 219 | public function getSerialization() { |
|
47 | 219 | return $this->m_string; |
|
48 | } |
||
49 | |||
50 | /** |
||
51 | * Create a data item from the provided serialization string and type |
||
52 | * ID. |
||
53 | * @return SMWDIBlob |
||
54 | */ |
||
55 | 7 | public static function doUnserialize( $serialization ) { |
|
56 | 7 | return new SMWDIBlob( $serialization ); |
|
57 | } |
||
58 | |||
59 | 6 | public function equals( SMWDataItem $di ) { |
|
60 | 6 | if ( !( $di instanceof SMWDIBlob ) ) { |
|
61 | return false; |
||
62 | } |
||
63 | |||
64 | 6 | return $di->getString() === $this->m_string; |
|
65 | } |
||
66 | } |
||
67 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.