Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Repeat a string
<?php str_repeat(string $string, int $times): string
<?php $server->on('connection', $this->expectCallableOnce());
$server->on('connection', function (ConnectionInterface $conn) {
$conn->write(str_repeat('*', 400000));
});
$connector = new SecureConnector(new TcpConnector(), null, array(
<?php $server->on('connection', $this->expectCallableOnce());
$server->on('connection', function (ConnectionInterface $conn) {
$conn->write(str_repeat('*', 2000000));
});
$connector = new SecureConnector(new TcpConnector(), null, array(
<?php ));
$connecting = $connector->connect($server->getAddress());
$connecting->then(function (ConnectionInterface $connection) {
$connection->write(str_repeat('*', 400000));
});
$received = Block\await($promise, null, self::TIMEOUT);
<?php $resolve($received);
}
});
$connection->write(str_repeat('*', 400000));
}, $reject);
});
<?php $client = Block\await($this->connector->connect($this->address), null, self::TIMEOUT);
$data = str_repeat('a', 200000);
$client->end($data);
<?php });
});
$data = str_repeat('d', 200000);
$connecting = $this->connector->connect($this->address);
$connecting->then(function (ConnectionInterface $connection) use ($data) {
$connection->write($data);
<?php public function testConnectToServerWhichSendsDataWithEndReceivesAllData()
{
$data = str_repeat('b', 100000);
$this->server->on('connection', function (ConnectionInterface $peer) use ($data) {
$peer->end($data);
});
<?php public function testConnectToServerWhichSendsDataWithoutEndingReceivesAllData()
{
$data = str_repeat('c', 100000);
$this->server->on('connection', function (ConnectionInterface $peer) use ($data) {
$peer->write($data);
});
<?php $stream = new DuplexResourceStream($client);
$bytes = 1024 * 1024;
$stream->end(str_repeat('*', $bytes));
$mock = $this->expectCallableOnce();
<?php $stream = new DuplexResourceStream($client);
$bytes = 1024 * 1024;
$stream->end(str_repeat('*', $bytes));
$mock = $this->expectCallableOnce();