public static function reflectionFunction($function, $arguments = []) {
        $method = is_array($function);

        if($method) {
            $reflection = new ReflectionMethod($function[0], $function[1]);
        }
        else {
            $reflection = new ReflectionFunction($function);
        }

        $args = self::getReflectionArgs($reflection, $arguments, $missing);

        if($missing) {
            $name = $reflection->getName();
            $parts = [];
            foreach($missing as $key => $name) {
                $parts[] = "'$name' (or '$key')";
            }
            $missing = implode(", ", $parts);
            throw new Exception("Can not call function '$name'. Argument(s) $missing need to be set.");
        }

        return $method ? $reflection->invokeArgs($function[0], $args) : $reflection->invokeArgs($args);
    }