Code Duplication    Length = 12-14 lines in 2 locations

WebStream/IO/FileInputStream.php 1 location

@@ 46-57 (lines=12) @@
43
    /**
44
     * 入力ストリームを閉じる
45
     */
46
    public function close()
47
    {
48
        if ($this->stream === null) {
49
            return;
50
        }
51
52
        if (get_resource_type($this->stream) !== 'Unknown' && fclose($this->stream) === false) {
53
            throw new IOException("Cannot close input stream.");
54
        }
55
56
        $this->stream = null;
57
    }
58
59
    /**
60
     * {@inheritdoc}

WebStream/IO/FileOutputStream.php 1 location

@@ 70-83 (lines=14) @@
67
    /**
68
     * {@inheritdoc}
69
     */
70
    public function close()
71
    {
72
        if ($this->stream === null) {
73
            return;
74
        }
75
76
        $this->flush();
77
78
        if (get_resource_type($this->stream) !== 'Unknown' && fclose($this->stream) === false) {
79
            throw new IOException("Cannot close output stream.");
80
        }
81
82
        $this->stream = null;
83
    }
84
85
    /**
86
     * {@inheritdoc}