/** * Get/set instance of global/static container, due this method must be used as few times as * possible both getter and setter methods joined into one. Please use this method only as * fallback. * * @internal Do not use for business logic. * @param ContainerInterface $container * @return ContainerInterface */ protected static final function staticContainer(ContainerInterface $container = null) { if (!empty($container)) { self::$staticContainer = $container; } return self::$staticContainer; }
/** * Get/set instance of global/static container, due this method must be used as few times as * possible both getter and setter methods joined into one. Please use this method only as * fallback. * * @internal Do not use for business logic. * @param ContainerInterface $container Can be set to null. * @return ContainerInterface|null */ protected static final function staticContainer(ContainerInterface $container = null) { if (func_num_args() === 0) { return self::$staticContainer; } $outer = self::$staticContainer; self::$staticContainer = $container; //Return previous container or null return $outer; }