PluginProbe ʕ •ᴥ•ʔ
Matomo Analytics – Powerful, Privacy-First Insights for WordPress / trunk
Matomo Analytics – Powerful, Privacy-First Insights for WordPress vtrunk
5.11.1 5.11.0 5.10.2 5.10.1 trunk 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.3.0 1.3.1 1.3.2 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.1.0 4.1.1 4.1.2 4.1.3 4.10.0 4.11.0 4.12.0 4.13.0 4.13.2 4.13.3 4.13.4 4.13.5 4.14.0 4.14.1 4.14.2 4.15.0 4.15.1 4.15.2 4.15.3 4.2.0 4.3.0 4.3.1 4.4.1 4.4.2 4.5.0 4.6.0 5.0.1 5.0.2 5.0.3 5.0.4 5.0.5 5.0.6 5.0.7 5.0.8 5.1.0 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5 5.1.6 5.1.7 5.10.0 5.2.0 5.2.1 5.2.2 5.3.0 5.3.1 5.3.2 5.3.3 5.6.0 5.6.1 5.7.0 5.7.1 5.8.0 5.8.1 5.8.2
matomo / app / vendor / prefixed / opis / closure / src / ClosureStream.php
matomo / app / vendor / prefixed / opis / closure / src Last commit date
Analyzer.php 1 year ago ClosureContext.php 2 years ago ClosureScope.php 2 years ago ClosureStream.php 1 year ago ISecurityProvider.php 2 years ago ReflectionClosure.php 1 year ago SecurityException.php 2 years ago SecurityProvider.php 1 year ago SelfReference.php 2 years ago SerializableClosure.php 1 year ago
ClosureStream.php
83 lines
1 <?php
2
3 /* ===========================================================================
4 * Copyright (c) 2018-2021 Zindex Software
5 *
6 * Licensed under the MIT License
7 * =========================================================================== */
8 namespace Matomo\Dependencies\Opis\Closure;
9
10 /**
11 * @internal
12 */
13 class ClosureStream
14 {
15 const STREAM_PROTO = 'closure';
16 protected static $isRegistered = \false;
17 protected $content;
18 protected $length;
19 protected $pointer = 0;
20 function stream_open($path, $mode, $options, &$opened_path)
21 {
22 $this->content = "<?php\nreturn " . substr($path, strlen(static::STREAM_PROTO . '://')) . ";";
23 $this->length = strlen($this->content);
24 return \true;
25 }
26 public function stream_read($count)
27 {
28 $value = substr($this->content, $this->pointer, $count);
29 $this->pointer += $count;
30 return $value;
31 }
32 public function stream_eof()
33 {
34 return $this->pointer >= $this->length;
35 }
36 public function stream_set_option($option, $arg1, $arg2)
37 {
38 return \false;
39 }
40 public function stream_stat()
41 {
42 $stat = stat(__FILE__);
43 $stat[7] = $stat['size'] = $this->length;
44 return $stat;
45 }
46 public function url_stat($path, $flags)
47 {
48 $stat = stat(__FILE__);
49 $stat[7] = $stat['size'] = $this->length;
50 return $stat;
51 }
52 public function stream_seek($offset, $whence = \SEEK_SET)
53 {
54 $crt = $this->pointer;
55 switch ($whence) {
56 case \SEEK_SET:
57 $this->pointer = $offset;
58 break;
59 case \SEEK_CUR:
60 $this->pointer += $offset;
61 break;
62 case \SEEK_END:
63 $this->pointer = $this->length + $offset;
64 break;
65 }
66 if ($this->pointer < 0 || $this->pointer >= $this->length) {
67 $this->pointer = $crt;
68 return \false;
69 }
70 return \true;
71 }
72 public function stream_tell()
73 {
74 return $this->pointer;
75 }
76 public static function register()
77 {
78 if (!static::$isRegistered) {
79 static::$isRegistered = stream_wrapper_register(static::STREAM_PROTO, __CLASS__);
80 }
81 }
82 }
83