original_string: public function paginate($object = null, array $settings = [])
      {
          if (is_object($object)) {
              $table = $object;
          }
  
          if (is_string($object) || $object === null) {
              $try = [$object, $this->modelClass];
              foreach ($try as $tableName) {
                  if (empty($tableName)) {
                      continue;
                  }
                  $table = $this->loadModel($tableName);
                  break;
              }
          }
  
          $this->loadComponent('Paginator');
          if (empty($table)) {
              throw new RuntimeException('Unable to locate an object compatible with paginate.');
          }
          $settings += $this->paginate;
  
          return $this->Paginator->paginate($table, $settings);
      }
code: public function paginate($object = null, array $settings = [])
      {
          if (is_object($object)) {
              $table = $object;
          }
  
          if (is_string($object) || $object === null) {
              $try = [$object, $this->modelClass];
              foreach ($try as $tableName) {
                  if (empty($tableName)) {
                      continue;
                  }
                  $table = $this->loadModel($tableName);
                  break;
              }
          }
  
          $this->loadComponent('Paginator');
          if (empty($table)) {
              throw new RuntimeException('Unable to locate an object compatible with paginate.');
          }
          $settings += $this->paginate;
  
          return $this->Paginator->paginate($table, $settings);
      }
code_tokens: public function paginate ( $ object = null , array $ settings = [ ] ) { if ( is_object ( $ object ) ) { $ table = $ object ; } if ( is_string ( $ object ) || $ object === null ) { $ try = [ $ object , $ this -> modelClass ] ; foreach ( $ try as $ tableName ) { if ( empty ( $ tableName ) ) { continue ; } $ table = $ this -> loadModel ( $ tableName ) ; break ; } } $ this -> loadComponent ( 'Paginator' ) ; if ( empty ( $ table ) ) { throw new RuntimeException ( 'Unable to locate an object compatible with paginate.' ) ; } $ settings += $ this -> paginate ; return $ this -> Paginator -> paginate ( $ table , $ settings ) ; }
docstring: Handles pagination of records in Table objects.
  
  Will load the referenced Table object, and have the PaginatorComponent
  paginate the query using the request date and settings defined in `$this->paginate`.
  
  This method will also make the PaginatorHelper available in the view.
  
  @param \Cake\ORM\Table|string|\Cake\ORM\Query|null $object Table to paginate
  (e.g: Table instance, 'TableName' or a Query object)
  @param array $settings The settings/configuration used for pagination.
  @return \Cake\ORM\ResultSet|\Cake\Datasource\ResultSetInterface Query results
  @link https://book.cakephp.org/3.0/en/controllers.html#paginating-a-model
  @throws \RuntimeException When no compatible table object can be found.
docstring_tokens: Handles pagination of records in Table objects .