Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ContainerInterface.php

function ContainerInterface::has

Same name in this branch
  1. 11.1.x vendor/symfony/dependency-injection/ContainerInterface.php \Symfony\Component\DependencyInjection\ContainerInterface::has()

Returns true if the container can return an entry for the given identifier. Returns false otherwise.

`has($id)` returning true does not mean that `get($id)` will not throw an exception. It does however mean that `get($id)` will not throw a `NotFoundExceptionInterface`.

Parameters

string $id Identifier of the entry to look for.:

Return value

bool

2 methods override ContainerInterface::has()
ContainerInterface::has in vendor/symfony/dependency-injection/ContainerInterface.php
Returns true if the container can return an entry for the given identifier. Returns false otherwise.
ServiceProviderInterface::has in vendor/symfony/service-contracts/ServiceProviderInterface.php
Returns true if the container can return an entry for the given identifier. Returns false otherwise.

File

vendor/psr/container/src/ContainerInterface.php, line 35

Class

ContainerInterface
Describes the interface of a container that exposes methods to read its entries.

Namespace

Psr\Container

Code

public function has(string $id) : bool;

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal