Phrozn\Runner\CommandLine\Commands::getInstance PHP Метод

getInstance() публичный статический Метод

public static getInstance ( )
    public static function getInstance()
    {
        if (null === self::$instance) {
            self::$instance = new self();
        }
        return self::$instance;
    }

Usage Example

Пример #1
0
    private function getUsageHelp()
    {
        $commands = CommandLine\Commands::getInstance();
        
        $out = "usage: %bphrozn%n %g<command>%n [options] [args]\n\n";
        $out .= "Type 'phrozn help <command>' for help on a specific command.\n";
        $out .= "Type 'phrozn ? help' for help on using help.\n";
        $out .= "Type 'phrozn --version' to see the program version and installed plugins.\n";

        $out .= "\nAvailable commands:\n";
        $displayed = array(); // array of already displayed comands
        foreach ($commands as $name => $data) {
            if(isset($displayed[$name])) {
                continue;
            }
            $command = $data['command'];
            $out .= '    ' . $name;
            if (null !== $command['aliases']) {
                $out .= ' (' . implode(', ', $command['aliases']) . ')';
            }
            $out .= "\n";
            $displayed[$name] = $name;
        }

        return $out;
    }
All Usage Examples Of Phrozn\Runner\CommandLine\Commands::getInstance