Predis\Connection\Aggregate\SentinelReplication::assertConnectionRole PHP Метод

assertConnectionRole() защищенный Метод

Asserts that the specified connection matches an expected role.
protected assertConnectionRole ( Predis\Connection\NodeConnectionInterface $connection, string $role )
$connection Predis\Connection\NodeConnectionInterface
$role string Expected role of the server ("master", "slave" or "sentinel").
    protected function assertConnectionRole(NodeConnectionInterface $connection, $role)
    {
        $role = strtolower($role);
        $actualRole = $connection->executeCommand(RawCommand::create('ROLE'));
        if ($role !== $actualRole[0]) {
            throw new RoleException($connection, "Expected {$role} but got {$actualRole['0']} [{$connection}]");
        }
    }