示例#1
0
文件: Stream.php 项目: rusnak/Ext
 /**
  * Метод выполняет создание пары стримов. Часто применяется для межпроцессного взаимодействия.
  *
  * @static
  * @param Ext_Io_Net_Socket_ProtocolFamily    $domain
  * @param Ext_Io_Net_Socket_CommunicationType $type
  * @param Ext_Io_Net_Stream_Protocol          $protocol
  * @return array
  */
 public static function createPair(Ext_Io_Net_Socket_ProtocolFamily $domain, Ext_Io_Net_Socket_CommunicationType $type, Ext_Io_Net_Stream_Protocol $protocol)
 {
     $resources = stream_socket_pair($domain->getValue(), $type->getValue(), $protocol->getValue());
     foreach ($resources as &$resource) {
         $tmpResource = new self();
         $tmpResource->setResource($resource);
         $resource = $tmpResource;
     }
     return $resources;
 }
示例#2
0
 /**
  * @test
  */
 public function getStringRepresentationIp()
 {
     $protocol = new Ext_Io_Net_Stream_Protocol(Ext_Io_Net_Stream_Protocol::IP);
     $this->assertEquals('ip', $protocol->getStringRepresentation());
 }