original_string: protected function buildPages()
      {
          $this->sort = [];
  
          /** @var Config $config */
          $config = $this->grav['config'];
  
          /** @var Language $language */
          $language = $this->grav['language'];
  
          /** @var UniformResourceLocator $locator */
          $locator = $this->grav['locator'];
  
          $pages_dir = $locator->findResource('page://');
  
          if ($config->get('system.cache.enabled')) {
              /** @var Cache $cache */
              $cache = $this->grav['cache'];
              /** @var Taxonomy $taxonomy */
              $taxonomy = $this->grav['taxonomy'];
  
              // how should we check for last modified? Default is by file
              switch ($this->check_method) {
                  case 'none':
                  case 'off':
                      $hash = 0;
                      break;
                  case 'folder':
                      $hash = Folder::lastModifiedFolder($pages_dir);
                      break;
                  case 'hash':
                      $hash = Folder::hashAllFiles($pages_dir);
                      break;
                  default:
                      $hash = Folder::lastModifiedFile($pages_dir);
              }
  
              $this->pages_cache_id = md5($pages_dir . $hash . $language->getActive() . $config->checksum());
  
              list($this->instances, $this->routes, $this->children, $taxonomy_map, $this->sort) = $cache->fetch($this->pages_cache_id);
              if (!$this->instances) {
                  $this->grav['debugger']->addMessage('Page cache missed, rebuilding pages..');
  
                  // recurse pages and cache result
                  $this->resetPages($pages_dir);
  
              } else {
                  // If pages was found in cache, set the taxonomy
                  $this->grav['debugger']->addMessage('Page cache hit.');
                  $taxonomy->taxonomy($taxonomy_map);
              }
          } else {
              $this->recurse($pages_dir);
              $this->buildRoutes();
          }
      }
code: protected function buildPages()
      {
          $this->sort = [];
  
          /** @var Config $config */
          $config = $this->grav['config'];
  
          /** @var Language $language */
          $language = $this->grav['language'];
  
          /** @var UniformResourceLocator $locator */
          $locator = $this->grav['locator'];
  
          $pages_dir = $locator->findResource('page://');
  
          if ($config->get('system.cache.enabled')) {
              /** @var Cache $cache */
              $cache = $this->grav['cache'];
              /** @var Taxonomy $taxonomy */
              $taxonomy = $this->grav['taxonomy'];
  
              // how should we check for last modified? Default is by file
              switch ($this->check_method) {
                  case 'none':
                  case 'off':
                      $hash = 0;
                      break;
                  case 'folder':
                      $hash = Folder::lastModifiedFolder($pages_dir);
                      break;
                  case 'hash':
                      $hash = Folder::hashAllFiles($pages_dir);
                      break;
                  default:
                      $hash = Folder::lastModifiedFile($pages_dir);
              }
  
              $this->pages_cache_id = md5($pages_dir . $hash . $language->getActive() . $config->checksum());
  
              list($this->instances, $this->routes, $this->children, $taxonomy_map, $this->sort) = $cache->fetch($this->pages_cache_id);
              if (!$this->instances) {
                  $this->grav['debugger']->addMessage('Page cache missed, rebuilding pages..');
  
                  // recurse pages and cache result
                  $this->resetPages($pages_dir);
  
              } else {
                  // If pages was found in cache, set the taxonomy
                  $this->grav['debugger']->addMessage('Page cache hit.');
                  $taxonomy->taxonomy($taxonomy_map);
              }
          } else {
              $this->recurse($pages_dir);
              $this->buildRoutes();
          }
      }
code_tokens: protected function buildPages ( ) { $ this -> sort = [ ] ; /** @var Config $config */ $ config = $ this -> grav [ 'config' ] ; /** @var Language $language */ $ language = $ this -> grav [ 'language' ] ; /** @var UniformResourceLocator $locator */ $ locator = $ this -> grav [ 'locator' ] ; $ pages_dir = $ locator -> findResource ( 'page://' ) ; if ( $ config -> get ( 'system.cache.enabled' ) ) { /** @var Cache $cache */ $ cache = $ this -> grav [ 'cache' ] ; /** @var Taxonomy $taxonomy */ $ taxonomy = $ this -> grav [ 'taxonomy' ] ; // how should we check for last modified? Default is by file switch ( $ this -> check_method ) { case 'none' : case 'off' : $ hash = 0 ; break ; case 'folder' : $ hash = Folder :: lastModifiedFolder ( $ pages_dir ) ; break ; case 'hash' : $ hash = Folder :: hashAllFiles ( $ pages_dir ) ; break ; default : $ hash = Folder :: lastModifiedFile ( $ pages_dir ) ; } $ this -> pages_cache_id = md5 ( $ pages_dir . $ hash . $ language -> getActive ( ) . $ config -> checksum ( ) ) ; list ( $ this -> instances , $ this -> routes , $ this -> children , $ taxonomy_map , $ this -> sort ) = $ cache -> fetch ( $ this -> pages_cache_id ) ; if ( ! $ this -> instances ) { $ this -> grav [ 'debugger' ] -> addMessage ( 'Page cache missed, rebuilding pages..' ) ; // recurse pages and cache result $ this -> resetPages ( $ pages_dir ) ; } else { // If pages was found in cache, set the taxonomy $ this -> grav [ 'debugger' ] -> addMessage ( 'Page cache hit.' ) ; $ taxonomy -> taxonomy ( $ taxonomy_map ) ; } } else { $ this -> recurse ( $ pages_dir ) ; $ this -> buildRoutes ( ) ; } }
docstring: Builds pages.
  
  @internal
docstring_tokens: Builds pages .