@@ -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; |
| 6 | 6 | |
@@ -28,23 +28,23 @@ discard block |
||
| 28 | 28 | $registry = new ResultFormatRegistry(); |
| 29 | 29 | |
| 30 | 30 | $registry->newFormat() |
| 31 | - ->withName( 'moderntimeline' ) |
|
| 32 | - ->andMessageKey( 'modern-timeline-format-name' ) |
|
| 33 | - ->andParameterDefinitions( TimelineOptions::getTimelineParameterDefinitions() ) |
|
| 34 | - ->andPresenterBuilder( function() { |
|
| 31 | + ->withName('moderntimeline') |
|
| 32 | + ->andMessageKey('modern-timeline-format-name') |
|
| 33 | + ->andParameterDefinitions(TimelineOptions::getTimelineParameterDefinitions()) |
|
| 34 | + ->andPresenterBuilder(function() { |
|
| 35 | 35 | return new TimelinePresenter(); |
| 36 | 36 | } ) |
| 37 | 37 | ->register(); |
| 38 | 38 | |
| 39 | - $this->format = $registry->getFormatByName( 'moderntimeline' ); |
|
| 39 | + $this->format = $registry->getFormatByName('moderntimeline'); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | public function getName(): string { |
| 43 | - return wfMessage( $this->format->getNameMessageKey() )->text(); |
|
| 43 | + return wfMessage($this->format->getNameMessageKey())->text(); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - public function getParamDefinitions( array $definitions ) { |
|
| 47 | - return array_merge( $definitions, $this->format->getParameterDefinitions() ); |
|
| 46 | + public function getParamDefinitions(array $definitions) { |
|
| 47 | + return array_merge($definitions, $this->format->getParameterDefinitions()); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | /** |
@@ -54,36 +54,36 @@ discard block |
||
| 54 | 54 | * |
| 55 | 55 | * @return string |
| 56 | 56 | */ |
| 57 | - public function getResult( QueryResult $result, array $parameters, $outputMode ): string { |
|
| 57 | + public function getResult(QueryResult $result, array $parameters, $outputMode): string { |
|
| 58 | 58 | return $this->format->buildPresenter()->presentResult( |
| 59 | 59 | new SimpleQueryResult( |
| 60 | - $this->simplifyResult( $result ), |
|
| 61 | - $this->newProcessingResultFromParams( $parameters ) |
|
| 60 | + $this->simplifyResult($result), |
|
| 61 | + $this->newProcessingResultFromParams($parameters) |
|
| 62 | 62 | ) |
| 63 | 63 | ); |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - private function simplifyResult( QueryResult $result ): SubjectCollection { |
|
| 67 | - return ( new ResultSimplifier() )->newSubjectCollection( $result ); |
|
| 66 | + private function simplifyResult(QueryResult $result): SubjectCollection { |
|
| 67 | + return (new ResultSimplifier())->newSubjectCollection($result); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | /** |
| 71 | 71 | * This is code copied over from ParamProcessor to go from the deprecated Param[] to ProcessingResult. |
| 72 | 72 | * Once the main ResultPrinter interface has been migrated away from Param this can be removed. |
| 73 | 73 | */ |
| 74 | - private function newProcessingResultFromParams( array $params ): ProcessingResult { |
|
| 74 | + private function newProcessingResultFromParams(array $params): ProcessingResult { |
|
| 75 | 75 | $parameters = []; |
| 76 | 76 | |
| 77 | - foreach ( $params as $param ) { |
|
| 77 | + foreach ($params as $param) { |
|
| 78 | 78 | $processedParam = new ProcessedParam( |
| 79 | 79 | $param->getName(), |
| 80 | 80 | $param->getValue(), |
| 81 | 81 | $param->wasSetToDefault() |
| 82 | 82 | ); |
| 83 | 83 | |
| 84 | - if ( !$param->wasSetToDefault() ) { |
|
| 85 | - $processedParam->setOriginalName( $param->getOriginalName() ); |
|
| 86 | - $processedParam->setOriginalValue( $param->getOriginalValue() ); |
|
| 84 | + if (!$param->wasSetToDefault()) { |
|
| 85 | + $processedParam->setOriginalName($param->getOriginalName()); |
|
| 86 | + $processedParam->setOriginalValue($param->getOriginalValue()); |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | $parameters[$processedParam->getName()] = $processedParam; |
@@ -95,11 +95,11 @@ discard block |
||
| 95 | 95 | ); |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - public function getQueryMode( $context ): int { |
|
| 98 | + public function getQueryMode($context): int { |
|
| 99 | 99 | return SMWQuery::MODE_INSTANCES; |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - public function setShowErrors( $show ) { |
|
| 102 | + public function setShowErrors($show) { |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | public function isExportFormat(): bool { |
@@ -118,6 +118,6 @@ discard block |
||
| 118 | 118 | return false; |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - public function setRecursiveTextProcessor( RecursiveTextProcessor $recursiveTextProcessor ) { |
|
| 121 | + public function setRecursiveTextProcessor(RecursiveTextProcessor $recursiveTextProcessor) { |
|
| 122 | 122 | } |
| 123 | 123 | } |
@@ -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 | |