Exemplo n.º 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();
 }
Exemplo n.º 2
0
 /**
  * @covers Brickoo\Component\IO\Stream\SocketStream::close
  * @covers Brickoo\Component\IO\Stream\SocketStream::open
  * @covers Brickoo\Component\IO\Stream\SocketStream::hasResource
  */
 public function testOpenAndCloseSocketStream()
 {
     $socketStream = new SocketStream($this->getSocketStreamConfigurationFixture());
     $this->assertInternalType("resource", $socketStream->open());
     $socketStream->close();
     $this->assertAttributeEquals(null, "resource", $socketStream);
 }