DataSift\Storyplayer\DefinitionLib\TestEnvironment_GroupDefinition::newHost PHP Method

newHost() public method

start the definition of a host in this group
public newHost ( string $hostId, Storyplayer\TestEnvironments\HostAdapter $hostAdapter ) : TestEnvironment_HostDefinition
$hostId string the ID of this host
$hostAdapter Storyplayer\TestEnvironments\HostAdapter the plugin for this kind of host
return TestEnvironment_HostDefinition the empty host definition, for you to complete
    public function newHost($hostId, HostAdapter $hostAdapter)
    {
        // make sure we're happy with the hostId
        $hostIdValidator = new TestEnvironment_HostIdValidator($this);
        $hostIdValidator->validate($hostId);
        // create the new host and send it back
        $this->hosts[$hostId] = $hostAdapter->newHostDefinition($this, $hostId);
        $this->hosts[$hostId]->setHostAdapter($hostAdapter);
        return $this->hosts[$hostId];
    }