$this->variants = $variants;
// Expand shorthands:
- // array( "en,de,fr" => "foo.svg" ) → array( "en" => "foo.svg", "de" => "foo.svg", "fr" => "foo.svg" )
+ // array( "en,de,fr" => "foo.svg" )
+ // → array( "en" => "foo.svg", "de" => "foo.svg", "fr" => "foo.svg" )
if ( is_array( $this->descriptor ) && isset( $this->descriptor['lang'] ) ) {
foreach ( array_keys( $this->descriptor['lang'] ) as $langList ) {
if ( strpos( $langList, ',' ) !== false ) {
} );
$extensions = array_unique( $extensions );
if ( count( $extensions ) !== 1 ) {
- throw new InvalidArgumentException( "File type for different image files of '$name' not the same" );
+ throw new InvalidArgumentException(
+ "File type for different image files of '$name' not the same"
+ );
}
$ext = $extensions[0];
if ( !isset( self::$fileTypes[$ext] ) ) {
- throw new InvalidArgumentException( "Invalid file type for image files of '$name' (valid: svg, png, gif, jpg)" );
+ throw new InvalidArgumentException(
+ "Invalid file type for image files of '$name' (valid: svg, png, gif, jpg)"
+ );
}
$this->extension = $ext;
}
$prefix = isset( $options['prefix'] ) && $options['prefix'];
$selector = isset( $options['selector'] ) && $options['selector'];
- $selectorWithoutVariant = isset( $options['selectorWithoutVariant'] ) && $options['selectorWithoutVariant'];
- $selectorWithVariant = isset( $options['selectorWithVariant'] ) && $options['selectorWithVariant'];
+ $selectorWithoutVariant = isset( $options['selectorWithoutVariant'] )
+ && $options['selectorWithoutVariant'];
+ $selectorWithVariant = isset( $options['selectorWithVariant'] )
+ && $options['selectorWithVariant'];
if ( $selectorWithoutVariant && !$selectorWithVariant ) {
- throw new InvalidArgumentException( "Given 'selectorWithoutVariant' but no 'selectorWithVariant'." );
+ throw new InvalidArgumentException(
+ "Given 'selectorWithoutVariant' but no 'selectorWithVariant'."
+ );
}
if ( $selectorWithVariant && !$selectorWithoutVariant ) {
- throw new InvalidArgumentException( "Given 'selectorWithVariant' but no 'selectorWithoutVariant'." );
+ throw new InvalidArgumentException(
+ "Given 'selectorWithVariant' but no 'selectorWithoutVariant'."
+ );
}
if ( $selector && $selectorWithVariant ) {
- throw new InvalidArgumentException( "Incompatible 'selector' and 'selectorWithVariant'+'selectorWithoutVariant' given." );
+ throw new InvalidArgumentException(
+ "Incompatible 'selector' and 'selectorWithVariant'+'selectorWithoutVariant' given."
+ );
}
if ( !$prefix && !$selector && !$selectorWithVariant ) {
- throw new InvalidArgumentException( "None of 'prefix', 'selector' or 'selectorWithVariant'+'selectorWithoutVariant' given." );
+ throw new InvalidArgumentException(
+ "None of 'prefix', 'selector' or 'selectorWithVariant'+'selectorWithoutVariant' given."
+ );
}
foreach ( $options as $member => $option ) {
array( 'Types' => array( 'AssocAsObject' => true ) ),
(object)array(
'defaultArray' => array( 'b', 'c', 'a', ApiResult::META_TYPE => 'array' ),
- 'defaultAssoc' => (object)array( 'x' => 'a', 1 => 'b', 0 => 'c', ApiResult::META_TYPE => 'assoc' ),
- 'defaultAssoc2' => (object)array( 2 => 'a', 3 => 'b', 0 => 'c', ApiResult::META_TYPE => 'assoc' ),
+ 'defaultAssoc' => (object)array( 'x' => 'a',
+ 1 => 'b', 0 => 'c', ApiResult::META_TYPE => 'assoc'
+ ),
+ 'defaultAssoc2' => (object)array( 2 => 'a', 3 => 'b',
+ 0 => 'c', ApiResult::META_TYPE => 'assoc'
+ ),
'array' => array( 'a', 'c', 'b', ApiResult::META_TYPE => 'array' ),
'BCarray' => array( 'a', 'c', 'b', ApiResult::META_TYPE => 'array' ),
'BCassoc' => (object)array( 'a', 'b', 'c', ApiResult::META_TYPE => 'assoc' ),
array( 'Types' => array( 'ArmorKVP' => 'name', 'AssocAsObject' => true ) ),
(object)array(
'defaultArray' => array( 'b', 'c', 'a', ApiResult::META_TYPE => 'array' ),
- 'defaultAssoc' => (object)array( 'x' => 'a', 1 => 'b', 0 => 'c', ApiResult::META_TYPE => 'assoc' ),
- 'defaultAssoc2' => (object)array( 2 => 'a', 3 => 'b', 0 => 'c', ApiResult::META_TYPE => 'assoc' ),
+ 'defaultAssoc' => (object)array( 'x' => 'a', 1 => 'b',
+ 0 => 'c', ApiResult::META_TYPE => 'assoc'
+ ),
+ 'defaultAssoc2' => (object)array( 2 => 'a', 3 => 'b',
+ 0 => 'c', ApiResult::META_TYPE => 'assoc'
+ ),
'array' => array( 'a', 'c', 'b', ApiResult::META_TYPE => 'array' ),
'BCarray' => array( 'a', 'c', 'b', ApiResult::META_TYPE => 'array' ),
'BCassoc' => (object)array( 'a', 'b', 'c', ApiResult::META_TYPE => 'assoc' ),
if ( preg_match( '/Use of ApiResult::\S+ was deprecated in MediaWiki \d+.\d+\./', $errstr ) ) {
return true;
}
- if ( preg_match( '/Use of ApiMain to ApiResult::__construct was deprecated in MediaWiki \d+.\d+\./', $errstr ) ) {
+ if ( preg_match( '/Use of ApiMain to ApiResult::__construct ' .
+ 'was deprecated in MediaWiki \d+.\d+\./', $errstr ) ) {
return true;
}
return false;
$result = new ApiResult( 8388608 );
$result->setMainForContinuation( $main );
- $result->beginContinuation( '||mock2', array_slice( $allModules, 0, 2 ), array( 'mock1', 'mock2' ) );
+ $result->beginContinuation( '||mock2', array_slice( $allModules, 0, 2 ),
+ array( 'mock1', 'mock2' ) );
try {
$result->setContinueParam( $allModules[1], 'm2continue', 1 );
$this->fail( 'Expected exception not thrown' );
$this->fail( 'Expected exception not thrown' );
} catch ( UnexpectedValueException $ex ) {
$this->assertSame(
- 'Module \'mocklist\' called ApiContinuationManager::addContinueParam but was not passed to ApiContinuationManager::__construct',
+ 'Module \'mocklist\' called ApiContinuationManager::addContinueParam ' .
+ 'but was not passed to ApiContinuationManager::__construct',
$ex->getMessage(),
'Expected exception'
);
$this->fail( 'Expected exception not thrown' );
} catch ( UnexpectedValueException $ex ) {
$this->assertSame(
- 'ApiResultTestSerializableObject::serializeForApiResult() returned an object of class ApiResultTestStringifiableObject',
+ 'ApiResultTestSerializableObject::serializeForApiResult() ' .
+ 'returned an object of class ApiResultTestStringifiableObject',
$ex->getMessage(),
'Expected exception'
);
$this->fail( 'Expected exception not thrown' );
} catch ( UnexpectedValueException $ex ) {
$this->assertSame(
- 'ApiResultTestSerializableObject::serializeForApiResult() returned an invalid value: Cannot add non-finite floats to ApiResult',
+ 'ApiResultTestSerializableObject::serializeForApiResult() ' .
+ 'returned an invalid value: Cannot add non-finite floats to ApiResult',
$ex->getMessage(),
'Expected exception'
);