@@ -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 | |
@@ -29,13 +29,13 @@ discard block |
||
| 29 | 29 | $definitions[self::PARAM_WIDTH] = [ |
| 30 | 30 | 'type' => ParameterTypes::DIMENSION, |
| 31 | 31 | 'allowauto' => true, |
| 32 | - 'units' => [ 'px', 'ex', 'em', '%', '' ], |
|
| 32 | + 'units' => ['px', 'ex', 'em', '%', ''], |
|
| 33 | 33 | 'default' => $GLOBALS['wgModernTimelineWidth'], |
| 34 | 34 | ]; |
| 35 | 35 | |
| 36 | 36 | $definitions[self::PARAM_HEIGHT] = [ |
| 37 | 37 | 'type' => ParameterTypes::DIMENSION, |
| 38 | - 'units' => [ 'px', 'ex', 'em', '' ], |
|
| 38 | + 'units' => ['px', 'ex', 'em', ''], |
|
| 39 | 39 | 'default' => $GLOBALS['wgModernTimelineHeight'], |
| 40 | 40 | ]; |
| 41 | 41 | |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | $definitions[self::PARAM_POSITION] = [ |
| 59 | 59 | 'type' => ParameterTypes::STRING, |
| 60 | 60 | 'default' => $GLOBALS['wgModernTimelinePosition'], |
| 61 | - 'values' => [ 'top', 'bottom' ], |
|
| 61 | + 'values' => ['top', 'bottom'], |
|
| 62 | 62 | ]; |
| 63 | 63 | |
| 64 | 64 | $definitions[self::PARAM_TICK_WIDTH] = [ |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | |
| 87 | 87 | $definitions[self::PARAM_NAV_HEIGHT] = [ |
| 88 | 88 | 'type' => ParameterTypes::DIMENSION, |
| 89 | - 'units' => [ 'px', '%' ], |
|
| 89 | + 'units' => ['px', '%'], |
|
| 90 | 90 | 'default' => $GLOBALS['wgModernTimelineNavHeight'], |
| 91 | 91 | ]; |
| 92 | 92 | |
@@ -98,16 +98,16 @@ discard block |
||
| 98 | 98 | $definitions[self::PARAM_IMAGE] = [ |
| 99 | 99 | 'type' => ParameterTypes::STRING, |
| 100 | 100 | 'default' => $GLOBALS['wgModernTimelineImageProperty'], |
| 101 | - 'aliases' => [ 'imageproperty', 'image' ], |
|
| 101 | + 'aliases' => ['imageproperty', 'image'], |
|
| 102 | 102 | ]; |
| 103 | 103 | |
| 104 | - foreach ( $definitions as $name => $definition ) { |
|
| 105 | - $definitions[$name]['message'] = 'modern-timeline-param-' . str_replace( ' ', '-', $name ); |
|
| 104 | + foreach ($definitions as $name => $definition) { |
|
| 105 | + $definitions[$name]['message'] = 'modern-timeline-param-' . str_replace(' ', '-', $name); |
|
| 106 | 106 | |
| 107 | - if ( strpos( $name, ' ' ) !== false ) { |
|
| 107 | + if (strpos($name, ' ') !== false) { |
|
| 108 | 108 | $definitions[$name]['aliases'] = array_merge( |
| 109 | - array_key_exists( 'aliases', $definitions[$name] ) ? (array)$definitions[$name]['aliases'] : [], |
|
| 110 | - [ str_replace( ' ', '', $name ) ] |
|
| 109 | + array_key_exists('aliases', $definitions[$name]) ? (array)$definitions[$name]['aliases'] : [], |
|
| 110 | + [str_replace(' ', '', $name)] |
|
| 111 | 111 | ); |
| 112 | 112 | } |
| 113 | 113 | } |
@@ -119,31 +119,31 @@ discard block |
||
| 119 | 119 | * @param array $parameters |
| 120 | 120 | * @return array |
| 121 | 121 | */ |
| 122 | - public static function processedParamsToJson( array $parameters ): array { |
|
| 122 | + public static function processedParamsToJson(array $parameters): array { |
|
| 123 | 123 | $json = [ |
| 124 | 124 | 'hash_bookmark' => $parameters[self::PARAM_BOOKMARK], |
| 125 | 125 | 'default_bg_color' => $parameters[self::PARAM_BACKGROUND], |
| 126 | 126 | 'scale_factor' => $parameters[self::PARAM_SCALE_FACTOR], |
| 127 | 127 | 'timenav_position' => $parameters[self::PARAM_POSITION], |
| 128 | 128 | 'optimal_tick_width' => $parameters[self::PARAM_TICK_WIDTH], |
| 129 | - 'start_at_slide' => self::getStartAtSlide( $parameters ), |
|
| 129 | + 'start_at_slide' => self::getStartAtSlide($parameters), |
|
| 130 | 130 | 'start_at_end' => $parameters[self::PARAM_START_AT_END], |
| 131 | 131 | 'duration' => $parameters[self::PARAM_TRANSITION_DURATION], |
| 132 | 132 | ]; |
| 133 | 133 | |
| 134 | 134 | $height = $parameters[self::PARAM_NAV_HEIGHT]; |
| 135 | 135 | |
| 136 | - if ( strpos( $height, '%' ) === false ) { |
|
| 137 | - $json['timenav_height'] = (int)substr( $height, 0, -2 ); |
|
| 136 | + if (strpos($height, '%') === false) { |
|
| 137 | + $json['timenav_height'] = (int)substr($height, 0, -2); |
|
| 138 | 138 | } |
| 139 | 139 | else { |
| 140 | - $json['timenav_height_percentage'] = (int)substr( $height, 0, -1 ); |
|
| 140 | + $json['timenav_height_percentage'] = (int)substr($height, 0, -1); |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | return $json; |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | - private static function getStartAtSlide( array $parameters ): int { |
|
| 146 | + private static function getStartAtSlide(array $parameters): int { |
|
| 147 | 147 | return $parameters[self::PARAM_START_SLIDE] - 1; |
| 148 | 148 | } |
| 149 | 149 | |
@@ -135,8 +135,7 @@ |
||
| 135 | 135 | |
| 136 | 136 | if ( strpos( $height, '%' ) === false ) { |
| 137 | 137 | $json['timenav_height'] = (int)substr( $height, 0, -2 ); |
| 138 | - } |
|
| 139 | - else { |
|
| 138 | + } else { |
|
| 140 | 139 | $json['timenav_height_percentage'] = (int)substr( $height, 0, -1 ); |
| 141 | 140 | } |
| 142 | 141 | |
@@ -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\SlidePresenter; |
| 6 | 6 | |
@@ -8,6 +8,6 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | interface SlidePresenter { |
| 10 | 10 | |
| 11 | - public function getText( Subject $subject ): string; |
|
| 11 | + public function getText(Subject $subject): string; |
|
| 12 | 12 | |
| 13 | 13 | } |
@@ -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 | } |
@@ -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; |
| 6 | 6 | |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | return $this->imageUrl; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - public function setImageUrl( string $url ): void { |
|
| 41 | + public function setImageUrl(string $url): void { |
|
| 42 | 42 | $this->imageUrl = $url; |
| 43 | 43 | } |
| 44 | 44 | |
@@ -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 | |
@@ -20,32 +20,32 @@ discard block |
||
| 20 | 20 | */ |
| 21 | 21 | private $constructionFunction; |
| 22 | 22 | |
| 23 | - public function __construct( callable $registry ) { |
|
| 23 | + public function __construct(callable $registry) { |
|
| 24 | 24 | $this->registry = $registry; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - public function withName( string $name ): self { |
|
| 27 | + public function withName(string $name): self { |
|
| 28 | 28 | $this->name = $name; |
| 29 | 29 | return $this; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - public function andMessageKey( string $nameMessageKey ): self { |
|
| 32 | + public function andMessageKey(string $nameMessageKey): self { |
|
| 33 | 33 | $this->nameMessageKey = $nameMessageKey; |
| 34 | 34 | return $this; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - public function andParameterDefinitions( array $parameterDefinitions ): self { |
|
| 37 | + public function andParameterDefinitions(array $parameterDefinitions): self { |
|
| 38 | 38 | $this->parameterDefinitions = $parameterDefinitions; |
| 39 | 39 | return $this; |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - public function andPresenterBuilder( callable $constructionFunction ): self { |
|
| 42 | + public function andPresenterBuilder(callable $constructionFunction): self { |
|
| 43 | 43 | $this->constructionFunction = $constructionFunction; |
| 44 | 44 | return $this; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | public function register(): void { |
| 48 | - call_user_func( $this->registry, $this->newResultFormat() ); |
|
| 48 | + call_user_func($this->registry, $this->newResultFormat()); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | 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 | |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | private DIWikiPage $wikiPage, |
| 22 | 22 | array $propertyValueCollections |
| 23 | 23 | ) { |
| 24 | - $this->propertyValueCollections = new PropertyValueCollections( $propertyValueCollections ); |
|
| 24 | + $this->propertyValueCollections = new PropertyValueCollections($propertyValueCollections); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | 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 | |
@@ -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,11 +39,11 @@ 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 | - private function newResultArray( DIWikiPage $resultPage, PrintRequest $printRequest, QueryResult $result ): ResultArray { |
|
| 46 | - return ResultArray::factory( $resultPage, $printRequest, $result ); |
|
| 45 | + private function newResultArray(DIWikiPage $resultPage, PrintRequest $printRequest, QueryResult $result): ResultArray { |
|
| 46 | + return ResultArray::factory($resultPage, $printRequest, $result); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | } |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare( strict_types = 1 ); |
|
| 3 | +declare(strict_types=1); |
|
| 4 | 4 | |
| 5 | 5 | namespace ModernTimeline\ResultFacade; |
| 6 | 6 | |