Code Duplication    Length = 21-21 lines in 2 locations

src/Adapter.php 2 locations

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