public function createDelegatorWithName(
        ServiceLocatorInterface $serviceLocator,
        $name,
        $requestedName,
        $callback
    ) {
        $identityElement = $callback();

        if (!$identityElement instanceof Identity) {
            return $identityElement;
        }

        $services = $serviceLocator->getServiceLocator();

        /* @var $options AuthenticationOptionsInterface */
        $options = $services->get(ModuleOptions::class);

        if ($fields = $options->getIdentityFields()) {
            $last = ucfirst(array_pop($fields));
            if (count($fields) > 0) {
                $fields = array_map('ucfirst', $fields);

                $fields = (array) implode(', ', $fields);
                $fields[] = $last;

                $label = implode(' or ', $fields);
            } else {
                $label = $last;
            }

            $identityElement->setLabel($label);
            $identityElement->setOption('text_domain', 'CmsUser');
        }

        return $identityElement;
    }
public function createDelegatorWithName(
        ServiceLocatorInterface $serviceLocator,
        $name,
        $requestedName,
        $callback
    ) {
        $identityElement = $callback();

        if (!$identityElement instanceof Identity) {
            return $identityElement;
        }

        $services = $serviceLocator->getServiceLocator();

        /* @var $options AuthenticationOptionsInterface */
        $options = $services->get(ModuleOptions::class);

        if ($fields = $options->getIdentityFields()) {
            $last = ucfirst(array_pop($fields));
            if (count($fields) > 0) {
                $fields = array_map('ucfirst', $fields);

                $fields = (array) implode(', ', $fields);
                $fields[] = $last;

                $label = implode(' or ', $fields);
            } else {
                $label = $last;
            }

            $identityElement->setLabel($label);
            $identityElement->setOption('text_domain', 'CmsUser');
        }

        return $identityElement;
    }
{@inheritDoc}

@return ElementInterface