Code Duplication    Length = 17-17 lines in 3 locations

src/Stream/RenderBzip2FileStream.php 1 location

@@ 97-113 (lines=17) @@
94
        $this->end_string = $this->render->end();
95
    }
96
97
    public function close()
98
    {
99
        $this->state->close();
100
        $this->write($this->end_string);
101
        bzclose($this->handle);
102
103
        if (!rename($this->tmp_filename, $this->filename)) {
104
            unlink($this->tmp_filename);
105
106
            throw FileAccessException::failedOverwrite($this->tmp_filename, $this->filename);
107
        }
108
109
        $this->handle = null;
110
        $this->tmp_filename = '';
111
        $this->counter = 0;
112
        $this->used_bytes = 0;
113
    }
114
115
    /**
116
     * @param Url $url

src/Stream/RenderFileStream.php 1 location

@@ 96-112 (lines=17) @@
93
        $this->end_string = $this->render->end();
94
    }
95
96
    public function close()
97
    {
98
        $this->state->close();
99
        $this->write($this->end_string);
100
        fclose($this->handle);
101
102
        if (!rename($this->tmp_filename, $this->filename)) {
103
            unlink($this->tmp_filename);
104
105
            throw FileAccessException::failedOverwrite($this->tmp_filename, $this->filename);
106
        }
107
108
        $this->handle = null;
109
        $this->tmp_filename = '';
110
        $this->counter = 0;
111
        $this->used_bytes = 0;
112
    }
113
114
    /**
115
     * @param Url $url

src/Stream/RenderGzipFileStream.php 1 location

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