Phly\Http\Stream::isWritable PHP Method

isWritable() public method

public isWritable ( )
    public function isWritable()
    {
        if (!$this->resource) {
            return false;
        }
        $meta = stream_get_meta_data($this->resource);
        return is_writable($meta['uri']);
    }

Usage Example

Exemplo n.º 1
0
 public function testIsWritableReturnsFalseWhenStreamIsDetached()
 {
     $this->tmpnam = tempnam(sys_get_temp_dir(), 'phly');
     file_put_contents($this->tmpnam, 'FOO BAR');
     $resource = fopen($this->tmpnam, 'wb+');
     $stream = new Stream($resource);
     $stream->detach();
     $this->assertFalse($stream->isWritable());
 }