class CodeExtension extends AbstractExtension
Twig extension relate to PHP code and used by the profiler and the default exception templates.
| __construct(string|FileLinkFormatter $fileLinkFormat, string $rootDir, string $charset) | ||
| getFilters() {@inheritdoc} | ||
| abbrClass($class) | ||
| abbrMethod($method) | ||
| string | formatArgs(array $args) Formats an array as a string. | |
| string | formatArgsAsText(array $args) Formats an array as a string. | |
| string | fileExcerpt(string $file, int $line, int $srcContext = 3) Returns an excerpt of a code file around the given line number. | |
| string | formatFile(string $file, int $line, string $text = null) Formats a file path. | |
| string|false | getFileLink(string $file, int $line) Returns the link for a given file/line pair. | |
| formatFileFromText($text) | ||
| formatLogMessage($message, array $context) | ||
| getName() {@inheritdoc} | ||
| static | fixCodeMarkup($line) |
| string|FileLinkFormatter | $fileLinkFormat | The format for links to source files |
| string | $rootDir | The project root directory |
| string | $charset | The charset |
{@inheritdoc}
| $class |
| $method |
Formats an array as a string.
| array | $args | The argument array |
| string |
Formats an array as a string.
| array | $args | The argument array |
| string |
Returns an excerpt of a code file around the given line number.
| string | $file | A file path |
| int | $line | The selected line number |
| int | $srcContext | The number of displayed lines around or -1 for the whole file |
| string | An HTML string |
Formats a file path.
| string | $file | An absolute file path |
| int | $line | The line number |
| string | $text | Use this text for the link rather than the file path |
| string |
Returns the link for a given file/line pair.
| string | $file | An absolute file path |
| int | $line | The line number |
| string|false | A link or false |
| $text |
| $message | ||
| array | $context |
{@inheritdoc}
| $line |
© 2004–2017 Fabien Potencier
Licensed under the MIT License.
https://api.symfony.com/4.1/Symfony/Bridge/Twig/Extension/CodeExtension.html