Platformsh\Cli\Command\User\UserAddCommand::standardizeRole PHP Метод

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

protected standardizeRole ( string $givenRole ) : string
$givenRole string
Результат string
    protected function standardizeRole($givenRole)
    {
        $possibleRoles = ['viewer', 'admin', 'contributor', 'none'];
        if (in_array($givenRole, $possibleRoles)) {
            return $givenRole;
        }
        $role = strtolower($givenRole);
        foreach ($possibleRoles as $possibleRole) {
            if (strpos($possibleRole, $role) === 0) {
                return $possibleRole;
            }
        }
        throw new \Exception("Role not found: {$givenRole}");
    }