Exemplo n.º 1
0
 /**
  *
  * Add an incoming connection to the element
  * 
  * @param Connection $conn
  */
 public function addIncomingConnection(Connection $conn)
 {
     // check that the end element of the connection is the current element
     if ($conn->getEndElement()->getId() == $this->id && $conn->getEndElement()->getName() == $this->name) {
         // check the connection is not already in incomming connections
         if (false === $this->checkConnectionExists('incoming', $conn)) {
             $this->incomingConnections[] = $conn;
         } else {
             throw new \Exception("Incomming connection already exists", 500);
         }
     } else {
         throw new \Exception("The end element of the connection is not the current element", 500);
     }
 }