Passed
Push — master ( 442a9a...3948f8 )
by Dāvis
05:23
created

Sitemap/Dumper/GzFileDumper.php (1 issue)

Severity
1
<?php
2
3
namespace Sludio\HelperBundle\Sitemap\Dumper;
4
5
class GzFileDumper implements DumperFileInterface
6
{
7
    use FileDumperTrait;
8
9
    /**
10
     * {@inheritdoc}
11
     */
12
    public function dump($string)
13
    {
14
        if ($this->handle === null) {
15
            $this->openFile();
16
        }
17
18
        gzwrite($this->handle, $string);
19
    }
20
21
    protected function openFile()
22
    {
23
        $this->handle = gzopen($this->filename, 'w9');
24
25
        if ($this->handle === false) {
0 ignored issues
show
The condition $this->handle === false is always false.
Loading history...
26
            throw new \RuntimeException(sprintf('Impossible to open the file %s in write mode', $this->filename));
27
        }
28
    }
29
}
30