maestroprog/di-container

View on GitHub

Showing 9 of 9 total issues

Function get has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

public function get($id)
{
$id = ucfirst($id);
if (array_key_exists($id, $this->instances)) {
// fast getter
Severity: Minor
Found in src/Container.php - About 4 hrs to fix

Method get has 66 lines of code (exceeds 25 allowed). Consider refactoring.
Open

public function get($id)
{
$id = ucfirst($id);
if (array_key_exists($id, $this->instances)) {
// fast getter
Severity: Major
Found in src/Container.php - About 2 hrs to fix

    Function addService has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    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".',
    Severity: Minor
    Found in src/Container.php - About 1 hr to fix

    Method argumentInfoFrom has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    private function argumentInfoFrom(\ReflectionMethod $method): Argument
    {
    static $modifiers = [
    'internal',
    'decorates',
    Severity: Minor
    Found in src/ServicesExtractor.php - About 1 hr to fix

      Method addService has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      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".',
      Severity: Minor
      Found in src/Container.php - About 1 hr to fix

        Function argumentInfoFrom has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

        private function argumentInfoFrom(\ReflectionMethod $method): Argument
        {
        static $modifiers = [
        'internal',
        'decorates',
        Severity: Minor
        Found in src/ServicesExtractor.php - About 55 mins to fix

        Function append has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        protected function append(Argument $argument, string $serviceId, int $containerId): void
        {
        $returnType = $argument->getReturnType();
         
        $overridden = false;
        Severity: Minor
        Found in src/Container.php - About 45 mins to fix

        Function extractServicesId has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        public function extractServicesId($container): array
        {
        $list = [];
         
        $reflection = new \ReflectionClass($container);
        Severity: Minor
        Found in src/ServicesExtractor.php - About 45 mins to fix

        Function register has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        public function register($container): void
        {
        static $id = 0;
         
        $this->containers[++$id] = $container;
        Severity: Minor
        Found in src/Container.php - About 25 mins to fix
        Severity
        Category
        Status
        Source
        Language