| @@ 57-83 (lines=27) @@ | ||
| 54 | * @license http://www.opensource.org/licenses/bsd-license.php BSD License |
|
| 55 | * @link http://datasift.github.io/storyplayer |
|
| 56 | */ |
|
| 57 | class ExpectsFirstHostWithRole extends ExpectsHost |
|
| 58 | { |
|
| 59 | // pull in some handy helpers |
|
| 60 | use HostsByRoleTrait; |
|
| 61 | ||
| 62 | public function __construct($st, $args) |
|
| 63 | { |
|
| 64 | // call our parent constructor first |
|
| 65 | parent::__construct($st, $args); |
|
| 66 | ||
| 67 | // $args[0] contains the rolename |
|
| 68 | // we need to replace this with the hostId for FromHost() to |
|
| 69 | // function correctly |
|
| 70 | ||
| 71 | // what are we doing? |
|
| 72 | $log = usingLog()->startAction("select first host with role '{$this->args[0]}' ..."); |
|
| 73 | ||
| 74 | // get the hosts details |
|
| 75 | $hostDetails = $this->retrieveFirstHost($this->args[0]); |
|
| 76 | ||
| 77 | // we only need to remember the hostId |
|
| 78 | $this->args[0] = $hostDetails->hostId; |
|
| 79 | ||
| 80 | // all done |
|
| 81 | $log->endAction("selected host '{$this->args[0]}'"); |
|
| 82 | } |
|
| 83 | } |
|
| @@ 57-84 (lines=28) @@ | ||
| 54 | * @license http://www.opensource.org/licenses/bsd-license.php BSD License |
|
| 55 | * @link http://datasift.github.io/storyplayer |
|
| 56 | */ |
|
| 57 | class FromFirstHostWithRole extends FromHost |
|
| 58 | { |
|
| 59 | // pull in some handy helpers |
|
| 60 | use HostsByRoleTrait; |
|
| 61 | ||
| 62 | public function __construct($st, $args) |
|
| 63 | { |
|
| 64 | // call our parent constructor first |
|
| 65 | parent::__construct($st, $args); |
|
| 66 | ||
| 67 | // $args[0] contains the rolename |
|
| 68 | // we need to replace this with the hostId for FromHost() to |
|
| 69 | // function correctly |
|
| 70 | ||
| 71 | // what are we doing? |
|
| 72 | $log = usingLog()->startAction("select first host with role '{$this->args[0]}' ..."); |
|
| 73 | ||
| 74 | // get the hosts details |
|
| 75 | $hostDetails = $this->retrieveFirstHost($this->args[0]); |
|
| 76 | ||
| 77 | // we only need to remember the name |
|
| 78 | $this->args[0] = $hostDetails->hostId; |
|
| 79 | ||
| 80 | ||
| 81 | // all done |
|
| 82 | $log->endAction("selected host '{$this->args[0]}'"); |
|
| 83 | } |
|
| 84 | } |
|
| @@ 57-83 (lines=27) @@ | ||
| 54 | * @license http://www.opensource.org/licenses/bsd-license.php BSD License |
|
| 55 | * @link http://datasift.github.io/storyplayer |
|
| 56 | */ |
|
| 57 | class UsingFirstHostWithRole extends UsingHost |
|
| 58 | { |
|
| 59 | // pull in some handy helpers |
|
| 60 | use HostsByRoleTrait; |
|
| 61 | ||
| 62 | public function __construct($st, $args) |
|
| 63 | { |
|
| 64 | // call our parent constructor first |
|
| 65 | parent::__construct($st, $args); |
|
| 66 | ||
| 67 | // $args[0] contains the rolename |
|
| 68 | // we need to replace this with the hostId for FromHost() to |
|
| 69 | // function correctly |
|
| 70 | ||
| 71 | // what are we doing? |
|
| 72 | $log = usingLog()->startAction("select first host with role '{$this->args[0]}' ..."); |
|
| 73 | ||
| 74 | // get the hosts details |
|
| 75 | $hostDetails = $this->retrieveFirstHost($this->args[0]); |
|
| 76 | ||
| 77 | // we only need to remember the name |
|
| 78 | $this->args[0] = $hostDetails->hostId; |
|
| 79 | ||
| 80 | // all done |
|
| 81 | $log->endAction("selected host '{$this->args[0]}'"); |
|
| 82 | } |
|
| 83 | } |
|