获取当前pathinfo

@access public
@param string $inputEncoding 输入编码
@param string $outputEncoding 输出编码
@return string
15185
public function _pathinfo() {

        if(isset($this->server['PATH_INFO'])) {
            return $this->server['PATH_INFO'];
        }

        return str_replace(
            '/index.php',
            '',
            explode('?',$this->uri)[0]
        );


        $inputEncoding = NULL;
        $outputEncoding = NULL;
        //参考Zend Framework对pahtinfo的处理, 更好的兼容性
        $pathInfo = NULL;

        //处理requestUri
        $requestUri   = $this->uri;
        $finalBaseUrl = $this->baseurl;

        // Remove the query string from REQUEST_URI
        if ($pos = strpos($requestUri, '?')) {
            $requestUri = substr($requestUri, 0, $pos);
        }

        if ((NULL !== $finalBaseUrl) && (false === ($pathInfo = substr($requestUri, strlen($finalBaseUrl))))  ) {
            // If substr() returns false then PATH_INFO is set to an empty string
            $pathInfo = '/';
        }
        elseif (NULL === $finalBaseUrl) {
            $pathInfo = $requestUri;
        }

        if ($pathInfo) {
            //针对iis的utf8编码做强制转换
            //参考http://docs.moodle.org/ja/%E5%A4%9A%E8%A8%80%E8%AA%9E%E5%AF%BE%E5%BF%9C%EF%BC%9A%E3%82%B5%E3%83%BC%E3%83%90%E3%81%AE%E8%A8%AD%E5%AE%9A
            if (!empty($inputEncoding) && !empty($outputEncoding) && (stripos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') !== false || stripos($_SERVER['SERVER_SOFTWARE'], 'ExpressionDevServer') !== false) ) {
                if (function_exists('mb_convert_encoding')) {
                    $pathInfo = mb_convert_encoding($pathInfo, $outputEncoding, $inputEncoding);
                }
                else if (function_exists('iconv')) {
                    $pathInfo = iconv($inputEncoding, $outputEncoding, $pathInfo);
                }
            }
        }
        else {
            $pathInfo = '/';
        }

        return '/' . ltrim(urldecode($pathInfo), '/');
    }
74026
public static function getReplacedPath($path, &$inputMap)  {
        
        $pattern = '/{(.*?)}/';
        $result = $path;
        preg_match_all($pattern, $path, $matches);
        
        foreach ($matches[1] as $key) {
            if (array_key_exists ( $key , $inputMap )) {
                $result = str_replace("{".$key."}", $inputMap[$key], $result);
                unset($inputMap[$key]);
            } else {
                throw new \Exception ("Error, path paramer: '$key' expected but not found in input map");
            }
        }
        return $result;
        
        
    }
301507
public function buildPath($pathInfo)
    {
        if (null === $this->getPath()) {
            return $pathInfo;
        }

        return sprintf($this->getPath(), rtrim($pathInfo, '/'));
    }
959776
protected function convertEncoding(&$string, $toEncoding, $fromEncoding) {
		if($string && is_string($string) && $toEncoding != $fromEncoding) {
			static $isMbString;
			if($isMbString === null) {
				$isMbString = extension_loaded('mbstring');
			}
			if($isMbString) {
				$string = @mb_convert_encoding($string, $toEncoding, $fromEncoding) ? : $string;
			}
			else {
				$string = @iconv($fromEncoding, $toEncoding . '//IGNORE', $string) ? : $string;
			}
			if(!$string && $toEncoding == 'UTF-8') {
				$string = utf8_encode($string);
			}
		}
	}
206039
public void setOutputEncoding(String outputEncoding) {
        this.log("Setting output encoding to " + outputEncoding, LogLevel.DEBUG.getLevel());
        this.outputEncoding = outputEncoding;
    }
1052110
private function generateEncryptRequest(InputInterface $input, OutputInterface $output)
    {
        $algorithmId = $input->getArgument('algorithm_id');
        $plaintextValue = $input->getArgument('plaintext_value');
        $key = $input->getOption('key');
        $keyProvided = $input->hasParameterOption(['--key', '-k']);

        $questionText = 'Plaintext value to be encrypted (hidden input): ';
        $plaintextAsker = $this->questionAskerGenerator
            ->generateHiddenInputQuestionAsker($questionText, $input, $output);

        return $this->encryptRequestFactory
            ->createEncryptRequest($algorithmId, $key, $keyProvided, $plaintextAsker, $plaintextValue);
    }
406021
public function inputEncoding(string $encoding): self
    {
        $encoding = $this->filterEncoding($encoding);
        if ($encoding === $this->input_encoding) {
            return $this;
        }

        $clone = clone $this;
        $clone->input_encoding = $encoding;

        return $clone;
    }
959773
public static function charsetDecode($input,$_input_charset ,$_output_charset) {
        $output = "";
        if(!isset($_input_charset) )$_input_charset  = $_input_charset ;
        if($_input_charset == $_output_charset || $input ==null ) {
            $output = $input;
        } elseif (function_exists("mb_convert_encoding")) {
            $output = mb_convert_encoding($input,$_output_charset,$_input_charset);
        } elseif(function_exists("iconv")) {
            $output = iconv($_input_charset,$_output_charset,$input);
        } else die("sorry, you have no libs support for charset changes.");
        return $output;
    }
87230
public static function create($defaultEncoding = 'UTF-8')
    {
        if (isset(self::$chain[$defaultEncoding])) {
            return self::$chain[$defaultEncoding];
        }
        
        $transcoders = [];
        
        try {
            $transcoders[] = new MbTranscoder($defaultEncoding);
        } catch (ExtensionMissingException $mb) {
            // Ignore missing mbstring extension; fall back to iconv
        }

        try {
            $transcoders[] = new IconvTranscoder($defaultEncoding);
        } catch (ExtensionMissingException $iconv) {
            // Neither mbstring nor iconv
            throw $iconv;
        }
        
        self::$chain[$defaultEncoding] = new self($transcoders);

        return self::$chain[$defaultEncoding];
    }
1199295
private function getFilePath(InputInterface $input, $subDir)
    {
        $path = [];

        $path[] = $this->getContainer()->getParameter('sculpin.source_dir');
        $path[] = $subDir;
        $path[] = $input->getOption('filename');

        return implode(DIRECTORY_SEPARATOR, array_filter($path));
    }
1017402
public static function DirtyFopenConvertEncoding ($arg_file_path, $to_encoding, $from_encoding, $php_path = null) {
		//==============================================
		//何があっても/etcにはアクセスさせない
		//==============================================
		$file_path = realpath($arg_file_path);
		if (!$file_path) {
			throw CoreException::RaiseSystemError('対象ファイルが存在しません。path:%s', [$arg_file_path]);
		}

		if (substr($file_path, 0, 5) === '/etc/') {
			throw CoreException::RaiseSystemError('/etc以下を狙ったアクセスが行われました！path:%s', [$file_path]);
		}

		$php_path = $php_path ?: \PHP_BINARY;
		if (!realpath($php_path)) {
			throw CoreException::RaiseSystemError('対象コマンドが存在しません。path:%s', [$php_path]);
		}

		if ($php_path !== 'php' && substr(realpath($php_path), 0, 5) === '/etc/') {
			throw CoreException::RaiseSystemError('/etc以下を狙ったアクセスが行われました！path:%s', [$php_path]);
		}

		//
		$to_encoding = $to_encoding ?: mb_internal_encoding();

		if ($from_encoding) {
			$command = sprintf(
				"echo mb_convert_encoding(file_get_contents('%s'), '%s', '%s');",
				$file_path,
				$to_encoding,
				$from_encoding
			);
		} else {
			$command = sprintf(
				"echo mb_convert_encoding(file_get_contents('%s'), '%s');",
				$file_path,
				$to_encoding
			);
		}
//@TODO rbを定数化
		return popen(sprintf('%s -d memory_limit=-1 -r %s', escapeshellarg($php_path), escapeshellarg($command)), 'rb');
	}
50807
public function pathinfo($option = null)
    {
        if (null === $option) {
            return pathinfo($this->_filePath);
        }
        return pathinfo($this->_filePath, $option);
    }
28293
public static String encodePath(String path, String encoding) throws UnsupportedEncodingException {
		return HierarchicalUriComponents.encodeUriComponent(path, encoding, HierarchicalUriComponents.Type.PATH);
	}
1272024
public function compileFile($inputFilename, $outputFilename = null)
    {
        if (!$this->prepareEnvironment($inputFilename)) {
            return $inputFilename;
        }
        if ($outputFilename === null) {
            $outputFilename = PATH_site.$this->cachePath.basename($inputFilename);
        }
        $outputFilenamePathInfo = pathinfo($outputFilename);
        $noExtensionFilename = $outputFilename.'-'.hash('crc32b', $inputFilename).'-'.hash('crc32b', serialize($this->overrides)).'-'.hash('crc32b', filemtime($inputFilename));
        $preparedFilename = $noExtensionFilename.'.'.$outputFilenamePathInfo['extension'];
        $cacheFilename = $noExtensionFilename.'.cache';
        $outputFilename = $noExtensionFilename.'.css';

        $this->inputFilename = $inputFilename;
        $this->outputFilename = $outputFilename;
        $this->cacheFilename = $cacheFilename;

        // exit if a precompiled version already exists
        if ((file_exists($outputFilename)) && (!ApplicationContext::isDevelopmentModeActive() && (!$this->config['enableDebugMode']))) {
            return $outputFilename;
        }

        //write intermediate file, if the source has been changed, the rest is done by the cache management
        if (@filemtime($outputFilename) < @filemtime($inputFilename) || $this->_checkIfCompileNeeded($inputFilename)) {
            file_put_contents($preparedFilename, $this->_prepareCompile(file_get_contents($inputFilename)));

            $fileContent = $this->_postCompile($this->_compileFile($inputFilename, $preparedFilename, $outputFilename, $cacheFilename));

            // dispatch signal
            $fileContent = $this->signalSlotDispatcher->dispatch(__CLASS__, self::SIGNAL_DYNCSS_AFTER_FILE_PARSED, [$fileContent]);

            if ($fileContent !== false) {
                file_put_contents($outputFilename, $fileContent);
                \TYPO3\CMS\Core\Utility\GeneralUtility::fixPermissions($outputFilename);
                // important for some cache clearing scenarios
                if (file_exists($preparedFilename)) {
                    unlink($preparedFilename);
                }
            }
        }

        return $outputFilename;
    }
420181
public function get(string $input_format, string $output_format): ConverterInterface
    {
        $definition = $this->definition_factory->get($input_format, $output_format);

        foreach ($this->converters as $class => $formats) {
            if ([$input_format, $output_format] === $formats) {
                $assets = new Metadata\Assets();
                $assets->setLogger($this->logger);

                $toc = new Metadata\TableOfContents();
                $glossary = new Metadata\Glossary();

                /** @var ConverterInterface $converter */
                $converter = new $class($definition, $assets, $toc, $glossary);
                $converter->setLogger($this->logger);

                return $converter;
            }
        }

        throw new ConverterNotFoundException(
            'No converter could be found to convert from ' . $input_format . ' to ' . $output_format
        );
    }
471740
public void setInputEncoding(String inputEncoding) {
        this.log("Setting input encoding to " + inputEncoding, LogLevel.DEBUG.getLevel());
        this.inputEncoding = inputEncoding;
    }
1095591
protected function determineOutputFormat($pathToImage)
    {
        $outputFormat = pathinfo($pathToImage, PATHINFO_EXTENSION);

        if ($this->outputFormat != '') {
            $outputFormat = $this->outputFormat;
        }

        $outputFormat = strtolower($outputFormat);

        if (! $this->isValidOutputFormat($outputFormat)) {
            $outputFormat = 'jpg';
        }

        return $outputFormat;
    }