DataSift\Storyplayer\Cli\ListHostsTable_Command::processCommand PHP Method

processCommand() public method

public processCommand ( Phix_Project\CliEngine $engine, array $params = [], mixed $additionalContext = null ) : integer
$engine Phix_Project\CliEngine
$params array
$additionalContext mixed
return integer
    public function processCommand(CliEngine $engine, $params = array(), $additionalContext = null)
    {
        // shorthand
        $runtimeConfig = $additionalContext->getRuntimeConfig();
        // are there any hosts in the table?
        if (!isset($runtimeConfig->storyplayer, $runtimeConfig->storyplayer->tables, $runtimeConfig->storyplayer->tables->hosts)) {
            // we're done
            return 0;
        }
        // let's walk through the table
        foreach ($runtimeConfig->storyplayer->tables->hosts as $envName => $hosts) {
            foreach ($hosts as $hostid => $details) {
                // is this in the list we are filtering against?
                if (!in_array(strtolower($details->type), $engine->options->hosttype)) {
                    continue;
                }
                echo "{$envName}:{$details->id}:{$details->ipAddress}:{$details->type}:{$details->osName}\n";
            }
        }
        // all done
        return 0;
    }
ListHostsTable_Command