src/Valkyrja/Container/NativeContainer.php
public function get(string $serviceId, array $arguments = null, string $context = null, string $member = null)
    {
        // If there is a context set for this context and member combination
        if (
            null !== $context
            && $this->hasContext(
                $serviceId,
                $context,
                $member
            )
        ) {
            // Return that context
            return $this->get(
                $this->contextServiceId($serviceId, $context, $member),
                $arguments
            );
        }

        // If there is a context set for this context only
        if (null !== $context && $this->hasContext($serviceId, $context)) {
            // Return that context
            return $this->get(
                $this->contextServiceId($serviceId, $context),
                $arguments
            );
        }

        // If the service is a singleton
        if ($this->isSingleton($serviceId)) {
            // Return the singleton
            return $this->getSingleton($serviceId);
        }

        // If this service is an alias
        if ($this->isAlias($serviceId)) {
            // Return the appropriate service
            return $this->get(
                self::$aliases[$serviceId],
                $arguments,
                $context,
                $member
            );
        }

        // If the service is in the container
        if ($this->has($serviceId)) {
            // Return the made service
            return $this->make($serviceId, $arguments);
        }

        // Check if the service id is provided by a deferred service provider
        if ($this->isProvided($serviceId)) {
            return $this->getProvided(
                $serviceId,
                $arguments,
                $context,
                $member
            );
        }

        // If there are no argument return a new object
        if (null === $arguments) {
            return new $serviceId();
        }

        // Return a new object with the arguments
        return new $serviceId(...$arguments);
    }
public function get(string $serviceId, array $arguments = null, string $context = null, string $member = null)
    {
        // If there is a context set for this context and member combination
        if (
            null !== $context
            && $this->hasContext(
                $serviceId,
                $context,
                $member
            )
        ) {
            // Return that context
            return $this->get(
                $this->contextServiceId($serviceId, $context, $member),
                $arguments
            );
        }

        // If there is a context set for this context only
        if (null !== $context && $this->hasContext($serviceId, $context)) {
            // Return that context
            return $this->get(
                $this->contextServiceId($serviceId, $context),
                $arguments
            );
        }

        // If the service is a singleton
        if ($this->isSingleton($serviceId)) {
            // Return the singleton
            return $this->getSingleton($serviceId);
        }

        // If this service is an alias
        if ($this->isAlias($serviceId)) {
            // Return the appropriate service
            return $this->get(
                self::$aliases[$serviceId],
                $arguments,
                $context,
                $member
            );
        }

        // If the service is in the container
        if ($this->has($serviceId)) {
            // Return the made service
            return $this->make($serviceId, $arguments);
        }

        // Check if the service id is provided by a deferred service provider
        if ($this->isProvided($serviceId)) {
            return $this->getProvided(
                $serviceId,
                $arguments,
                $context,
                $member
            );
        }

        // If there are no argument return a new object
        if (null === $arguments) {
            return new $serviceId();
        }

        // Return a new object with the arguments
        return new $serviceId(...$arguments);
    }
Get a service from the container.

@param string $serviceId The service
@param array  $arguments [optional] The arguments
@param string $context   [optional] The context
class name || function name || variable name
@param string $member    [optional] The context member
method name || property name

@return mixed