code: protected static function computeDependencies(array $tables)
  	{
  		/** @todo vulnerable to circular dependencies */
  		$result = [];
  		while (!empty($tables))
  		{
  			// Circular dependency check variable
  			$num = count($tables);
  
  			foreach ($tables as $i => $table)
  				if (!$table->dependent())
  				{
  					$result[] = $table;
  
  					// Remove from list
  					// and free dependent tables
  					unset($tables[$i]);
  					foreach ($tables as $t) $t->removeDependency($table->name());
  				}
  			
  			// If no dependency-free table is found
  			// there is probably a circular dependency
  			// nothing we can do about it
  			if (count($tables) === $num) return false;
  		}
  
  		return $result;
  	}
docs: Compute table dependencies
  
  This method reorders table to avoid dependencies problems
  when creating/deleting tables
  
  @param Table[] $tables list of tables
  
  @return array|bool return reordered list of tables or false if fails