@throws \InvalidArgumentException if callable for a given namespace\function does not exist

@param string $functionName
@param string $namespace

@return Callable
179233
public function get($namespace, $functionName)
    {
        if (false == isset($this->callables["$namespace\\$functionName"])) {
            throw new \InvalidArgumentException(
                \sprintf('Cannot find a callable related to %s()',
                "$namespace\\$functionName"
            ));
        }

        return $this->callables["$namespace\\$functionName"]['callable'];
    }
899299
public function withAction(string $actionName)
    {
        if (!isset($this->actions[$actionName])) {
            throw InvalidArgumentException::format(
                'Invalid action name supplied to %s: expecting one of (%s), \'%s\' given',
                __METHOD__, Debug::formatValues(array_keys($this->actions)), $actionName
            );
        }

        call_user_func($this->callback, new ActionWidget($this->name, $this->label, $this->authSystem, $this->requiredPermissions, $this->actions[$actionName]));
    }
469528
private static function setCache(Cache &$cacheToChange = null, Cache $cache = null, $namespace = null)
    {
        if ($namespace === null) {
            $namespace = self::$cacheDefaultNamespace;
        }
        if (!is_string($namespace)) {
            throw new \InvalidArgumentException("The namespace must be a string.");
        }

        $cacheToChange = $cache;
        if ($cache !== null) {
            $cacheToChange->setNamespace($namespace);
        }
    }
1308453
private function isBaseFunctionAvailable($functionName)
    {
        foreach (get_class_methods($this) as $responderMethodName) {
            if (strpos($responderMethodName, $functionName) === 0) {
                return true;
            }
        }

        return false;
    }
1096930
private function callOnce ($fn) 
    {
        return function (...$args) use ($fn) {
            if ($fn === null) return;
            $fn(...$args);
            $fn = null;
        };
    }
808195
public function call($key, $callable)
    {
        if (!is_callable($callable)) {
            throw new \InvalidArgumentException('Not a valid callable.');
        }

        if ($this->exists($key)) {
            return $this->get($key);
        }

        $args = func_get_args();
        array_shift($args);
        array_shift($args);

        $value = call_user_func_array($callable, $args);

        $this->set($key, $value);

        return $value;
    }
513789
public function getFunctionCompiler($class)
    {
        if (!isset($this->functionCompilers[ $class ])) {
            $this->functionCompilers[ $class ] = new $class;
            if (!$this->functionCompilers[ $class ] instanceof FunctionCompiler) {
                throw new \InvalidArgumentException(
                    "Class {$class} is not an instance of FunctionCompiler"
                );
            }
        }

        return $this->functionCompilers[ $class ];
    }
225387
public function resolveNS($ns)
    {
        if ($ns[0] !== '@') {
            return $ns;
        }

        $parts = explode('\\', $ns, 2);

        $alias = $parts[0];
        if (!isset($this->_aliases[$alias])) {
            throw new InvalidArgumentException(['`:alias` is not exists for `:namespace`', 'alias' => $alias, 'namespace' => $ns]);
        }

        return $this->_aliases[$alias] . (isset($parts[1]) ? '\\' . $parts[1] : '');
    }
1344937
public function setFunc($func)
    {
        if ($func === null) {
            $this->func = $func;
            return $this;
        }

        if (!is_string($func)) {
            throw new InvalidArgumentException(
                'Function name should be a string.'
            );
        }

        $func = strtoupper($func);
        if (!in_array($func, $this->validFunc())) {
            throw new InvalidArgumentException(sprintf(
                'Function "%s" not allowed in this context.',
                $func
            ));
        }

        $this->func = $func;
        return $this;
    }
1288226
public function fire(string $name, ...$functionArguments)
    {
        $name = $this->normalizeName($name);
        if (isset($this->stack[$name])) {
            $event = $this->stack[$name];

            // remove if once
            if ($event->isOnce()) {
                $this->off($name);
            }

            $function = $event->getFunction();
            $functionArguments = array_merge($event->getFunctionArguments(), $functionArguments);

            return call_user_func_array($function, $functionArguments);
        }

        return null; // no event found
    }
985728
public function extend($fn)
    {
        if (is_string($fn) && file_exists($fn)) {
            $fn = include $fn;
        }

        if (is_callable($fn)) {
            return call_user_func($fn, $this);
        }

        throw new \InvalidArgumentException('Assertion::extend requires a callable or a file that returns one');
    }
94996
public function setPathForNamespace($namespace, $path)
    {
        $unifiedNamespace = $this->unifyNamespace($namespace);
        if (!preg_match('/^[a-zA-Z0-9_\\\]{3,}$/', $unifiedNamespace)) {
            throw new InvalidArgumentException("Invalid namespace {$namespace}");
        }

        $this->namespaces[$unifiedNamespace] = $path;

        return $this;
    }
1263210
public static function qualifiedClassName($className, $namespace)
    {
        if (empty($className)) {
            throw new \InvalidArgumentException('Class name cannot be empty.');
        }

        if (empty($namespace)) {
            throw new \InvalidArgumentException('Current namespace cannot be empty.');
        }

        $className = trim($className, '\\');
        $len = strlen($namespace);

        if (strlen($className) > $len && ($namespace . '\\') === substr($className, 0, $len + 1)) {
            return substr($className, $len + 1);
        }

        return $className;
    }
195134
public function annotatedWith($annotationName) : AbstractMatcher
    {
        if (! class_exists($annotationName)) {
            throw new InvalidAnnotationException($annotationName);
        }

        return new AnnotatedMatcher(__FUNCTION__, [$annotationName]);
    }
409089
function nest(Container $container, $namespace = null)
    {
        // Use Container Namespace if not provided as argument
        ($namespace !== null) ?: $namespace = $container->getName();

        if ($namespace === null || $namespace === '')
            throw new \InvalidArgumentException(
                'Namespace can`t be empty.'
            );

        $cNamespace = $this->_normalizeNamespace($namespace);
        if (isset($this->__nestRight[$cNamespace]))
            throw new \InvalidArgumentException(sprintf(
                'Namespace (%s) is exists on container:%s'
                , $namespace , $this->getPath()
            ));

        $nestedCnt = $container;
        $nestedCnt->__nestLeft = $this; // set parent container
        $nestedCnt->setName($namespace);
        $this->__nestRight[$cNamespace] = $nestedCnt;
        return $this;
    }
56111
public static function loadCustom($classname, $namespace, $name) {

		if(false === is_string($classname)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($classname)), E_USER_ERROR);
		}

		if(false === is_string($namespace)) {
			return trigger_error(sprintf('Argument 2 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($namespace)), E_USER_ERROR);
		}

		if(false === is_string($name)) {
			return trigger_error(sprintf('Argument 3 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($name)), E_USER_ERROR);
		}

		static :: $custom[$name] = $namespace;

		return static :: Instance();
	}
1255814
public function setNamespace($namespace)
    {
        if (!is_string($namespace)) {
            throw new \InvalidArgumentException('The attribute namespace on the class Entity has to be string (' . gettype($namespace) . ('object' === gettype($namespace) ? ' ' . get_class($namespace) : '') . ' given).');
        }

        if (strlen($namespace) < 1) {
            throw new \InvalidArgumentException('On the attribute namespace, the length of the string ' . $namespace . ' is ' . strlen($namespace) . ' which is shorter than the minimum allowed (1).');
        }

        $this->namespace = $namespace;

        return $this;
    }