/**
  * Create edges between versions graph
  *
  * @param Graph  $graph
  * @param string $className
  */
 private function createEdges(Graph $graph, $className)
 {
     $migrationsAnnotations = $this->reader->getClassMigrationMethodInfo($className);
     $parentVertex = $graph->hasVertex($className) ? $graph->getVertex($className) : $graph->createVertex($className);
     foreach ($migrationsAnnotations as $migrationsAnnotation) {
         if ($migrationsAnnotation->annotation->from) {
             $fromClass = $migrationsAnnotation->annotation->from;
             $fromVertex = $graph->hasVertex($fromClass) ? $graph->getVertex($fromClass) : $graph->createVertex($fromClass);
             if (!$parentVertex->hasEdgeTo($fromVertex)) {
                 $edge = $fromVertex->createEdgeTo($parentVertex);
                 $this->annotations[$this->getEdgeId($edge)] = $migrationsAnnotation;
                 $this->createEdges($graph, $fromClass);
             }
         }
         if ($migrationsAnnotation->annotation->to) {
             $toClass = $migrationsAnnotation->annotation->to;
             $fromVertex = $graph->hasVertex($toClass) ? $graph->getVertex($toClass) : $graph->createVertex($toClass);
             if (!$parentVertex->hasEdgeTo($fromVertex)) {
                 $edge = $parentVertex->createEdgeTo($fromVertex);
                 $this->annotations[$this->getEdgeId($edge)] = $migrationsAnnotation;
                 $this->createEdges($graph, $toClass);
             }
         }
     }
 }
 /**
  * Walks through all migrateFrom functions
  * With empty object
  *
  * @param $fromClassName
  * @param $path
  * @param $visited
  */
 private function migrateFrom($fromClassName, $path = array(), &$visited = array())
 {
     $migrations = $this->versionReader->getClassMigrationMethodInfo($fromClassName);
     // farther version found
     $found = true;
     /** @var MethodInfo $methodInfo */
     foreach ($migrations as $methodInfo) {
         if ($methodInfo->annotation->from) {
             $migration = array('from' => $methodInfo->annotation->from, 'to' => $fromClassName);
             $migrationId = $this->getMigrationId($migration);
             if (false === in_array($migrationId, $visited)) {
                 // mark as visited
                 array_push($visited, $migrationId);
                 // add to log for testing
                 array_push($this->testedMigrations['from'], $migration);
                 $migrationsPath = $path;
                 $migrationsPath[] = $methodInfo;
                 $this->migrateFrom($methodInfo->annotation->from, $migrationsPath, $visited);
                 $found = false;
             }
         }
     }
     if (true === $found) {
         $this->migrateFromPath($fromClassName, $path);
     }
 }