1 | <?php |
||
22 | class CitationResourceMatchFinder { |
||
23 | |||
24 | /** |
||
25 | * @var Store |
||
26 | */ |
||
27 | private $store; |
||
28 | |||
29 | /** |
||
30 | * @var DataValueFactory |
||
31 | */ |
||
32 | private $dataValueFactory; |
||
33 | |||
34 | /** |
||
35 | * @since 1.0 |
||
36 | * |
||
37 | * @param Store $store |
||
38 | */ |
||
39 | 16 | public function __construct( Store $store ) { |
|
43 | |||
44 | /** |
||
45 | * @since 1.0 |
||
46 | * |
||
47 | * @param array $subjects |
||
48 | * @param string $linkClass |
||
49 | * |
||
50 | * @return array |
||
51 | */ |
||
52 | 1 | public function findCitationResourceLinks( array $subjects, $linkClass = '' ) { |
|
74 | |||
75 | /** |
||
76 | * Find match for [[OCLC::SomeOclcKey]] |
||
77 | * |
||
78 | * @since 1.0 |
||
79 | * |
||
80 | * @param string $type |
||
81 | * @param string|null $id |
||
82 | * |
||
83 | * @return array |
||
84 | */ |
||
85 | 6 | public function findMatchForResourceIdentifierTypeToValue( $type, $id = null ) { |
|
86 | |||
87 | 6 | if ( $id === null || $id === '' ) { |
|
88 | return array(); |
||
89 | } |
||
90 | |||
91 | 6 | $resourceIdentifierFactory = new ResourceIdentifierFactory(); |
|
92 | |||
93 | 6 | $resourceIdentifierStringValue = $resourceIdentifierFactory->newResourceIdentifierStringValueForType( $type ); |
|
94 | 6 | $resourceIdentifierStringValue->setUserValue( $id ); |
|
95 | 6 | $id = $resourceIdentifierStringValue->getWikiValue(); |
|
96 | |||
97 | 6 | $description = new SomeProperty( |
|
98 | 6 | $resourceIdentifierStringValue->getProperty(), |
|
99 | 6 | new ValueDescription( new DIBlob( $id ) ) |
|
100 | 6 | ); |
|
101 | |||
102 | 6 | $query = new Query( |
|
103 | 6 | $description, |
|
104 | 6 | false, |
|
105 | false |
||
106 | 6 | ); |
|
107 | |||
108 | 6 | $query->querymode = Query::MODE_INSTANCES; |
|
109 | 6 | $query->setLimit( 10 ); |
|
110 | |||
111 | 6 | return $this->store->getQueryResult( $query )->getResults(); |
|
112 | } |
||
113 | |||
114 | /** |
||
115 | * @since 1.0 |
||
116 | * |
||
117 | * @param string $citationReference |
||
118 | * |
||
119 | * @return array |
||
120 | */ |
||
121 | 8 | public function findCitationTextFor( $citationReference ) { |
|
151 | |||
152 | /** |
||
153 | * Find match for [[Citation key::SomeKey]]|?Citation text |
||
154 | * |
||
155 | * @since 1.0 |
||
156 | * |
||
157 | * @param string $citationReference |
||
158 | * |
||
159 | * @return QueryResult |
||
160 | */ |
||
161 | 8 | public function findMatchForCitationReference( $citationReference ) { |
|
188 | |||
189 | } |
||
190 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.