supportedParams ) ) { throw new InvalidInfoboxParamsException( $param ); } } return true; } /** * validates if argument is valid color value. Currently only hex values are supported * @param string $color * @return bool * @throws InvalidColorValueException */ public function validateColorValue( $color ) { return !empty( preg_match( '/^(#[a-f0-9]{3}([a-f0-9]{3})?)$/i', $color ) ); } /** * checks if given layout name is supported * @param string $layoutName * @return bool */ public function validateLayout( $layoutName ) { return $layoutName && in_array( $layoutName, $this->supportedLayouts ); } } class InvalidInfoboxParamsException extends \Exception { }