Exemplo n.º 1
0
 private function buildRequest()
 {
     /** @var Record $record */
     $record = array_shift($this->records);
     $role = Role::instance(ord($record->getContent()[1]));
     $keepConnection = $record->getContent()[2] !== "";
     $params = '';
     while ($this->records && $this->records[0]->getType()->isParams()) {
         /** @var Record $record */
         $record = array_shift($this->records);
         $params .= $record->getContent();
     }
     $stdin = '';
     while ($this->records && $this->records[0]->getType()->isStdin()) {
         /** @var Record $record */
         $record = array_shift($this->records);
         $stdin .= $record->getContent();
     }
     if ($this->records) {
         // TODO Not empty, something went wrong
     }
     return new Request($role, $record->getRequestId(), $keepConnection, RequestParameters::decode($params), new StringReader($stdin));
 }
Exemplo n.º 2
0
 /**
  * @covers ::filter
  */
 public function testDirectInstanciationMethodOfFilter()
 {
     $expectedRole = Role::instance(Role::FILTER);
     $role = Role::filter();
     self::assertSame($expectedRole, $role);
 }