code: private function recursiveReplace($path)
      {
          $patterns = [
              '/*.md',
              '/*.php',
              '/*.phtml',
              '/*.txt',
              '/*.TXT',
          ];
  
          $from = array_keys($this->getMapping());
          $to = array_values($this->getMapping());
  
          foreach ($patterns as $pattern) {
              foreach (glob($path . $pattern) as $file) {
                  $original = file_get_contents($file);
                  $converted = str_replace($from, $to, $original);
  
                  if ($original !== $converted) {
                      echo $file . " converted\n";
                      file_put_contents($file, $converted);
                  }
              }
          }
  
          // Do the recursion in subdirectory
          foreach (glob($path . '/*', GLOB_ONLYDIR) as $subpath) {
              if (strpos($subpath, $path . '/') === 0) {
                  $this->recursiveReplace($subpath);
              }
          }
      }
docs: Search in all files in given directory.
  
  @param string $path