Code Duplication    Length = 18-21 lines in 2 locations

php/Arguments/ArgumentFactory/ArgumentFactoryAggregate.php 2 locations

@@ 77-97 (lines=21) @@
74
        return $understandsArray;
75
    }
76
77
    public function createArgumentFromString(string $source): Argument
78
    {
79
        /** @var Argument $argument */
80
        $argument = null;
81
82
        foreach ($this->innerArgumentFactories as $innerArgumentFactory) {
83
            /** @var ArgumentFactory $innerArgumentFactory */
84
85
            if ($innerArgumentFactory->understandsString($source)) {
86
                $argument = $innerArgumentFactory->createArgumentFromString($source);
87
                break;
88
            }
89
        }
90
91
        Assert::isInstanceOf($argument, Argument::class, sprintf(
92
            "Could not parse '%s' into argument!",
93
            $source
94
        ));
95
96
        return $argument;
97
    }
98
99
    public function createArgumentFromArray(array $source): Argument
100
    {
@@ 99-116 (lines=18) @@
96
        return $argument;
97
    }
98
99
    public function createArgumentFromArray(array $source): Argument
100
    {
101
        /** @var Argument $argument */
102
        $argument = null;
103
104
        foreach ($this->innerArgumentFactories as $innerArgumentFactory) {
105
            /** @var ArgumentFactory $innerArgumentFactory */
106
107
            if ($innerArgumentFactory->understandsArray($source)) {
108
                $argument = $innerArgumentFactory->createArgumentFromArray($source);
109
                break;
110
            }
111
        }
112
113
        Assert::isInstanceOf($argument, Argument::class, "Could not parse array into argument!");
114
115
        return $argument;
116
    }
117
118
}
119