@@ -1,12 +1,12 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare( strict_types = 1 ); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | namespace ModernTimeline\ResultFacade; |
6 | 6 | |
7 | 7 | interface ResultPresenter { |
8 | 8 | |
9 | 9 | // TODO: add parameter for non-global side effects |
10 | - public function presentResult( SimpleQueryResult $result ): string; |
|
10 | + public function presentResult(SimpleQueryResult $result): string; |
|
11 | 11 | |
12 | 12 | } |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | |
7 | 7 | private $pages; |
8 | 8 | |
9 | - public function __construct( Subject ...$subjects ) { |
|
9 | + public function __construct(Subject ...$subjects) { |
|
10 | 10 | $this->pages = $subjects; |
11 | 11 | } |
12 | 12 | |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | * @param Subject[] $subjects |
15 | 15 | * @return self |
16 | 16 | */ |
17 | - public static function newFromArray( array $subjects ): self { |
|
17 | + public static function newFromArray(array $subjects): self { |
|
18 | 18 | $instance = new self(); |
19 | 19 | $instance->pages = $subjects; |
20 | 20 | return $instance; |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare( strict_types = 1 ); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | namespace ModernTimeline\ResultFacade; |
6 | 6 | |
@@ -18,9 +18,9 @@ discard block |
||
18 | 18 | * @param DIWikiPage $wikiPage |
19 | 19 | * @param PropertyValueCollection[] $propertyValueCollections |
20 | 20 | */ |
21 | - public function __construct( DIWikiPage $wikiPage, array $propertyValueCollections ) { |
|
21 | + public function __construct(DIWikiPage $wikiPage, array $propertyValueCollections) { |
|
22 | 22 | $this->wikiPage = $wikiPage; |
23 | - $this->propertyValueCollections = new PropertyValueCollections( $propertyValueCollections ); |
|
23 | + $this->propertyValueCollections = new PropertyValueCollections($propertyValueCollections); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | public function getWikiPage(): DIWikiPage { |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare( strict_types = 1 ); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | namespace ModernTimeline\ResultFacade; |
6 | 6 | |
@@ -12,12 +12,12 @@ discard block |
||
12 | 12 | private $resultFormats; |
13 | 13 | |
14 | 14 | public function newFormat(): ResultFormatRegistrator { |
15 | - return new ResultFormatRegistrator( function( ResultFormat $info ) { |
|
15 | + return new ResultFormatRegistrator(function(ResultFormat $info) { |
|
16 | 16 | $this->resultFormats[$info->getName()] = $info; |
17 | 17 | } ); |
18 | 18 | } |
19 | 19 | |
20 | - public function getFormatByName( string $name ): ResultFormat { |
|
20 | + public function getFormatByName(string $name): ResultFormat { |
|
21 | 21 | return $this->resultFormats[$name]; |
22 | 22 | } |
23 | 23 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare( strict_types = 1 ); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | namespace ModernTimeline\ResultFacade; |
6 | 6 | |
@@ -11,14 +11,14 @@ discard block |
||
11 | 11 | |
12 | 12 | class ResultSimplifier { |
13 | 13 | |
14 | - public function newSubjectCollection( QueryResult $result ): SubjectCollection { |
|
14 | + public function newSubjectCollection(QueryResult $result): SubjectCollection { |
|
15 | 15 | $subjects = []; |
16 | 16 | |
17 | - foreach ( $result->getResults() as $diWikiPage ) { |
|
18 | - $subjects[] = $this->newSubject( $diWikiPage, $result->getPrintRequests(), $result ); |
|
17 | + foreach ($result->getResults() as $diWikiPage) { |
|
18 | + $subjects[] = $this->newSubject($diWikiPage, $result->getPrintRequests(), $result); |
|
19 | 19 | } |
20 | 20 | |
21 | - return SubjectCollection::newFromArray( $subjects ); |
|
21 | + return SubjectCollection::newFromArray($subjects); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | /** |
@@ -27,11 +27,11 @@ discard block |
||
27 | 27 | * @param QueryResult $result |
28 | 28 | * @return Subject |
29 | 29 | */ |
30 | - private function newSubject( DIWikiPage $resultPage, array $printRequests, QueryResult $result ): Subject { |
|
30 | + private function newSubject(DIWikiPage $resultPage, array $printRequests, QueryResult $result): Subject { |
|
31 | 31 | $propertyValueCollections = []; |
32 | 32 | |
33 | - foreach ( $printRequests as $printRequest ) { |
|
34 | - $dataItems = $this->newResultArray( $resultPage, $printRequest, $result )->getContent(); |
|
33 | + foreach ($printRequests as $printRequest) { |
|
34 | + $dataItems = $this->newResultArray($resultPage, $printRequest, $result)->getContent(); |
|
35 | 35 | |
36 | 36 | $propertyValueCollections[] = new PropertyValueCollection( |
37 | 37 | $printRequest, |
@@ -39,19 +39,19 @@ discard block |
||
39 | 39 | ); |
40 | 40 | } |
41 | 41 | |
42 | - return new Subject( $resultPage, $propertyValueCollections ); |
|
42 | + return new Subject($resultPage, $propertyValueCollections); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
46 | 46 | * Compat with SMW 3.0 |
47 | 47 | * In 3.1+ do: ResultArray::factory( $resultPage, $printRequest, $result ) |
48 | 48 | */ |
49 | - private function newResultArray( DIWikiPage $resultPage, PrintRequest $printRequest, QueryResult $result ): ResultArray { |
|
49 | + private function newResultArray(DIWikiPage $resultPage, PrintRequest $printRequest, QueryResult $result): ResultArray { |
|
50 | 50 | return new ResultArray( |
51 | 51 | $resultPage, |
52 | 52 | $printRequest, |
53 | 53 | $result->getStore(), |
54 | - method_exists( $result, 'getFieldItemFinder' ) ? $result->getFieldItemFinder() : null |
|
54 | + method_exists($result, 'getFieldItemFinder') ? $result->getFieldItemFinder() : null |
|
55 | 55 | ); |
56 | 56 | } |
57 | 57 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare( strict_types = 1 ); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | namespace ModernTimeline\ResultFacade; |
6 | 6 | |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | private $subjects; |
12 | 12 | private $processingResult; |
13 | 13 | |
14 | - public function __construct( SubjectCollection $subjects, ProcessingResult $processingResult ) { |
|
14 | + public function __construct(SubjectCollection $subjects, ProcessingResult $processingResult) { |
|
15 | 15 | $this->subjects = $subjects; |
16 | 16 | $this->processingResult = $processingResult; |
17 | 17 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare( strict_types = 1 ); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | namespace ModernTimeline\ResultFacade; |
6 | 6 | |
@@ -13,32 +13,32 @@ discard block |
||
13 | 13 | private $parameterDefinitions; |
14 | 14 | private $constructionFunction; |
15 | 15 | |
16 | - public function __construct( callable $registry ) { |
|
16 | + public function __construct(callable $registry) { |
|
17 | 17 | $this->registry = $registry; |
18 | 18 | } |
19 | 19 | |
20 | - public function withName( string $name ): self { |
|
20 | + public function withName(string $name): self { |
|
21 | 21 | $this->name = $name; |
22 | 22 | return $this; |
23 | 23 | } |
24 | 24 | |
25 | - public function andMessageKey( string $nameMessageKey ): self { |
|
25 | + public function andMessageKey(string $nameMessageKey): self { |
|
26 | 26 | $this->nameMessageKey = $nameMessageKey; |
27 | 27 | return $this; |
28 | 28 | } |
29 | 29 | |
30 | - public function andParameterDefinitions( array $parameterDefinitions ): self { |
|
30 | + public function andParameterDefinitions(array $parameterDefinitions): self { |
|
31 | 31 | $this->parameterDefinitions = $parameterDefinitions; |
32 | 32 | return $this; |
33 | 33 | } |
34 | 34 | |
35 | - public function andPresenterBuilder( callable $constructionFunction ): self { |
|
35 | + public function andPresenterBuilder(callable $constructionFunction): self { |
|
36 | 36 | $this->constructionFunction = $constructionFunction; |
37 | 37 | return $this; |
38 | 38 | } |
39 | 39 | |
40 | 40 | public function register() { |
41 | - call_user_func( $this->registry, $this->newResultFormat() ); |
|
41 | + call_user_func($this->registry, $this->newResultFormat()); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | private function newResultFormat(): ResultFormat { |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare( strict_types = 1 ); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | namespace ModernTimeline\ResultFacade; |
6 | 6 | |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | private $parameterDefinitions; |
12 | 12 | private $constructionFunction; |
13 | 13 | |
14 | - public function __construct( string $name, string $nameMessageKey, array $parameterDefinitions, callable $presenterBuilder ) { |
|
14 | + public function __construct(string $name, string $nameMessageKey, array $parameterDefinitions, callable $presenterBuilder) { |
|
15 | 15 | $this->name = $name; |
16 | 16 | $this->nameMessageKey = $nameMessageKey; |
17 | 17 | $this->parameterDefinitions = $parameterDefinitions; |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | } |
32 | 32 | |
33 | 33 | public function buildPresenter(): ResultPresenter { |
34 | - return call_user_func( $this->constructionFunction ); |
|
34 | + return call_user_func($this->constructionFunction); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare( strict_types = 1 ); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | namespace ModernTimeline\ResultFacade; |
6 | 6 | |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | * @param PrintRequest $printRequest |
17 | 17 | * @param SMWDataItem[] $dataItems |
18 | 18 | */ |
19 | - public function __construct( PrintRequest $printRequest, array $dataItems ) { |
|
19 | + public function __construct(PrintRequest $printRequest, array $dataItems) { |
|
20 | 20 | $this->printRequest = $printRequest; |
21 | 21 | $this->dataItems = $dataItems; |
22 | 22 | } |