public function isAllowed($sourceType, $throwException = TRUE)
{
try {
switch ($sourceType) {
case self::IS_FILE:
if (!($this[self::IS_FILE] || $this[self::ALLOW_FILE])) {
throw new InvalidSource\TypeFile('File source not allowed.');
}
break;
case self::IS_STRING:
if ($this[self::IS_FILE]) {
throw new InvalidSource\TypeString('File source expected.');
}
break;
}
} catch (\LogicException $e) {
if ($throwException) {
throw $e;
}
return FALSE;
}
return TRUE;
}