src/Db/Schema.php
protected function getSchemaMetadata($schema, $type, $refresh)
    {
        return $this->getTableNames($schema, $refresh)->then(
            function($names) use($schema, $type, $refresh) {
                $metadata = [];
                $metaPromises = [];
                $methodName = 'getTable' . ucfirst($type);
                if (method_exists($this, $methodName . 'Async')) {
                    $methodName .= 'Async';
                }
                foreach ($names as $name) {
                    if ($schema !== '') {
                        $name = $schema . '.' . $name;
                    }
                    /** @var ExtendedPromiseInterface $metaPromise */
                    $metaPromise = $this->$methodName($name, $refresh);
                    $metaPromise->then(
                        function($tableMetadata) use(&$metadata) {
                            if ($tableMetadata !== null) {
                                $metadata[] = $tableMetadata;
                            }
                        },
                        function() { return null; }
                    );
                    $metaPromises[] = $metaPromise;
                }
                return all($metaPromises)
                    ->then(function() use (&$metadata) {
                        return $metadata;
                    });
            }
        );
    }
protected function getSchemaMetadata($schema, $type, $refresh)
    {
        return $this->getTableNames($schema, $refresh)->then(
            function($names) use($schema, $type, $refresh) {
                $metadata = [];
                $metaPromises = [];
                $methodName = 'getTable' . ucfirst($type);
                if (method_exists($this, $methodName . 'Async')) {
                    $methodName .= 'Async';
                }
                foreach ($names as $name) {
                    if ($schema !== '') {
                        $name = $schema . '.' . $name;
                    }
                    /** @var ExtendedPromiseInterface $metaPromise */
                    $metaPromise = $this->$methodName($name, $refresh);
                    $metaPromise->then(
                        function($tableMetadata) use(&$metadata) {
                            if ($tableMetadata !== null) {
                                $metadata[] = $tableMetadata;
                            }
                        },
                        function() { return null; }
                    );
                    $metaPromises[] = $metaPromise;
                }
                return all($metaPromises)
                    ->then(function() use (&$metadata) {
                        return $metadata;
                    });
            }
        );
    }
Returns the metadata of the given type for all tables in the given schema.
This method will call a `'getTable' . ucfirst($type)` named method with the table name
and the refresh flag to obtain the metadata.
@param string $schema the schema of the metadata. Defaults to empty string, meaning the current or default schema name.
@param string $type metadata type.
@param bool $refresh whether to fetch the latest available table metadata. If this is `false`,
cached data may be returned if available.
@return ExtendedPromiseInterface with array array of metadata.