Esempio n. 1
0
 /**
  *
  * Test add outgoing connection
  */
 public function testAddOutgoingConnection()
 {
     $startEl = new Element('El7', 'E7');
     $endEl = new Element('El8', 'E8');
     $conn = new Connection($startEl, $endEl, 'conn4', 'c4');
     $startEl->addOutgoingConnection($conn);
     $outgoingConns = $startEl->getOutgoingConnections();
     $this->assertCount(1, $outgoingConns);
     $this->assertEquals($startEl, $outgoingConns[0]->getStartElement());
     return $startEl;
 }
Esempio n. 2
0
 /**
  *
  * If the element belong to connection returns this connection, in other case throw a not found exception
  *
  * @param Element $element
  * @return Connection
  */
 public function belongToConnection(Element $element)
 {
     foreach ($this->elements['connections'] as $connection) {
         // check start element
         if ($connection->getStartElement()->getId() == $element->getId()) {
             return $connection;
         }
         // check end element
         if ($connection->getEndElement()->getId() == $element->getId()) {
             return $connection;
         }
     }
     return false;
 }