Пример #1
0
 /**
  * @param Chain $chain
  * @return string
  * @throws \Exception
  */
 public function createChain(Chain $chain)
 {
     $this->chains[$chain->getName()] = $chain;
     $rulesCounter = count($chain->getRulesList());
     $command = new Command($this->name);
     if (1 < $rulesCounter) {
         throw new \Exception('Maximum number Rules on creation is 1.');
     } else {
         if (1 === $rulesCounter) {
             $command->setOptions((string) current($chain->getRulesList()));
         }
     }
     return $command->createChain($chain->getName());
 }
Пример #2
0
 /**
  * @test
  */
 public function shouldThrowExceptionBecauseOfWrongFlags()
 {
     $this->setExpectedException('\\Exception');
     $command = new Command(Table::TABLE_MANGLE);
     $command->setProtocol('tcp', null, '127.0.0.1/0', ['ACK', 'XXX', 'EXT']);
 }