Puli\Repository\Api\UnsupportedLanguageException::forLanguage PHP Method

forLanguage() public static method

Creates an exception for an unsupported language string.
public static forLanguage ( string $language, Exception $cause = null ) : static
$language string The unsupported language.
$cause Exception The exception that caused this exception.
return static The created exception.
    public static function forLanguage($language, Exception $cause = null)
    {
        return new static(sprintf('The language "%s" is not supported.', $language), 0, $cause);
    }

Usage Example

 /**
  * {@inheritdoc}
  */
 public function unbind($query, $typeName = null, array $parameterValues = null, $language = null)
 {
     if (null !== $language && 'glob' !== $language) {
         throw UnsupportedLanguageException::forLanguage($language);
     }
     if (null !== $typeName) {
         $this->removeBindingsByQueryAndType($query, $typeName, $parameterValues);
         return;
     }
     $this->removeBindingsByQuery($query, $parameterValues);
 }
All Usage Examples Of Puli\Repository\Api\UnsupportedLanguageException::forLanguage
UnsupportedLanguageException