DataSift\Storyplayer\Injectables\DefaultTestEnvironmentName::initDefaultTestEnvironmentName PHP Method

initDefaultTestEnvironmentName() public method

public initDefaultTestEnvironmentName ( $injectables )
    public function initDefaultTestEnvironmentName($injectables)
    {
        // what are the candidates?
        $searchList = [];
        // do we have any defaults in the storyplayer.json file?
        $config = $injectables->storyplayerConfig;
        if (isset($config->defaults, $config->defaults->target)) {
            $searchList[] = $config->defaults->target;
        }
        // our user might have a test environment for this specific host
        $searchList[] = HostnameHelper::getHostname();
        // this is our fallback when all else fails
        $searchList[] = "localhost";
        // do any of these environments exist?
        foreach ($searchList as $testEnvName) {
            if ($injectables->knownTestEnvironmentsList->hasEntry($testEnvName)) {
                $this->defaultTestEnvironmentName = $testEnvName;
                // all done
                return;
            }
        }
        // if we get here, then none of the environments exist
        $this->defaultTestEnvironmentName = end($searchList);
    }
DefaultTestEnvironmentName