Platformsh\Cli\Helper\ShellHelper::findWhere PHP Method

findWhere() protected method

Run 'where' or equivalent on a command.
protected findWhere ( string $command, boolean $noticeOnError = true ) : string | boolean
$command string
$noticeOnError boolean
return string | boolean A list of command paths (one per line) or false on failure.
    protected function findWhere($command, $noticeOnError = true)
    {
        static $result;
        if (!isset($result[$command])) {
            if (is_executable($command)) {
                $result[$command] = $command;
            } else {
                $args = ['command', '-v', $command];
                if (strpos(PHP_OS, 'WIN') !== false) {
                    $args = ['where', $command];
                }
                $result[$command] = $this->execute($args, null, false, true);
                if ($result[$command] === false && $noticeOnError) {
                    trigger_error(sprintf("Failed to find command via: %s", implode(' ', $args)), E_USER_NOTICE);
                }
            }
        }
        return $result[$command];
    }