Code Duplication    Length = 17-17 lines in 3 locations

src/Stream/RenderBzip2FileStream.php 1 location

@@ 109-125 (lines=17) @@
106
        $this->end_string = $this->render->end();
107
    }
108
109
    public function close()
110
    {
111
        $this->state->close();
112
        $this->write($this->end_string);
113
        bzclose($this->handle);
114
115
        if (!rename($this->tmp_filename, $this->filename)) {
116
            unlink($this->tmp_filename);
117
118
            throw FileAccessException::failedOverwrite($this->tmp_filename, $this->filename);
119
        }
120
121
        $this->handle = null;
122
        $this->tmp_filename = '';
123
        $this->counter = 0;
124
        $this->used_bytes = 0;
125
    }
126
127
    /**
128
     * @param Url $url

src/Stream/RenderFileStream.php 1 location

@@ 105-121 (lines=17) @@
102
        $this->end_string = $this->render->end();
103
    }
104
105
    public function close()
106
    {
107
        $this->state->close();
108
        $this->write($this->end_string);
109
        fclose($this->handle);
110
111
        if (!rename($this->tmp_filename, $this->filename)) {
112
            unlink($this->tmp_filename);
113
114
            throw FileAccessException::failedOverwrite($this->tmp_filename, $this->filename);
115
        }
116
117
        $this->handle = null;
118
        $this->tmp_filename = '';
119
        $this->counter = 0;
120
        $this->used_bytes = 0;
121
    }
122
123
    /**
124
     * @param Url $url

src/Stream/RenderGzipFileStream.php 1 location

@@ 117-133 (lines=17) @@
114
        $this->end_string = $this->render->end();
115
    }
116
117
    public function close()
118
    {
119
        $this->state->close();
120
        $this->write($this->end_string);
121
        gzclose($this->handle);
122
123
        if (!rename($this->tmp_filename, $this->filename)) {
124
            unlink($this->tmp_filename);
125
126
            throw FileAccessException::failedOverwrite($this->tmp_filename, $this->filename);
127
        }
128
129
        $this->handle = null;
130
        $this->tmp_filename = '';
131
        $this->counter = 0;
132
        $this->used_bytes = 0;
133
    }
134
135
    /**
136
     * @param Url $url