original_string: private function getViewsList($dirPath, $checkSubDir = true)
    {
      $viewsList = [];
      $iter = new \FilesystemIterator($dirPath);
      foreach ($iter as $fileInfo) {
        $filename = $fileInfo->getFilename();
  
        if ($filename[0] === '_') {
          continue;
        }
  
        // Directories
        if ($fileInfo->isDir()) {
          if (!$checkSubDir) {
            continue;
          }
          if ($filename === 'errors' || $filename === 'layouts' || 
              $filename === 'templates' || $filename === 'vendor') {
            continue;
          }
          // $subViews = self::getViewsList($fileInfo->getPathname(), false);
          $subViews = self::getViewsList($fileInfo->getPathname());
  
          // Prepend directory name and add the view name to current list
          foreach ($subViews as $subViewName) {
            $viewsList[] = $filename . '.' . $subViewName;
          }
  
          continue;
        }
  
        // Files
        if (substr($filename, -10) !== '.blade.php') {
          continue;
        }
        $viewName = substr($filename, 0, -10);
        $viewsList[] = $viewName;
      }
  
      return $viewsList;
    }
code: private function getViewsList($dirPath, $checkSubDir = true)
    {
      $viewsList = [];
      $iter = new \FilesystemIterator($dirPath);
      foreach ($iter as $fileInfo) {
        $filename = $fileInfo->getFilename();
  
        if ($filename[0] === '_') {
          continue;
        }
  
        // Directories
        if ($fileInfo->isDir()) {
          if (!$checkSubDir) {
            continue;
          }
          if ($filename === 'errors' || $filename === 'layouts' || 
              $filename === 'templates' || $filename === 'vendor') {
            continue;
          }
          // $subViews = self::getViewsList($fileInfo->getPathname(), false);
          $subViews = self::getViewsList($fileInfo->getPathname());
  
          // Prepend directory name and add the view name to current list
          foreach ($subViews as $subViewName) {
            $viewsList[] = $filename . '.' . $subViewName;
          }
  
          continue;
        }
  
        // Files
        if (substr($filename, -10) !== '.blade.php') {
          continue;
        }
        $viewName = substr($filename, 0, -10);
        $viewsList[] = $viewName;
      }
  
      return $viewsList;
    }
code_tokens: private function getViewsList ( $ dirPath , $ checkSubDir = true ) { $ viewsList = [ ] ; $ iter = new \ FilesystemIterator ( $ dirPath ) ; foreach ( $ iter as $ fileInfo ) { $ filename = $ fileInfo -> getFilename ( ) ; if ( $ filename [ 0 ] === '_' ) { continue ; } // Directories if ( $ fileInfo -> isDir ( ) ) { if ( ! $ checkSubDir ) { continue ; } if ( $ filename === 'errors' || $ filename === 'layouts' || $ filename === 'templates' || $ filename === 'vendor' ) { continue ; } // $subViews = self::getViewsList($fileInfo->getPathname(), false); $ subViews = self :: getViewsList ( $ fileInfo -> getPathname ( ) ) ; // Prepend directory name and add the view name to current list foreach ( $ subViews as $ subViewName ) { $ viewsList [ ] = $ filename . '.' . $ subViewName ; } continue ; } // Files if ( substr ( $ filename , - 10 ) !== '.blade.php' ) { continue ; } $ viewName = substr ( $ filename , 0 , - 10 ) ; $ viewsList [ ] = $ viewName ; } return $ viewsList ; }
docstring: Return a list of all available views in the given directory.
  
  These files will be skipped:
  - Each file or directory starting with '_'
  - Directory /errors
  - Directory /layouts
  - Directory /templates
  - Directory /vendor
  - Files not ending with '.blade.php'
  
  @param $dirPath (String)
  @param $checkSubDir (Boolean) Default true. If false, all subdirectories
  inside the current directory ($dirPath) will be skipped.
  @return Array
docstring_tokens: Return a list of all available views in the given directory .