File: EnforceBlockingWrapper.php

package info (click to toggle)
reactphp-stream 1.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 368 kB
  • sloc: php: 2,614; makefile: 2
file content (35 lines) | stat: -rw-r--r-- 656 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php

namespace React\Tests\Stream;

/**
 * Used to test dummy stream resources that do not support setting non-blocking mode
 *
 * @link http://php.net/manual/de/class.streamwrapper.php
 */
class EnforceBlockingWrapper
{
    public function stream_open($path, $mode, $options, &$opened_path)
    {
        return true;
    }

    public function stream_cast($cast_as)
    {
        return false;
    }

    public function stream_eof()
    {
        return false;
    }

    public function stream_set_option($option, $arg1, $arg2)
    {
        if ($option === STREAM_OPTION_BLOCKING) {
            return false;
        }

        return true;
    }
}