Piwik\Container\

StaticContainer

Static access to the DI container.

Prefer constructor injection where core creates the class through the container (controllers, API classes, Tasks, RecordBuilders).

Methods

The class defines the following methods:

  • get() — Returns the container entry registered under the given name, such as a class or interface name.

get()

Returns the container entry registered under the given name, such as a class or interface name.

Signature

  • It accepts the following parameter(s):

    • $name (Piwik\Container\class-string<T>|string) — Container entry name.
  • Returns: Piwik\Container\($name — is class-string ? T : mixed) The resolved entry.

  • It throws one of the following exceptions:
    • Piwik\Exception\DI\NotFoundException|\Piwik\Exception\DI\DependencyException