Prose\ExpectsRuntimeTable::hasEntry PHP Метод

hasEntry() публичный Метод

hasEntry
public hasEntry ( string $key ) : void
$key string key The key to look for inside the tableName table
Результат void
    public function hasEntry($key)
    {
        // get our table name from the constructor
        $tableName = $this->args[0];
        // what are we doing?
        $log = usingLog()->startAction("make sure host '{$key}' has an entry in the '{$tableName}' table");
        // get the table config
        $tables = $this->getAllTables();
        // make sure we have a hosts table
        if (!isset($tables->{$tableName})) {
            $msg = "table is empty / does not exist";
            $log->endAction($msg);
            throw new E5xx_ExpectFailed(__METHOD__, "{$tableName} table existed", "{$parent} table does not exist");
        }
        // make sure we don't have a duplicate entry
        if (!isset($tables->{$tableName}->{$key})) {
            $msg = "table does not contain an entry for '{$key}'";
            $log->endAction($msg);
            throw new E5xx_ExpectFailed(__METHOD__, "{$tableName} table has an entry for '{$key}'", "{$parent} table has no entry for '{$key}'");
        }
        // all done
        $log->endAction();
    }
ExpectsRuntimeTable