* to $wgResourceBasePath
*
* Below is a description for the $options array:
- * @throws MWException
+ * @throws InvalidArgumentException
* @par Construction options:
* @code
* array(
case 'skinScripts':
case 'skinStyles':
if ( !is_array( $option ) ) {
- throw new MWException(
+ throw new InvalidArgumentException(
"Invalid collated file path list error. " .
"'$option' given, array expected."
);
}
foreach ( $option as $key => $value ) {
if ( !is_string( $key ) ) {
- throw new MWException(
+ throw new InvalidArgumentException(
"Invalid collated file path list key error. " .
"'$key' given, string expected."
);
* @param string|array $descriptor Path to image file, or array structure containing paths
* @param string $basePath Directory to which paths in descriptor refer
* @param array $variants
- * @throws MWException
+ * @throws InvalidArgumentException
*/
public function __construct( $name, $module, $descriptor, $basePath, $variants ) {
$this->name = $name;
} );
$extensions = array_unique( $extensions );
if ( count( $extensions ) !== 1 ) {
- throw new MWException( "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 MWException( "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;
}
* ),
* )
* @endcode
- * @throws MWException
+ * @throws InvalidArgumentException
*/
public function __construct( $options = array(), $localBasePath = null ) {
$this->localBasePath = self::extractLocalBasePath( $options, $localBasePath );
$selectorWithVariant = isset( $options['selectorWithVariant'] ) && $options['selectorWithVariant'];
if ( $selectorWithoutVariant && !$selectorWithVariant ) {
- throw new MWException( "Given 'selectorWithoutVariant' but no 'selectorWithVariant'." );
+ throw new InvalidArgumentException( "Given 'selectorWithoutVariant' but no 'selectorWithVariant'." );
}
if ( $selectorWithVariant && !$selectorWithoutVariant ) {
- throw new MWException( "Given 'selectorWithVariant' but no 'selectorWithoutVariant'." );
+ throw new InvalidArgumentException( "Given 'selectorWithVariant' but no 'selectorWithoutVariant'." );
}
if ( $selector && $selectorWithVariant ) {
- throw new MWException( "Incompatible 'selector' and 'selectorWithVariant'+'selectorWithoutVariant' given." );
+ throw new InvalidArgumentException( "Incompatible 'selector' and 'selectorWithVariant'+'selectorWithoutVariant' given." );
}
if ( !$prefix && !$selector && !$selectorWithVariant ) {
- throw new MWException( "None of 'prefix', 'selector' or 'selectorWithVariant'+'selectorWithoutVariant' given." );
+ throw new InvalidArgumentException( "None of 'prefix', 'selector' or 'selectorWithVariant'+'selectorWithoutVariant' given." );
}
foreach ( $options as $member => $option ) {
case 'images':
case 'variants':
if ( !is_array( $option ) ) {
- throw new MWException(
+ throw new InvalidArgumentException(
"Invalid list error. '$option' given, array expected."
);
}