Completed
Push — master ( 3e30e6...aad109 )
by mw
02:31
created

src/QueryResultFactory.php (2 issues)

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 SEQL;
4
5
use SEQL\ByAskApiHttpRequest\JsonResponseParser;
6
use SEQL\ByAskApiHttpRequest\QueryResult as ByAskApiHttpRequestQueryResult;
7
use SMW\Store;
8
use SMWQuery as Query;
9
use SMWQueryResult as QueryResult;
10
11
/**
12
 * @license GNU GPL v2+
13
 * @since 1.0
14
 *
15
 * @author mwjames
16
 */
17
class QueryResultFactory {
18
19
	/**
20
	 * @var
21
	 */
22
	private $store;
23
24
	/**
25
	 * @since 1.0
26
	 *
27
	 * @param Store $store
28
	 */
29 3
	public function __construct( Store $store ) {
30 3
		$this->store = $store;
31 3
	}
32
33
	/**
34
	 * @since 1.0
35
	 *
36
	 * @param Query $query
37
	 *
38
	 * @return QueryResult
39
	 */
40 1
	public function newEmptyQueryResult( Query $query ) {
41 1
		return new QueryResult(
42 1
			$query->getDescription()->getPrintrequests(),
43 1
			$query,
44 1
			array(),
45 1
			$this->store,
0 ignored issues
show
$this->store of type object<SMW\Store> is not a sub-type of object<SMWStore>. It seems like you assume a child class of the class SMW\Store to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
46
			false
47 1
		);
48
	}
49
50
	/**
51
	 * @since 1.0
52
	 *
53
	 * @param Query $query
54
	 * @param JsonResponseParser $jsonResponseParser
55
	 *
56
	 * @return QueryResult
57
	 */
58 1
	public function newByAskApiHttpRequestQueryResult( Query $query, JsonResponseParser $jsonResponseParser ) {
59
60 1
		$queryResult = new ByAskApiHttpRequestQueryResult(
61 1
			$query->getDescription()->getPrintrequests(),
62 1
			$query,
63 1
			$jsonResponseParser->getResultSubjectList(),
64 1
			$this->store,
0 ignored issues
show
$this->store of type object<SMW\Store> is not a sub-type of object<SMWStore>. It seems like you assume a child class of the class SMW\Store to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
65 1
			$jsonResponseParser->hasFurtherResults()
66 1
		);
67
68 1
		$queryResult->setJsonResponseParser( $jsonResponseParser );
69
70 1
		return $queryResult;
71
	}
72
73
}
74