Code Duplication    Length = 25-25 lines in 2 locations

src/Adapter.php 2 locations

@@ 74-98 (lines=25) @@
71
     *
72
     * @return array|bool
73
     */
74
    public function write($path, $contents, Config $config)
75
    {
76
        $temporaryPath = $this->createTemporaryFile($contents);
77
78
        if (false === $temporaryPath) {
79
            return false;
80
        }
81
82
        try {
83
            $response = Cosapi::upload($this->getBucket(), $temporaryPath, $path,
84
                                        null, null, $config->get('insertOnly', 1));
85
86
            $response = $this->normalizeResponse($response);
87
88
            if (false === $response) {
89
                return false;
90
            }
91
92
            $this->setContentType($path, $contents);
93
        } catch (RuntimeException $exception) {
94
            throw $exception;
95
        }
96
97
        return $response;
98
    }
99
100
    /**
101
     * @param string   $path
@@ 136-160 (lines=25) @@
133
     *
134
     * @return array|bool
135
     */
136
    public function update($path, $contents, Config $config)
137
    {
138
        $temporaryPath = $this->createTemporaryFile($contents);
139
140
        if (false === $temporaryPath) {
141
            return false;
142
        }
143
144
        try {
145
            $response = Cosapi::upload($this->getBucket(), $temporaryPath, $path,
146
                                        null, null, $config->get('insertOnly', 0));
147
148
            $response = $this->normalizeResponse($response);
149
150
            if (false === $response) {
151
                return false;
152
            }
153
154
            $this->setContentType($path, $contents);
155
        } catch (RuntimeException $exception) {
156
            throw $exception;
157
        }
158
159
        return $response;
160
    }
161
162
    /**
163
     * @param string   $path