Skip to content
Snippets Groups Projects
Select Git revision
  • ea456559e24c9a87a82493754862ab34754d8efe
  • main default protected
  • studip-rector
  • ci-opt
  • course-members-export-as-word
  • data-vue-app
  • pipeline-improvements
  • webpack-optimizations
  • rector
  • icon-renewal
  • http-client-and-factories
  • jsonapi-atomic-operations
  • vueify-messages
  • tic-2341
  • 135-translatable-study-areas
  • extensible-sorm-action-parameters
  • sorm-configuration-trait
  • jsonapi-mvv-routes
  • docblocks-for-magic-methods
19 results

helpers.php

Blame
  • Forked from Stud.IP / Stud.IP
    Source project has a limited visibility.
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    helpers.php 623 B
    <?php
    
    use Psr\Container\ContainerInterface;
    
    /**
     * This function returns the Dependency Injection container used.
     *
     * ```
     * $container = app();
     * ```
     *
     * You may pass a class or interface name to resolve it from the container:
     *
     * ```
     * $logger = app(LoggerInterface::class);
     * ```
     *
     * @param string|null $entryId
     *
     * @return ContainerInterface|mixed either the DI container or the entry associated to the $entryId
     */
    function app($entryId = null)
    {
        $container = \Studip\DIContainer::getInstance();
        if (is_null($entryId)) {
            return $container;
        }
    
        return $container->get($entryId);
    }