@param string $scriptFilename

@return string
327534
private function findScript(string $scriptFilename): string
    {
        // @todo Make this a setting in config instead. This module shouldn't make assumptions on where it's installed
        $conductorRoot = realpath(__DIR__ . '/../../../../..');
        $configRoot = "$conductorRoot/config/app";
        $environment = $this->applicationConfig->getCurrentEnvironment();

        $environmentPath = "$configRoot/environments/$environment/files";
        if (file_exists("$environmentPath/$scriptFilename")) {
            return "$environmentPath/$scriptFilename";
        }

        $globalPath = "$configRoot/files";
        if (file_exists("$globalPath/$scriptFilename")) {
            return "$globalPath/$scriptFilename";
        }

        throw new Exception\RuntimeException(
            "Script \"$scriptFilename\" not found in \"$environmentPath\" or \"$globalPath\"."
        );
    }
1311639
protected function getOnInitScriptText()
    {
        $scriptText = "";
        if ($this->minimumCoordinates) {
            $minimumCoordinatesValue = Builder::getVec2($this->minimumCoordinates);
            $scriptText              .= "
Graph.CoordsMin = {$minimumCoordinatesValue};";
        }
        if ($this->maximumCoordinates) {
            $maximumCoordinatesValue = Builder::getVec2($this->maximumCoordinates);
            $scriptText              .= "
Graph.CoordsMax = {$maximumCoordinatesValue};";
        }
        return $scriptText;
    }
1195595
function GetScriptFolder()
  {
      if ('' != $this->GetBaseDir()) {
          $current_script_folder_detected = $this->ConvertToUnixPath($this->GetBaseDir());
      } else {
          $current_script_folder_detected = $this->ConvertToUnixPath(dirname(__FILE__));
      }

      if (substr($current_script_folder_detected,-1) != "/") {
          $current_script_folder_detected.="/";
      }
      return $this->ConvertToWindowsPathIfNeeded($current_script_folder_detected);
  }
204060
static public function stripScriptName($path)
	{
	    if (isset($_SERVER['SCRIPT_NAME']) && ($pos = strpos($path, $_SERVER['SCRIPT_NAME'])) === 0) {
	        $path = substr($path, strlen($_SERVER['SCRIPT_NAME']));
	    }
	    return $path;
	}
771594
private String computeScriptName() {
        if (srcFile != null) {
            return srcFile.getAbsolutePath();
        } else {
            String name = PREFIX;
            if (getLocation().getFileName().length() > 0)
                name += getLocation().getFileName().replaceAll("[^\\w_\\.]", "_").replaceAll("[\\.]", "_dot_");
            else
                name += SUFFIX;

            return name;
        }
    }
218139
private function getNormalizedFileName($originalFileName)
    {
        if (false !== strpos($originalFileName, '.')) {
            $pathParts = pathinfo($originalFileName);
            $fileName = $this->pathCleaner->cleanup($pathParts['filename']);
            $fileName .= '.' . $pathParts['extension'];
        } else {
            $fileName = $this->pathCleaner->cleanup($originalFileName);
        }

        return $fileName;
    }
845217
private static String getScriptVarImpl(String scriptName, String key) {
		Map<String, String> scVars = scriptVars.get(scriptName);
		if (scVars == null) {
			// No vars have been associated with this script
			return null;
		}
		
		return scVars.get(key);
	}
1366758
public function main($sourceFileName)
    {
        if ($this->handleDirSep) {
            if (strpos('\\', $sourceFileName) !== false) {
                $sourceFileName = str_replace('\\', '/', $sourceFileName);
            }
        }
        if ($this->reg === null || $this->to === null || !$this->reg->matches((string) $sourceFileName)) {
            return null;
        }

        return [$this->replaceReferences($sourceFileName)];
    }
49543
protected function checkOutputFilename($outputFilename)
    {
        $outputFilename = str_replace(DIRECTORY_SEPARATOR, '/', $outputFilename);
        if (strpos($outputFilename, DIR_BASE . '/') === 0) {
            $displayFilename = substr($outputFilename, strlen(DIR_BASE));
        } else {
            $displayFilename = $outputFilename;
        }
        if ($this->filesystem->isFile($outputFilename)) {
            if (!$this->filesystem->isWritable($outputFilename)) {
                throw new UserMessageException(t('The file %s is not writable', $displayFilename));
            }
        } else {
            $p = strrpos($outputFilename, '/');
            if ($p === false) {
                $outputFolder = '.';
            } else {
                $outputFolder = substr($outputFilename, 0, $p + 1);
            }
            if (!$this->filesystem->isDirectory($outputFolder)) {
                throw new UserMessageException(t('The directory containing %s does not exist', $displayFilename));
            }
            if (!$this->filesystem->isWritable($outputFolder)) {
                throw new UserMessageException(t('The directory containing %s is not writable', $displayFilename));
            }
        }
    }
589689
public function getFilename()
    {
        if (isset($this->viewVars['_filename'])) {
            return $this->viewVars['_filename'] . '.xlsx';
        }

        return Inflector::slug(str_replace('.xlsx', '', $this->request->url)) . '.xlsx';
    }
797691
public static function get_filename( $name = '' ) {
		$name = str_replace( '.svg', '', $name );
		$filename = dirname( dirname( __DIR__ ) ) . "/svg/$name.svg";

		if ( file_exists( $filename ) ) {
			return $filename;
		}

		return '';
	}
1074050
public function getScript() : ?string 
    {
        if ( ! $this->hasScript()) {
            $this->setScript($this->getDefaultScript());
        }
        return $this->script;
    }
590372
public function getScript()
    {
        if(count($this->aCalls) == 0)
        {
            return $this->sSelector;
        }
        return $this->sSelector . '.' . implode('.', $this->aCalls);
    }
202327
public function filename($filename = null)
    {
        if ($filename === null) {
            return $this->_filename;
        }
        $this->_filename = $filename;
    }
202824
public function makeValidFileName($sFilename)
    {
        $sFilename = preg_replace('/[\s]+/', '_', $sFilename);
        $sFilename = preg_replace('/[^a-zA-Z0-9_\.-]/', '', $sFilename);

        return str_replace(' ', '_', $sFilename);
    }
45652
public static function getFileNameWithoutExtension($fileName)
    {
        $matches = [];

        if (is_string($fileName) && (bool)preg_match('|(.+)\.(.+)|', $fileName, $matches)) {
            return $matches[1];
        }

        return '';
    }
612337
private function removeJsExtension(string $filename): string
  {
    $extension = substr($filename, -strlen($this->extension));
    if ($extension==$this->extension)
    {
      return substr($filename, 0, -strlen($this->extension));
    }

    return $filename;
  }