original_string: protected function detectInFolder($folder, $lookup = null)
      {
          $folder = rtrim($folder, '/');
          $path = trim(Folder::getRelativePath($folder), '/');
          $base = $path === $folder ? '' : ($path ? substr($folder, 0, -strlen($path)) : $folder . '/');
  
          $list = [];
  
          if (is_dir($folder)) {
              $iterator = new \DirectoryIterator($folder);
  
              /** @var \DirectoryIterator $directory */
              foreach ($iterator as $directory) {
                  if (!$directory->isDir() || $directory->isDot()) {
                      continue;
                  }
  
                  $name = $directory->getFilename();
                  $find = ($lookup ?: $name) . '.yaml';
                  $filename = "{$path}/{$name}/{$find}";
  
                  if (file_exists($base . $filename)) {
                      $basename = $this->base . $name;
                      $list[$basename] = ['file' => $filename, 'modified' => filemtime($base . $filename)];
                  }
              }
          }
  
          return $list;
      }
code: protected function detectInFolder($folder, $lookup = null)
      {
          $folder = rtrim($folder, '/');
          $path = trim(Folder::getRelativePath($folder), '/');
          $base = $path === $folder ? '' : ($path ? substr($folder, 0, -strlen($path)) : $folder . '/');
  
          $list = [];
  
          if (is_dir($folder)) {
              $iterator = new \DirectoryIterator($folder);
  
              /** @var \DirectoryIterator $directory */
              foreach ($iterator as $directory) {
                  if (!$directory->isDir() || $directory->isDot()) {
                      continue;
                  }
  
                  $name = $directory->getFilename();
                  $find = ($lookup ?: $name) . '.yaml';
                  $filename = "{$path}/{$name}/{$find}";
  
                  if (file_exists($base . $filename)) {
                      $basename = $this->base . $name;
                      $list[$basename] = ['file' => $filename, 'modified' => filemtime($base . $filename)];
                  }
              }
          }
  
          return $list;
      }
code_tokens: protected function detectInFolder ( $ folder , $ lookup = null ) { $ folder = rtrim ( $ folder , '/' ) ; $ path = trim ( Folder :: getRelativePath ( $ folder ) , '/' ) ; $ base = $ path === $ folder ? '' : ( $ path ? substr ( $ folder , 0 , - strlen ( $ path ) ) : $ folder . '/' ) ; $ list = [ ] ; if ( is_dir ( $ folder ) ) { $ iterator = new \ DirectoryIterator ( $ folder ) ; /** @var \DirectoryIterator $directory */ foreach ( $ iterator as $ directory ) { if ( ! $ directory -> isDir ( ) || $ directory -> isDot ( ) ) { continue ; } $ name = $ directory -> getFilename ( ) ; $ find = ( $ lookup ? : $ name ) . '.yaml' ; $ filename = "{$path}/{$name}/{$find}" ; if ( file_exists ( $ base . $ filename ) ) { $ basename = $ this -> base . $ name ; $ list [ $ basename ] = [ 'file' => $ filename , 'modified' => filemtime ( $ base . $ filename ) ] ; } } } return $ list ; }
docstring: Detects all directories with the lookup file and returns them with last modification time.
  
  @param  string $folder Location to look up from.
  @param  string $lookup Filename to be located (defaults to directory name).
  @return array
  @internal
docstring_tokens: Detects all directories with the lookup file and returns them with last modification time .