/**
  * @param Operation $operation
  *
  * @return self
  */
 public function addOperation(Operation $operation)
 {
     $id = $operation->getMethod() . $operation->getPath();
     $group = 0;
     if ($operation->getOperation()->getOperationId()) {
         $id = $operation->getOperation()->getOperationId();
     }
     if ($operation->getOperation()->getTags() !== null && count($operation->getOperation()->getTags()) > 0) {
         $group = $operation->getOperation()->getTags()[0];
     }
     if (!isset($this[$group])) {
         $this[$group] = [];
     }
     $this[$group][$id] = $operation;
     return $this;
 }
Beispiel #2
0
 public function testIn()
 {
     $operation = new Operation('getEntry');
     $operation->setMethod('GET');
     $operation->setIn('void');
     $operation->setOut('collection');
     $this->assertEquals('getEntry', $operation->getName());
     $this->assertEquals('GET', $operation->getMethod());
     $this->assertEquals('void', $operation->getIn());
     $this->assertTrue($operation->hasIn());
     $this->assertEquals('collection', $operation->getOut());
     $this->assertTrue($operation->hasOut());
     $this->assertTrue($operation->hasOperation());
     $this->assertFalse($operation->isInOnly());
     $this->assertFalse($operation->isOutOnly());
     $this->assertTrue($operation->isInOut());
 }