code: public function detectJunctionTables($ignoreReferencedTables = false)
      {
          $junctionTablesKey = $this->cachePrefix.'_junctiontables_'.($ignoreReferencedTables ? 'true' : 'false');
          $junctionTables = $this->cache->fetch($junctionTablesKey);
          if ($junctionTables === false) {
              $junctionTables = array_filter($this->getSchema()->getTables(), function (Table $table) use ($ignoreReferencedTables) {
                  return $this->isJunctionTable($table, $ignoreReferencedTables);
              });
              $this->cache->save($junctionTablesKey, $junctionTables);
          }
  
          return $junctionTables;
      }
docs: Detect all junctions tables in the schema.
  A table is a junction table if:.
  
  - it has exactly 2 foreign keys
  - it has only 2 columns (or 3 columns if the third one is an autoincremented primary key).
  
  If $ignoreReferencedTables is true, junctions table that are pointed to by a foreign key of another
  table are ignored.
  
  @param bool $ignoreReferencedTables
  
  @return Table[]