Code Duplication    Length = 11-11 lines in 2 locations

src/Resolver/ProtocolBasedReaderResolver.php 1 location

@@ 35-45 (lines=11) @@
32
     * @param ResourceReaderFactory $factory
33
     * @param string|string[] $protocols List of compatible protocols
34
     */
35
    public function addFactory(ResourceReaderFactory $factory, $protocols)
36
    {
37
        $protocols = is_array($protocols) ? $protocols : [ $protocols ];
38
        $index = count($this->factories);
39
40
        $this->factories[$index] = $factory;
41
42
        foreach ($protocols as $protocol) {
43
            $this->protocolFactoryIndexes[$protocol] = (int) $index;
44
        }
45
    }
46
47
    /**
48
     * Resolves a reader for the given resource URI.

src/Resolver/ProtocolBasedWriterResolver.php 1 location

@@ 34-44 (lines=11) @@
31
     * @param ResourceWriter $writer
32
     * @param string|string[] $protocols List of compatible protocols
33
     */
34
    public function addWriter(ResourceWriter $writer, $protocols)
35
    {
36
        $protocols = is_array($protocols) ? $protocols : [ $protocols ];
37
        $index = count($this->writers);
38
39
        $this->writers[$index] = $writer;
40
41
        foreach ($protocols as $protocol) {
42
            $this->protocolWriterIndexes[$protocol] = $index;
43
        }
44
    }
45
46
    /**
47
     * Resolves a writer for the given resource URI.