Rewrites the class map to have lowercased keys to be able to load classes with wrong casing
Defaults to case sensitivity (composer loader default)

@param string $targetDir
352438
protected function rewriteClassMapWithLowerCaseClassNames($targetDir)
    {
        $classMapContents = file_get_contents($targetDir . '/autoload_classmap.php');
        $classMapContents = preg_replace_callback('/    \'[^\']*\' => /', function ($match) {
            return strtolower($match[0]);
        }, $classMapContents);
        file_put_contents($targetDir . '/autoload_classmap.php', $classMapContents);
    }
281604
public function serialize($targetFile,$data)
    {
        $contents = serialize($data);
        $this->putFileContents($targetFile,$contents);
    }
1025978
public static function staticToStatic(string $sourceName, string $targetName): void
  {
    $source      = file_get_contents($sourceName);
    $sourceClass = basename($sourceName, '.php');
    $targetClass = basename($targetName, '.php');

    $source = NonStatic::nonStatic($source, $sourceClass, $targetClass);

    file_put_contents($targetName, $source);
  }
1080636
private function relativeSymlinkWithFallback(string $originDir, string $targetDir): string
    {
        try {
            $this->symlink($originDir, $targetDir, true);
            $method = self::METHOD_RELATIVE_SYMLINK;
        } catch (IOException $e) {
            $method = $this->absoluteSymlinkWithFallback($originDir, $targetDir);
        }

        return $method;
    }
731408
protected function _move($source, $targetDir, $name) {
		$sql = 'UPDATE %s SET parent_id=%d, name="%s" WHERE id=%d LIMIT 1';
		$sql = sprintf($sql, $this->tbf, $targetDir, $this->db->real_escape_string($name), $source);
		return $this->query($sql) && $this->db->affected_rows > 0 ? $source : false;
	}
55718
public function setTargetLanguage($targetLanguage): void
    {
        if (!preg_match('#[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*#', $targetLanguage)) {
            throw new \InvalidArgumentException('Invalid language string: "' . $targetLanguage . '"');
        }
        $this->getFileElement()->setAttributeNS(static::XLIFF_NS, 'target-language', $targetLanguage);
    }
860784
public function setTarget($target)
    {
        if (!file_exists(dirname($target))) {
            throw new Exception\InvalidArgumentException("The directory '$target' does not exist");
        }

        $target = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, (string) $target);
        $this->options['target'] = $target;
        return $this;
    }
881506
public function setKeyDir($keyDir) {
		if($keyDir[0] != "/") $keyDir = BASE_PATH . '/' . $keyDir;
		$this->keyDir = realpath($keyDir) ?: $keyDir;
	}
1124738
public function setToDir($toDir)
    {
        if (!is_dir($toDir)) {
            $toDir = new PhingFile($toDir);
            $toDir->mkdirs();
        }

        $this->toDir = $toDir;
    }
59084
protected function _copy($source, $targetDir, $name) {
		$path = $this->_normpath($targetDir.'/'.$name);
		try {
			$this->dropbox->copy($source, $path);
		} catch (Dropbox_Exception $e) {
			return $this->setError('Dropbox error: '.$e->getMessage());
		}
		$this->deltaCheck();
		return true;
	}
359718
private function generateTemplateMapper($cacheDir)
    {
        $files = $this->templateUtil->getAllTemplates();

        if (empty($files)) {
            return;
        }

        $this->filesystem->dumpFile(
            $cacheDir.'/contao/config/twig-templates.php',
            sprintf("<?php\n\nreturn %s;\n", var_export($files, true))
        );
    }
599615
public function parse(array $dirs, $cacheDir = null)
    {
        $results = $this->parseFiles($dirs, '/\.php$/', $cacheDir);
        $classes = [];

        foreach ($results as $refs) {
            foreach ($refs as $className => $ref) {
                $classes[$className] = $ref;
            }
        }

        return $classes;
    }
485606
protected static function fill_classmap_renames_cache() {
        global $CFG;

        self::$classmaprenames = array();

        self::load_renamed_classes("$CFG->dirroot/lib/");

        foreach (self::$subsystems as $subsystem => $fulldir) {
            self::load_renamed_classes($fulldir);
        }

        foreach (self::$plugins as $plugintype => $plugins) {
            foreach ($plugins as $pluginname => $fulldir) {
                self::load_renamed_classes($fulldir);
            }
        }
    }
736298
public function clear($cacheDir)
    {
        $this->getLegacyKernel()->runCallback(
            function () {
                $helper = new eZCacheHelper(
                    $cli = eZCLI::instance(),
                    $script = eZScript::instance(
                        array(
                            'description' => 'eZ Publish Cache Handler',
                            'use-session' => false,
                            'use-modules' => false,
                            'use-extensions' => true,
                        )
                    )
                );

                $cli->setIsQuiet(true);
                $helper->clearItems(eZCache::fetchByTag('template,ini,i18n'), 'Legacy file cache (Template, ini and i18n)');
            },
            false,
            false
        );
    }
1013876
public function map($sourcePath, $targetPath)
  {
    if (file_exists($sourcePath)) {
      $items = array();
      if (is_file($sourcePath)) {
        $items[$targetPath] = $sourcePath;
      } elseif (is_dir($sourcePath)) {
        $finder = new Finder\Finder();
        foreach ($finder->in($sourcePath)->files() as $file) {
          /* @var $file Finder\SplFileInfo */
          $fileTargetPath = $targetPath . "/" . $file->getRelativePathname();
          $items[$fileTargetPath] = $file->getPathname();
        }
      }

      foreach ($items as $target => $source) {
        $formulae = new AssetFormulae();
        $formulae->setInputs(
          array($source)
        );
        $formulae->setOptions(
          array("output" => $target)
        );

        $this->append($formulae);
      }
    }
  }
1037281
public function createComposerInMemoryPackage($targetDir, $version)
    {
        $url = $this->getURL($version);

        $versionParser = new VersionParser();
        $normVersion = $versionParser->normalize($version);

        $package = new Package(static::PHANTOMJS_NAME, $normVersion, $version);
        $package->setTargetDir($targetDir);
        $package->setInstallationSource('dist');
        $package->setDistType(pathinfo($url, PATHINFO_EXTENSION) === 'zip' ? 'zip' : 'tar'); // set zip, tarball
        $package->setDistUrl($url);

        return $package;
    }
326241
private function evaluateDirectory($directory = null)
    {
        $directory = $this->setDirectoryFallback($directory);

        /** @noinspection PhpAssignmentInConditionInspection */
        $this->run($directory);
    }