Example #1
0
 /**
  * Sends the  messages to the syslog server.
  * @param array $messages the messages to send
  * @param integer $severity the severity of the message(s)
  * @return void
  */
 private function sendMessages(array $messages, $severity)
 {
     $streamWriter = new StreamWriter($this->socketStream->open());
     $messageHeader = $this->getMessageHeader($severity);
     foreach ($messages as $message) {
         $streamWriter->write($messageHeader . " " . $message);
     }
     $this->socketStream->close();
 }
Example #2
0
 /** @covers Brickoo\Component\IO\Stream\SocketStream::reconfigure */
 public function testSocketStreamReconfiguration()
 {
     $config_1 = $this->getSocketStreamConfigurationFixture();
     $config_2 = $this->getSocketStreamConfigurationFixture();
     $socketStream = new SocketStream($config_1);
     $this->assertSame($config_1, $socketStream->getConfiguration());
     $this->assertSame($socketStream, $socketStream->reconfigure($config_2));
     $this->assertSame($config_2, $socketStream->getConfiguration());
 }