Code Duplication    Length = 8-8 lines in 2 locations

core/services/assets/AssetManifestFactory.php 1 location

@@ 62-69 (lines=8) @@
59
     */
60
    public function create($fqcn, array $arguments = [])
61
    {
62
        if (! isset($arguments[0]) || ! $arguments[0] instanceof DomainInterface) {
63
            throw new InvalidArgumentException(
64
                esc_html__(
65
                    'In order to generate an AssetManifest class you need to supply an array where the first argument is an instance of DomainInterface.',
66
                    'event_espresso'
67
                )
68
            );
69
        }
70
        return $this->getAssetManifestForDomain($fqcn, $arguments[0]);
71
    }
72

core/domain/DomainFactory.php 1 location

@@ 94-101 (lines=8) @@
91
    private static function getDomain(string $fqcn, array $arguments): DomainInterface
92
    {
93
        if (! isset(DomainFactory::$domains[ $fqcn ])) {
94
            if (! isset($arguments[0], $arguments[1])) {
95
                throw new InvalidArgumentException(
96
                    esc_html__(
97
                        'You need to pass at least two arguments, representing the addon plugin file and version, in order to generate a Domain class',
98
                        'event_espresso'
99
                    )
100
                );
101
            }
102
            $filepath = $arguments[0] instanceof FilePath ? $arguments[0] : new FilePath($arguments[0]);
103
            $version  = $arguments[1] instanceof Version ? $arguments[1] : Version::fromString($arguments[1]);
104
            $domain   = new $fqcn($filepath, $version);