• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

contributte / application / 6339616833

28 Sep 2023 01:30PM UTC coverage: 82.143% (+0.7%) from 81.429%
6339616833

push

github

f3l1x
Readme: versions

69 of 84 relevant lines covered (82.14%)

0.82 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

76.47
/src/Response/Fly/Buffer/ProcessBuffer.php
1
<?php declare(strict_types = 1);
2

3
namespace Contributte\Application\Response\Fly\Buffer;
4

5
use RuntimeException;
6

7
class ProcessBuffer implements Buffer
8
{
9

10
        /** @var resource */
11
        private $pointer;
12

13
        public function __construct(string $command, string $mode = 'r')
1✔
14
        {
15
                $resource = popen($command, $mode);
1✔
16

17
                if ($resource === false) {
1✔
18
                        throw new RuntimeException('Cannot obtain resource');
×
19
                }
20

21
                $this->pointer = $resource;
1✔
22
        }
1✔
23

24
        /**
25
         * Close and clean
26
         */
27
        public function __destruct()
28
        {
29
                $this->close();
1✔
30
        }
1✔
31

32
        public function write(mixed $data): void
33
        {
34
                throw new RuntimeException('Not implemented...');
×
35
        }
36

37
        /**
38
         * @param positive-int $size
39
         */
40
        public function read(int $size): mixed
1✔
41
        {
42
                return fread($this->pointer, $size);
1✔
43
        }
44

45
        public function eof(): bool
46
        {
47
                return feof($this->pointer);
×
48
        }
49

50
        public function close(): int
51
        {
52
                // @phpstan-ignore-next-line
53
                if (isset($this->pointer) && is_resource($this->pointer)) {
1✔
54
                        $res = fclose($this->pointer);
1✔
55
                        unset($this->pointer);
1✔
56

57
                        return (int) $res;
1✔
58
                }
59

60
                return 0;
×
61
        }
62

63
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc