Function get
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
public function get($id)
{
$id = ucfirst($id);
if (array_key_exists($id, $this->instances)) {
Method get
has 66 lines of code (exceeds 25 allowed). Consider refactoring.
public function get($id)
{
$id = ucfirst($id);
if (array_key_exists($id, $this->instances)) {
Function addService
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
protected function addService(int $containerId, string $serviceId, Argument $argument): void
{
if (substr($serviceId, -8) === 'Original') {
throw new \InvalidArgumentException(sprintf(
'Service id cannot ends with "Original" keyword in "%s".',
Method argumentInfoFrom
has 27 lines of code (exceeds 25 allowed). Consider refactoring.
private function argumentInfoFrom(\ReflectionMethod $method): Argument
{
static $modifiers = [
'internal',
'decorates',
Method addService
has 27 lines of code (exceeds 25 allowed). Consider refactoring.
protected function addService(int $containerId, string $serviceId, Argument $argument): void
{
if (substr($serviceId, -8) === 'Original') {
throw new \InvalidArgumentException(sprintf(
'Service id cannot ends with "Original" keyword in "%s".',
Function argumentInfoFrom
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
private function argumentInfoFrom(\ReflectionMethod $method): Argument
{
static $modifiers = [
'internal',
'decorates',
Function append
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
protected function append(Argument $argument, string $serviceId, int $containerId): void
{
$returnType = $argument->getReturnType();
$overridden = false;
Function extractServicesId
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
public function extractServicesId($container): array
{
$list = [];
$reflection = new \ReflectionClass($container);
Function register
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
public function register($container): void
{
static $id = 0;
$this->containers[++$id] = $container;