@param string $type
@param string $serviceId

@return bool
2086
private function clearTypedCacheFromService($type, $serviceId)
    {
        /** @type \Psr\Cache\CacheItemPoolInterface $service */
        $service = $this->getContainer()->get($serviceId);
        if ($service instanceof TaggablePoolInterface) {
            return $service->clearTags([$type]);
        } else {
            return $service->clear();
        }
    }
264633
public function check_type($typeid, $courseid, $body = null) {
        $ok = false;
        $tool = null;
        $consumerkey = lti\get_oauth_key_from_headers();
        if (empty($typeid)) {
            return $ok;
        } else if ($this->is_allowed_in_context($typeid, $courseid)) {
            $tool = lti_get_type_type_config($typeid);
            if ($tool !== false) {
                if (!$this->is_unsigned() && ($tool->lti_resourcekey == $consumerkey)) {
                    $ok = $this->check_signature($tool->lti_resourcekey, $tool->lti_password, $body);
                } else {
                    $ok = $this->is_unsigned();
                }
            }
        }
        return $ok;
    }
1018476
public static function oneById($serviceName, $id)
	{
		if(!self::has($serviceName)) {
			return null;
		}
		/** @var ReadOneInterface $serviceInstance */
		$serviceInstance = self::get($serviceName);
		try {
			$result = $serviceInstance->oneById($id);
		} catch (NotFoundHttpException $e) {
			$result = null;
		}
		return $result;
	}
343646
public function has(string $id_option = null, string $type = 'page', bool $force = false): bool
  {
    if ( !$force && $this->user && $this->user->is_dev() ){
      return true;
    }
    if ( $id_option = $this->_get_id_option($id_option, $type) ){
      $option = $this->opt->option($id_option);
      if ( !empty($option['public']) ){
        return true;
      }
      return $this->pref->has($id_option, $force);
    }
    return false;
  }
328958
private function checkType($type)
    {
        $isInType = true;

        foreach ($this->getKeys() as $key) {
            if (gettype($key) !== $type) {
                $isInType = false;
                break;
            }
        }

        return $isInType;
    }
581665
public void deleteService(String serviceId) {

        DeleteServiceRequest deleteServiceRequest = new DeleteServiceRequest().withId(serviceId);
        getDiscoveryClient().deleteService(deleteServiceRequest);

    }
430979
protected function _delete($type, $id = null, array $parameters = []) {
        return $this->__delete($this->index(), $type, $id, $parameters);
    }
1076502
protected function getType(ContainerBuilder $container, $serviceId)
    {
        $def = $container->getDefinition($serviceId);
        $class = $this->getRealValue($container, $def->getClass());
        $interfaces = class_implements($class);
        $error = sprintf('The service id "%s" must be an class implementing the "%s" interface.', $serviceId, ConverterInterface::class);

        if (\in_array(ConverterInterface::class, $interfaces, true)) {
            $ref = new \ReflectionClass($class);
            /** @var ConverterInterface $instance */
            $instance = $ref->newInstanceWithoutConstructor();
            $type = $instance->getName();

            if ($type) {
                return $type;
            }

            $error = sprintf('The service id "%s" must have the "type" parameter in the "fxp_resource.converter" tag.', $serviceId);
        }

        throw new InvalidConfigurationException($error);
    }
139515
protected function resolveServiceDefinition(ContainerBuilder $builder, $serviceId)
    {
        if ($builder->hasDefinition($serviceId)) {
            return $builder->getDefinition($serviceId);
        }

        // Some service IDs don't have a Definition, they're aliases
        if ($builder->hasAlias($serviceId)) {
            return $builder->getAlias($serviceId);
        }

        if ('service_container' === $serviceId) {
            return (new Definition(ContainerInterface::class))->setPublic(true)->setSynthetic(true);
        }

        // the service has been injected in some special way, just return the service
        return $builder->get($serviceId);
    }
1137644
public function addSubscriberService($serviceId, $class)
    {
        foreach ($class::getSubscribedEvents() as $eventName => $params) {
            if (is_string($params)) {
                $this->addListenerService($eventName, array($serviceId, $params), 0);
            } elseif (is_string($params[0])) {
                $this->addListenerService($eventName, array($serviceId, $params[0]), isset($params[1]) ? $params[1] : 0);
            } else {
                foreach ($params as $listener) {
                    $this->addListenerService($eventName, array($serviceId, $listener[0]), isset($listener[1]) ? $listener[1] : 0);
                }
            }
        }
    }
1163235
public function makeEngine($type, array $script_config = [])
    {
        if (!empty($disable = config('df.scripting.disable'))) {
            switch (strtolower($disable)) {
                case 'all':
                    throw new ServiceUnavailableException("All scripting is disabled for this instance.");
                    break;
                default:
                    if (!empty($type) && (false !== stripos($disable, $type))) {
                        throw new ServiceUnavailableException("Scripting with $type is disabled for this instance.");
                    }
                    break;
            }
        }

        $config = $this->getConfig($type);

        // Next we will check to see if a type extension has been registered for a engine type
        // and will call the factory Closure if so, which allows us to have a more generic
        // resolver for the engine types themselves which applies to all scripting.
        if (isset($this->types[$type])) {
            return $this->types[$type]->make(array_merge($config, $script_config));
        }

        throw new InvalidArgumentException("Unsupported script engine type '$type'.");
    }
211242
public function canHandle(string $type) : bool
    {
        $response = false;

        foreach ($this->contentTypes as $contentType) {
            if (stripos($type, $contentType) !== false) {
                $response = true;
                break;
            }
        }

        return $response;
    }
209551
private function load($type)
    {
        if (!$this->has($type)) {
            throw new \RuntimeException(sprintf('The block service `%s` does not exist', $type));
        }

        if (!$this->services[$type] instanceof BlockServiceInterface) {
            $this->services[$type] = $this->container->get($type);
        }

        if (!$this->services[$type] instanceof BlockServiceInterface) {
            throw new \RuntimeException(sprintf('The service %s does not implement BlockServiceInterface', $type));
        }

        return $this->services[$type];
    }
1325260
public function registerService($name, $serviceId)
    {
        if (isset($this->serviceMap[$name])) {
            throw new \InvalidArgumentException(sprintf(
                '%s service "%s" is already registered',
                $this->serviceType, $name
            ));
        }

        $this->serviceMap[$name] = $serviceId;
        $this->services[$name] = null;
    }
247296
public function getClass(string $serviceId): string
    {
        if (!isset($this->registry[$serviceId])) {
            throw new \InvalidArgumentException(sprintf(
                'Could not find class for service with id "%s".',
                $serviceId
            ));
        }

        return $this->registry[$serviceId];
    }
467178
private function loadExtendedTypes($serviceId, $name, ContainerBuilder $container)
    {
        foreach (array('choice', 'language', 'country', 'timezone', 'locale', 'entity', 'ajax') as $type) {
            $typeDef = new DefinitionDecorator($serviceId);
            $typeDef
                ->addArgument($type)
                ->addTag('form.type', array('alias' => $name. '_' . $type))
            ;
    
            $container->setDefinition($serviceId.'.'.$type, $typeDef);
        }
    }
666077
public static function validateRequest($type)
    {
        $hasValidParams = isset(
            $_POST['id'],
            $_POST['app'],
            $_POST['remote'],
            $_POST['request'],
            $_POST['complement'],
            $_POST['nonce'],
            $_POST['filter'],
            $_POST['sort'],
            $_SESSION['efc'],
            $_SERVER['HTTP_X_REQUESTED_WITH']
        );

        if (! $hasValidParams || ! self::sanitizeParams()) {
            return false;
        }

        if (self::$config['complement'] !== $type) {
            return false;
        }

        $isAjaxRequest = $_SERVER['HTTP_X_REQUESTED_WITH'] === 'XMLHttpRequest';

        $isValidNonce = self::$config['nonce'] === $_SESSION['efc'];

        if (! $isAjaxRequest || ! $isValidNonce) {
            return false;
        }

        return true;
    }