src/Admin/Pool.php
public function getInstance($id)
    {
        if (!\in_array($id, $this->adminServiceIds, true)) {
            $msg = sprintf('Admin service "%s" not found in admin pool.', $id);
            $shortest = -1;
            $closest = null;
            $alternatives = [];
            foreach ($this->adminServiceIds as $adminServiceId) {
                $lev = levenshtein($id, $adminServiceId);
                if ($lev <= $shortest || $shortest < 0) {
                    $closest = $adminServiceId;
                    $shortest = $lev;
                }
                if ($lev <= \strlen($adminServiceId) / 3 || false !== strpos($adminServiceId, $id)) {
                    $alternatives[$adminServiceId] = $lev;
                }
            }
            if (null !== $closest) {
                asort($alternatives);
                unset($alternatives[$closest]);
                $msg = sprintf(
                    'Admin service "%s" not found in admin pool. Did you mean "%s" or one of those: [%s]?',
                    $id,
                    $closest,
                    implode(', ', array_keys($alternatives))
                );
            }
            throw new \InvalidArgumentException($msg);
        }

        $admin = $this->container->get($id);

        if (!$admin instanceof AdminInterface) {
            throw new InvalidArgumentException(sprintf('Found service "%s" is not a valid admin service', $id));
        }

        return $admin;
    }
public function getInstance($id)
    {
        if (!\in_array($id, $this->adminServiceIds, true)) {
            $msg = sprintf('Admin service "%s" not found in admin pool.', $id);
            $shortest = -1;
            $closest = null;
            $alternatives = [];
            foreach ($this->adminServiceIds as $adminServiceId) {
                $lev = levenshtein($id, $adminServiceId);
                if ($lev <= $shortest || $shortest < 0) {
                    $closest = $adminServiceId;
                    $shortest = $lev;
                }
                if ($lev <= \strlen($adminServiceId) / 3 || false !== strpos($adminServiceId, $id)) {
                    $alternatives[$adminServiceId] = $lev;
                }
            }
            if (null !== $closest) {
                asort($alternatives);
                unset($alternatives[$closest]);
                $msg = sprintf(
                    'Admin service "%s" not found in admin pool. Did you mean "%s" or one of those: [%s]?',
                    $id,
                    $closest,
                    implode(', ', array_keys($alternatives))
                );
            }
            throw new \InvalidArgumentException($msg);
        }

        $admin = $this->container->get($id);

        if (!$admin instanceof AdminInterface) {
            throw new InvalidArgumentException(sprintf('Found service "%s" is not a valid admin service', $id));
        }

        return $admin;
    }
public function getInstance ( $ id ) { if ( ! \ in_array ( $ id , $ this -> adminServiceIds , true ) ) { $ msg = sprintf ( 'Admin service "%s" not found in admin pool.' , $ id ) ; $ shortest = - 1 ; $ closest = null ; $ alternatives = [ ] ; foreach ( $ this -> adminServiceIds as $ adminServiceId ) { $ lev = levenshtein ( $ id , $ adminServiceId ) ; if ( $ lev <= $ shortest || $ shortest < 0 ) { $ closest = $ adminServiceId ; $ shortest = $ lev ; } if ( $ lev <= \ strlen ( $ adminServiceId ) / 3 || false !== strpos ( $ adminServiceId , $ id ) ) { $ alternatives [ $ adminServiceId ] = $ lev ; } } if ( null !== $ closest ) { asort ( $ alternatives ) ; unset ( $ alternatives [ $ closest ] ) ; $ msg = sprintf ( 'Admin service "%s" not found in admin pool. Did you mean "%s" or one of those: [%s]?' , $ id , $ closest , implode ( ', ' , array_keys ( $ alternatives ) ) ) ; } throw new \ InvalidArgumentException ( $ msg ) ; } $ admin = $ this -> container -> get ( $ id ) ; if ( ! $ admin instanceof AdminInterface ) { throw new InvalidArgumentException ( sprintf ( 'Found service "%s" is not a valid admin service' , $ id ) ) ; } return $ admin ; }
Returns a new admin instance depends on the given code.

@param string $id

@throws \InvalidArgumentException

@return AdminInterface
Returns a new admin instance depends on the given code .