original_string: public function getSchema(Connection $connection)
      {
          if (!method_exists($connection, 'schemaCollection')) {
              throw new RuntimeException('The given connection object is not compatible with schema caching, as it does not implement a "schemaCollection()" method.');
          }
  
          $config = $connection->config();
          if (empty($config['cacheMetadata'])) {
              $connection->cacheMetadata(true);
          }
  
          return $connection->getSchemaCollection();
      }
code: public function getSchema(Connection $connection)
      {
          if (!method_exists($connection, 'schemaCollection')) {
              throw new RuntimeException('The given connection object is not compatible with schema caching, as it does not implement a "schemaCollection()" method.');
          }
  
          $config = $connection->config();
          if (empty($config['cacheMetadata'])) {
              $connection->cacheMetadata(true);
          }
  
          return $connection->getSchemaCollection();
      }
code_tokens: public function getSchema ( Connection $ connection ) { if ( ! method_exists ( $ connection , 'schemaCollection' ) ) { throw new RuntimeException ( 'The given connection object is not compatible with schema caching, as it does not implement a "schemaCollection()" method.' ) ; } $ config = $ connection -> config ( ) ; if ( empty ( $ config [ 'cacheMetadata' ] ) ) { $ connection -> cacheMetadata ( true ) ; } return $ connection -> getSchemaCollection ( ) ; }
docstring: Helper method to get the schema collection.
  
  @param \Cake\Database\Connection $connection Connection object
  @return \Cake\Database\Schema\Collection|\Cake\Database\Schema\CachedCollection
  @throws \RuntimeException If given connection object is not compatible with schema caching
docstring_tokens: Helper method to get the schema collection .