Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 38... Línea 38...
38
 
38
 
39
    public function __toString(): string
39
    public function __toString(): string
40
    {
40
    {
41
        try {
41
        try {
-
 
42
            $this->rewind();
42
            $this->rewind();
43
 
43
            return $this->getContents();
44
            return $this->getContents();
44
        } catch (\Throwable $e) {
45
        } catch (\Throwable $e) {
45
            if (\PHP_VERSION_ID >= 70400) {
46
            if (\PHP_VERSION_ID >= 70400) {
46
                throw $e;
47
                throw $e;
47
            }
48
            }
-
 
49
            trigger_error(sprintf('%s::__toString exception: %s', self::class, (string) $e), E_USER_ERROR);
48
            trigger_error(sprintf('%s::__toString exception: %s', self::class, (string) $e), E_USER_ERROR);
50
 
49
            return '';
51
            return '';
50
        }
52
        }
Línea 51... Línea 53...
51
    }
53
    }
Línea 136... Línea 138...
136
        return $size;
138
        return $size;
137
    }
139
    }
Línea 138... Línea 140...
138
 
140
 
139
    public function eof(): bool
141
    public function eof(): bool
140
    {
142
    {
141
        return !$this->streams ||
143
        return !$this->streams
142
            ($this->current >= count($this->streams) - 1 &&
144
            || ($this->current >= count($this->streams) - 1
143
             $this->streams[$this->current]->eof());
145
             && $this->streams[$this->current]->eof());
Línea 144... Línea 146...
144
    }
146
    }
145
 
147
 
146
    public function rewind(): void
148
    public function rewind(): void
Línea 165... Línea 167...
165
        foreach ($this->streams as $i => $stream) {
167
        foreach ($this->streams as $i => $stream) {
166
            try {
168
            try {
167
                $stream->rewind();
169
                $stream->rewind();
168
            } catch (\Exception $e) {
170
            } catch (\Exception $e) {
169
                throw new \RuntimeException('Unable to seek stream '
171
                throw new \RuntimeException('Unable to seek stream '
170
                    . $i . ' of the AppendStream', 0, $e);
172
                    .$i.' of the AppendStream', 0, $e);
171
            }
173
            }
172
        }
174
        }
Línea 173... Línea 175...
173
 
175
 
174
        // Seek to the actual position by reading from each stream
176
        // Seek to the actual position by reading from each stream
Línea 195... Línea 197...
195
            if ($progressToNext || $this->streams[$this->current]->eof()) {
197
            if ($progressToNext || $this->streams[$this->current]->eof()) {
196
                $progressToNext = false;
198
                $progressToNext = false;
197
                if ($this->current === $total) {
199
                if ($this->current === $total) {
198
                    break;
200
                    break;
199
                }
201
                }
200
                $this->current++;
202
                ++$this->current;
201
            }
203
            }
Línea 202... Línea 204...
202
 
204
 
Línea 203... Línea 205...
203
            $result = $this->streams[$this->current]->read($remaining);
205
            $result = $this->streams[$this->current]->read($remaining);
Línea 235... Línea 237...
235
    {
237
    {
236
        throw new \RuntimeException('Cannot write to an AppendStream');
238
        throw new \RuntimeException('Cannot write to an AppendStream');
237
    }
239
    }
Línea 238... Línea 240...
238
 
240
 
239
    /**
-
 
240
     * {@inheritdoc}
-
 
241
     *
241
    /**
242
     * @return mixed
242
     * @return mixed
243
     */
243
     */
244
    public function getMetadata($key = null)
244
    public function getMetadata($key = null)
245
    {
245
    {