WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Самая быстрая Тема-конструктор для WordPress
функция не описана

YoastSEO_Vendor\Symfony\Component\DependencyInjection

Container::set() public Yoast 1.0

Sets a service.

Setting a synthetic service to null resets it: has() returns false and get() behaves in the same way as if the service was never created.

{} Это метод класса: Container{}

Хуков нет.

Возвращает

Null. Ничего.

Использование

$Container = new Container();
$Container->set( $id, $service );
$id(строка) (обязательный)
The service identifier
$service(объект) (обязательный)
The service instance

Код Container::set() Yoast 15.2

<?php
public function set($id, $service)
{
    // Runs the internal initializer; used by the dumped container to include always-needed files
    if (isset($this->privates['service_container']) && $this->privates['service_container'] instanceof \Closure) {
        $initialize = $this->privates['service_container'];
        unset($this->privates['service_container']);
        $initialize();
    }
    $id = $this->normalizeId($id);
    if ('service_container' === $id) {
        throw new \YoastSEO_Vendor\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException('You cannot set service "service_container".');
    }
    if (isset($this->privates[$id]) || !(isset($this->fileMap[$id]) || isset($this->methodMap[$id]))) {
        if (!isset($this->privates[$id]) && !isset($this->getRemovedIds()[$id])) {
            // no-op
        } elseif (null === $service) {
            @\trigger_error(\sprintf('The "%s" service is private, unsetting it is deprecated since Symfony 3.2 and will fail in 4.0.', $id), \E_USER_DEPRECATED);
            unset($this->privates[$id]);
        } else {
            @\trigger_error(\sprintf('The "%s" service is private, replacing it is deprecated since Symfony 3.2 and will fail in 4.0.', $id), \E_USER_DEPRECATED);
        }
    } elseif (isset($this->services[$id])) {
        if (null === $service) {
            @\trigger_error(\sprintf('The "%s" service is already initialized, unsetting it is deprecated since Symfony 3.3 and will fail in 4.0.', $id), \E_USER_DEPRECATED);
        } else {
            @\trigger_error(\sprintf('The "%s" service is already initialized, replacing it is deprecated since Symfony 3.3 and will fail in 4.0.', $id), \E_USER_DEPRECATED);
        }
    }
    if (isset($this->aliases[$id])) {
        unset($this->aliases[$id]);
    }
    if (null === $service) {
        unset($this->services[$id]);
        return;
    }
    $this->services[$id] = $service;
}