Prose\FromRuntimeTableForTargetEnvironment::getDetails PHP Method

getDetails() public method

Get details for a specific key
public getDetails ( string $key ) : object
$key string key The key to look for inside the tableName table
return object The details stored under $key
    public function getDetails($key)
    {
        // get our table name from the constructor
        $tableName = $this->args[0];
        $targetEnv = $this->st->getTestEnvironmentName();
        // what are we doing?
        $log = usingLog()->startAction("get details for '{$key}' from {$tableName}->{$targetEnv} table");
        // get the table config
        $tables = $this->getAllTables();
        // make sure we have a table
        if (!isset($tables->{$tableName})) {
            $msg = "table is empty / does not exist";
            $log->endAction($msg);
            return null;
        }
        // make sure we have a table
        if (!isset($tables->{$tableName}->{$targetEnv})) {
            $msg = "table is empty / does not exist";
            $log->endAction($msg);
            return null;
        }
        // do we have the entry we're looking for?
        if (!isset($tables->{$tableName}->{$targetEnv}->{$key})) {
            $msg = "table does not contain an entry for '{$key}'";
            $log->endAction($msg);
            return null;
        }
        // all done
        $log->endAction();
        return $tables->{$tableName}->{$targetEnv}->{$key};
    }