reformat files

This commit is contained in:
idradm 2016-12-28 13:09:26 +01:00
parent 28c4d0051d
commit a5eff3e363
2 changed files with 13 additions and 13 deletions

View file

@ -118,7 +118,7 @@ class PortableInfoboxParserTagController extends WikiaController {
}
$marker = $parser->uniqPrefix() . "-" . self::PARSER_TAG_NAME . "-{$this->markerNumber}" . Parser::MARKER_SUFFIX;
$this->markers[ $marker ] = $renderedValue;
$this->markers[$marker] = $renderedValue;
return [ $marker, 'markerType' => 'nowiki' ];
}
@ -130,7 +130,7 @@ class PortableInfoboxParserTagController extends WikiaController {
*/
public function moveFirstMarkerToTop( &$text ) {
if ( !empty( $this->markers ) ) {
$firstMarker = array_keys( $this->markers )[ 0 ];
$firstMarker = array_keys( $this->markers )[0];
// Skip if the first marker is already at the top
if ( strpos( $text, $firstMarker ) !== 0 ) {
@ -175,14 +175,14 @@ class PortableInfoboxParserTagController extends WikiaController {
private function getThemes( $params, PPFrame $frame ) {
$themes = [ ];
if ( isset( $params[ 'theme' ] ) ) {
$staticTheme = trim( $params[ 'theme' ] );
if ( isset( $params['theme'] ) ) {
$staticTheme = trim( $params['theme'] );
if ( !empty ( $staticTheme ) ) {
$themes[] = $staticTheme;
}
}
if ( !empty( $params[ 'theme-source' ] ) ) {
$variableTheme = trim( $frame->getArgument( $params[ 'theme-source' ] ) );
if ( !empty( $params['theme-source'] ) ) {
$variableTheme = trim( $frame->getArgument( $params['theme-source'] ) );
if ( !empty( $variableTheme ) ) {
$themes[] = $variableTheme;
}
@ -197,7 +197,7 @@ class PortableInfoboxParserTagController extends WikiaController {
}
private function getLayout( $params ) {
$layoutName = isset( $params[ 'layout' ] ) ? $params[ 'layout' ] : false;
$layoutName = isset( $params['layout'] ) ? $params['layout'] : false;
if ( $layoutName && in_array( $layoutName, $this->supportedLayouts ) ) {
//make sure no whitespaces, prevents side effects
return self::INFOBOX_LAYOUT_PREFIX . $layoutName;

View file

@ -50,7 +50,7 @@ class PortableInfoboxParserTagControllerTest extends WikiaBaseTest {
$text = '';
$marker = $this->controller->renderInfobox( $text, [ ], $this->parser,
$this->parser->getPreprocessor()->newFrame() )[ 0 ];
$this->parser->getPreprocessor()->newFrame() )[0];
$output = $this->controller->replaceMarkers( $marker );
$this->assertEquals( $output, '', 'Should be empty' );
@ -65,7 +65,7 @@ class PortableInfoboxParserTagControllerTest extends WikiaBaseTest {
$marker = $this->controller->renderInfobox( $text,
[ 'theme' => $staticTheme, 'theme-source' => 'testVar' ],
$this->parser,
$this->parser->getPreprocessor()->newCustomFrame( [ 'testVar' => $variableTheme ] ) )[ 0 ];
$this->parser->getPreprocessor()->newCustomFrame( [ 'testVar' => $variableTheme ] ) )[0];
$output = $this->controller->replaceMarkers( $marker );
$this->assertTrue( array_reduce( $classes, function ( $result, $class ) use ( $output ) {
@ -104,7 +104,7 @@ class PortableInfoboxParserTagControllerTest extends WikiaBaseTest {
*/
public function testGetLayout( $layout, $expectedOutput, $text, $message ) {
$marker = $this->controller->renderInfobox( $text, $layout, $this->parser,
$this->parser->getPreprocessor()->newFrame() )[ 0 ];
$this->parser->getPreprocessor()->newFrame() )[0];
$output = $this->controller->replaceMarkers( $marker );
$this->assertTrue( $this->containsClassName(
@ -164,7 +164,7 @@ class PortableInfoboxParserTagControllerTest extends WikiaBaseTest {
<data source="3"><label>3</label></data>';
$marker = $this->controller->renderInfobox( $text, [ ], $this->parser,
$this->parser->getPreprocessor()->newCustomFrame( $params ) )[ 0 ];
$this->parser->getPreprocessor()->newCustomFrame( $params ) )[0];
$output = $this->controller->replaceMarkers( $marker );
$result = [ ];
@ -173,8 +173,8 @@ class PortableInfoboxParserTagControllerTest extends WikiaBaseTest {
$dataNodes = $xpath->query( '//aside/div[contains(@class,\'pi-data\')]' );
for ( $i = 0; $i < $dataNodes->length; $i++ ) {
// get map of label => value from parsed data node
$result[ $xpath->query( 'h3[contains(@class, \'pi-data-label\')]', $dataNodes->item( $i ) )
->item( 0 )->nodeValue ] =
$result[$xpath->query( 'h3[contains(@class, \'pi-data-label\')]', $dataNodes->item( $i ) )
->item( 0 )->nodeValue] =
$xpath->query( 'div[contains(@class, \'pi-data-value\')]', $dataNodes->item( $i ) )
->item( 0 )->nodeValue;
}