Code Duplication    Length = 10-10 lines in 6 locations

src/Psr17FactoryDiscovery.php 6 locations

@@ 34-43 (lines=10) @@
31
     *
32
     * @throws Exception\NotFoundException
33
     */
34
    public static function findRequestFactory()
35
    {
36
        try {
37
            $messageFactory = static::findOneByType(RequestFactoryInterface::class);
38
        } catch (DiscoveryFailedException $e) {
39
            throw self::createException('request factory', $e);
40
        }
41
42
        return static::instantiateClass($messageFactory);
43
    }
44
45
    /**
46
     * @return RequestFactoryInterface
@@ 50-59 (lines=10) @@
47
     *
48
     * @throws Exception\NotFoundException
49
     */
50
    public static function findResponseFactory()
51
    {
52
        try {
53
            $messageFactory = static::findOneByType(ResponseFactoryInterface::class);
54
        } catch (DiscoveryFailedException $e) {
55
            throw self::createException('response factory', $e);
56
        }
57
58
        return static::instantiateClass($messageFactory);
59
    }
60
61
    /**
62
     * @return ServerRequestFactoryInterface
@@ 66-75 (lines=10) @@
63
     *
64
     * @throws Exception\NotFoundException
65
     */
66
    public static function findServerRequestFactory()
67
    {
68
        try {
69
            $messageFactory = static::findOneByType(ServerRequestFactoryInterface::class);
70
        } catch (DiscoveryFailedException $e) {
71
            throw self::createException('server request factory', $e);
72
        }
73
74
        return static::instantiateClass($messageFactory);
75
    }
76
77
    /**
78
     * @return StreamFactoryInterface
@@ 82-91 (lines=10) @@
79
     *
80
     * @throws Exception\NotFoundException
81
     */
82
    public static function findStreamFactory()
83
    {
84
        try {
85
            $messageFactory = static::findOneByType(StreamFactoryInterface::class);
86
        } catch (DiscoveryFailedException $e) {
87
            throw self::createException('stream factory', $e);
88
        }
89
90
        return static::instantiateClass($messageFactory);
91
    }
92
93
    /**
94
     * @return UploadedFileFactoryInterface
@@ 98-107 (lines=10) @@
95
     *
96
     * @throws Exception\NotFoundException
97
     */
98
    public static function findUploadedFileFactory()
99
    {
100
        try {
101
            $messageFactory = static::findOneByType(UploadedFileFactoryInterface::class);
102
        } catch (DiscoveryFailedException $e) {
103
            throw self::createException('uploaded file factory', $e);
104
        }
105
106
        return static::instantiateClass($messageFactory);
107
    }
108
109
    /**
110
     * @return UriFactoryInterface
@@ 114-123 (lines=10) @@
111
     *
112
     * @throws Exception\NotFoundException
113
     */
114
    public static function findUrlFactory()
115
    {
116
        try {
117
            $messageFactory = static::findOneByType(UriFactoryInterface::class);
118
        } catch (DiscoveryFailedException $e) {
119
            throw self::createException('url factory', $e);
120
        }
121
122
        return static::instantiateClass($messageFactory);
123
    }
124
}
125