NamespaceNotFoundException example

if ($alternatives = $this->findAlternatives($namespace$allNamespaces)) {
                if (1 == \count($alternatives)) {
                    $message .= "\n\nDid you mean this?\n ";
                } else {
                    $message .= "\n\nDid you mean one of these?\n ";
                }

                $message .= implode("\n ", $alternatives);
            }

            throw new NamespaceNotFoundException($message$alternatives);
        }

        $exact = \in_array($namespace$namespaces, true);
        if (\count($namespaces) > 1 && !$exact) {
            throw new NamespaceNotFoundException(sprintf("The namespace \"%s\" is ambiguous.\nDid you mean one of these?\n%s.", $namespace$this->getAbbreviationSuggestions(array_values($namespaces)))array_values($namespaces));
        }

        return $exact ? $namespace : reset($namespaces);
    }

    /** * Finds a command by name or alias. * * Contrary to get, this command tries to find the best * match if you give it an abbreviation of a name or alias. * * @return Command * * @throws CommandNotFoundException When command name is incorrect or ambiguous */
if ($alternatives = $this->findAlternatives($namespace$allNamespaces)) {
                if (1 == \count($alternatives)) {
                    $message .= "\n\nDid you mean this?\n ";
                } else {
                    $message .= "\n\nDid you mean one of these?\n ";
                }

                $message .= implode("\n ", $alternatives);
            }

            throw new NamespaceNotFoundException($message$alternatives);
        }

        $exact = \in_array($namespace$namespaces, true);
        if (\count($namespaces) > 1 && !$exact) {
            throw new NamespaceNotFoundException(sprintf("The namespace \"%s\" is ambiguous.\nDid you mean one of these?\n%s.", $namespace$this->getAbbreviationSuggestions(array_values($namespaces)))array_values($namespaces));
        }

        return $exact ? $namespace : reset($namespaces);
    }

    /** * Finds a command by name or alias. * * Contrary to get, this command tries to find the best * match if you give it an abbreviation of a name or alias. * * @return Command * * @throws CommandNotFoundException When command name is incorrect or ambiguous */
Home | Imprint | This part of the site doesn't use cookies.