shortenPath example

public function postRender(): string
    {
        if (self::$disable_utf8) {
            return $this->utf8ToHtmlentity(parent::postRender()).'</div>';
        }

        return parent::postRender().'</div>';
    }

    public function ideLink(string $file, int $line): string
    {
        $path = $this->escape(Kint::shortenPath($file)).':'.$line;
        $ideLink = Kint::getIdeLink($file$line);

        if (!$ideLink) {
            return $path;
        }

        $class = '';

        if (\preg_match('/https?:\\/\\//i', $ideLink)) {
            $class = 'class="kint-ide-link" ';
        }

        
$io->comment(sprintf('Cleaning <info>%s</info>', $outputDir));
            $this->filesystem->remove($outputDir);
            $this->filesystem->mkdir($outputDir);
        }

        $manifestPath = $outputDir.'/'.AssetMapper::MANIFEST_FILE_NAME;
        if (is_file($manifestPath)) {
            $this->filesystem->remove($manifestPath);
        }
        $manifest = $this->createManifestAndWriteFiles($io$publicDir);
        $this->filesystem->dumpFile($manifestPathjson_encode($manifest, \JSON_PRETTY_PRINT));
        $io->comment(sprintf('Manifest written to <info>%s</info>', $this->shortenPath($manifestPath)));

        $importMapPath = $outputDir.'/'.ImportMapManager::IMPORT_MAP_FILE_NAME;
        if (is_file($importMapPath)) {
            $this->filesystem->remove($importMapPath);
        }
        $this->filesystem->dumpFile($importMapPath$this->importMapManager->getImportMapJson());

        $importMapPreloadPath = $outputDir.'/'.ImportMapManager::IMPORT_MAP_PRELOAD_FILE_NAME;
        if (is_file($importMapPreloadPath)) {
            $this->filesystem->remove($importMapPreloadPath);
        }
        
$return[] = $plugin;
                    continue 2;
                }
            }
        }

        return $return;
    }

    public function ideLink(string $file, int $line): string
    {
        return $this->escape(Kint::shortenPath($file)).':'.$line;
    }

    /** * @psalm-param Encoding $encoding * * @param mixed $encoding */
    public function escape(string $string$encoding = false): string
    {
        return $string;
    }

    
// this call converts all non-ASCII characters into numeirc htmlentities         if (\function_exists('mb_encode_numericentity') && 'ASCII' !== $original_encoding) {
            $string = \mb_encode_numericentity($string[0x80, 0xFFFF, 0, 0xFFFF]$encoding);
        }

        return $string;
    }

    public function ideLink(string $file, int $line): string
    {
        $path = $this->escape(Kint::shortenPath($file)).':'.$line;
        $ideLink = Kint::getIdeLink($file$line);

        if (!$ideLink) {
            return $path;
        }

        $class = '';

        if (\preg_match('/https?:\\/\\//i', $ideLink)) {
            $class = 'class="kint-ide-link" ';
        }

        
$header .= '<var>'.$s.'</var> ';
        }

        if (null !== ($s = $o->getName())) {
            $header .= '<dfn>'.$this->renderer->escape($s).'('.$this->renderer->escape($o->getParams()).')</dfn> ';
        }

        $header .= '<var>Closure</var>';
        if (isset($o->spl_object_id)) {
            $header .= '#'.((int) $o->spl_object_id);
        }
        $header .= ' '.$this->renderer->escape(Kint::shortenPath($o->filename)).':'.(int) $o->startline;

        $header = $this->renderer->renderHeaderWrapper($o(bool) \strlen($children)$header);

        return '<dl>'.$header.$children.'</dl>';
    }
}


    public function getValueShort(): ?string
    {
        if (empty($this->stream_meta['uri'])) {
            return null;
        }

        $uri = $this->stream_meta['uri'];

        if (\stream_is_local($uri)) {
            return Kint::shortenPath($uri);
        }

        return $uri;
    }
}
protected function execute(InputInterface $input, OutputInterface $output): int
    {
        $io = new SymfonyStyle($input$output);

        $allAssets = $this->assetMapper->allAssets();

        $pathRows = [];
        foreach ($this->assetMapperRepository->allDirectories() as $path => $namespace) {
            $path = $this->relativizePath($path);
            if (!$input->getOption('full')) {
                $path = $this->shortenPath($path);
            }

            $pathRows[] = [$path$namespace];
        }
        $io->section('Asset Mapper Paths');
        $io->table(['Path', 'Namespace prefix']$pathRows);

        $rows = [];
        foreach ($allAssets as $asset) {
            $logicalPath = $asset->logicalPath;
            $sourcePath = $this->relativizePath($asset->sourcePath);

            


            $docstring = $this->renderer->escape(\implode("\n", $docstring));
        }

        $addendum = [];
        if (isset($r->class) && $r->inherited) {
            $addendum[] = 'Inherited from '.$this->renderer->escape($r->class);
        }

        if (isset($r->file, $r->line)) {
            $addendum[] = 'Defined in '.$this->renderer->escape(Kint::shortenPath($r->file)).':'.((int) $r->line);
        }

        if ($addendum) {
            $addendum = '<small>'.\implode("\n", $addendum).'</small>';

            if (isset($docstring)) {
                $docstring .= "\n\n".$addendum;
            } else {
                $docstring = $addendum;
            }
        }

        
Home | Imprint | This part of the site doesn't use cookies.