Supported Versions: PHP 5, PHP 7, PHP 8
Reads remainder of a stream into a string
<?php stream_get_contents(resource $stream, ?int $length = null, int $offset = -1): string|false
<?php $this->factory->sink($resource)->get('https://example.com');
$this->assertSame(0, ftell($resource));
$this->assertSame('abc123', stream_get_contents($resource));
}
public function testSinkWhenStubbedByPath()
<?php $this->factory->sink($resource)->get('http://foo.com/test');
$this->assertSame(json_encode(['page' => 'foo']), stream_get_contents($resource));
}
public function testCanAssertAgainstOrderOfHttpRequestsWithUrlStrings()
<?php return null;
}
$value = is_resource($value) ? stream_get_contents($value) : $value;
set_error_handler(function (int $code, string $message): bool {
throw ConversionException::conversionFailedUnserialization($this->getName(), $message);
<?php }
if (is_resource($value)) {
$value = stream_get_contents($value);
}
$val = json_decode($value, true);
<?php return null;
}
$value = is_resource($value) ? stream_get_contents($value) : $value;
set_error_handler(function (int $code, string $message): bool {
throw ConversionException::conversionFailedUnserialization($this->getName(), $message);
<?php return [];
}
$value = is_resource($value) ? stream_get_contents($value) : $value;
return explode(',', $value);
}
<?php public function convertToPHPValue($value, AbstractPlatform $platform)
{
return is_resource($value) ? stream_get_contents($value) : $value;
}
<?php $blobValue = Type::getType('blob')->convertToPHPValue($rows[0], $this->connection->getDatabasePlatform());
self::assertIsResource($blobValue);
self::assertEquals($text, stream_get_contents($blobValue));
}
}
<?php $this->connection->getDatabasePlatform()
);
self::assertSame($contents, stream_get_contents($stream));
}
public function testIncompletelyFetchedStatementDoesNotBlockConnection(): void
<?php if (is_resource($value)) {
$value = stream_get_contents($value);
}
return $value;
<?php $phpValue = $this->type->convertToPHPValue($databaseValue, $this->platform);
self::assertIsResource($phpValue);
self::assertEquals($databaseValue, stream_get_contents($phpValue));
}
public function testBinaryResourceConvertsToPHPValue(): void
<?php $phpValue = $this->type->convertToPHPValue($databaseValue, $this->platform);
self::assertIsResource($phpValue);
self::assertSame($databaseValue, stream_get_contents($phpValue));
}
public function testBinaryResourceConvertsToPHPValue(): void
<?php namespace League\Flysystem\ZipArchive {
function stream_get_contents(...$arguments) {
if ( ! is_mocked('stream_get_contents')) {
return \stream_get_contents(...$arguments);
}
return return_mocked_value('stream_get_contents');
<?php $this->runScenario(function () {
$readStream = $this->adapter()->readStream('path.txt');
$contents = stream_get_contents($readStream);
$this->assertIsResource($readStream);
$this->assertEquals('contents', $contents);
<?php $readStream = $adapter->readStream('path.txt');
$this->assertIsResource($readStream);
$contents = stream_get_contents($readStream);
fclose($readStream);
$this->assertEquals('contents', $contents);
});