Namespaces

  • Latte
    • Loaders
    • Macros
    • Runtime
  • Nette
    • Application
      • Responses
      • Routers
      • UI
    • Bridges
      • ApplicationDI
      • ApplicationLatte
      • ApplicationTracy
      • CacheDI
      • CacheLatte
      • DatabaseDI
      • DatabaseTracy
      • DITracy
      • FormsDI
      • FormsLatte
      • Framework
      • HttpDI
      • HttpTracy
      • MailDI
      • ReflectionDI
      • SecurityDI
      • SecurityTracy
    • Caching
      • Storages
    • ComponentModel
    • Database
      • Conventions
      • Drivers
      • Table
    • DI
      • Config
        • Adapters
      • Extensions
    • Forms
      • Controls
      • Rendering
    • Http
    • Iterators
    • Loaders
    • Localization
    • Mail
    • Neon
    • PhpGenerator
      • Traits
    • Reflection
    • Security
    • Tokenizer
    • Utils
  • Tracy
    • Bridges
      • Nette
  • none

Classes

  • Compiler
  • Engine
  • Helpers
  • HtmlNode
  • MacroNode
  • MacroTokens
  • Parser
  • PhpHelpers
  • PhpWriter
  • Token
  • TokenIterator
  • Tokenizer

Interfaces

  • ILoader
  • IMacro

Traits

  • Strict

Exceptions

  • CompileException
  • RegexpException
  • RuntimeException
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Other releases

Class PhpWriter

PHP code generator helpers.

Latte\PhpWriter uses Latte\Strict
Namespace: Latte
Located at Latte/Compiler/PhpWriter.php
Methods summary
public static
# using( Latte\MacroNode $node )
public
# __construct( Latte\MacroTokens $tokens, $modifiers = null, array $context = null )
public string
# write( string $mask )

Expands %node.word, %node.array, %node.args, %escape(), %modify(), %var, %raw, %word in code.

Expands %node.word, %node.array, %node.args, %escape(), %modify(), %var, %raw, %word in code.

Parameters

$mask

Returns

string
string
public string
# formatModifiers( string $var, $isContent = false )

Formats modifiers calling.

Formats modifiers calling.

Parameters

$var
$isContent

Returns

string
string
public string
# formatArgs( Latte\MacroTokens $tokens = null )

Formats macro arguments to PHP code. (It advances tokenizer to the end as a side effect.)

Formats macro arguments to PHP code. (It advances tokenizer to the end as a side effect.)

Returns

string
string
public string
# formatArray( Latte\MacroTokens $tokens = null )

Formats macro arguments to PHP array. (It advances tokenizer to the end as a side effect.)

Formats macro arguments to PHP array. (It advances tokenizer to the end as a side effect.)

Returns

string
string
public string
# formatWord( string $s )

Formats parameter to PHP string.

Formats parameter to PHP string.

Parameters

$s

Returns

string
string
public Latte\MacroTokens
# preprocess( Latte\MacroTokens $tokens = null )

Preprocessor for tokens. (It advances tokenizer to the end as a side effect.)

Preprocessor for tokens. (It advances tokenizer to the end as a side effect.)

Returns

Latte\MacroTokens
MacroTokens
public
# validateTokens( Latte\MacroTokens $tokens )

Throws

Latte\CompileException
CompileException
public Latte\MacroTokens
# removeCommentsPass( Latte\MacroTokens $tokens )

Removes PHP comments.

Removes PHP comments.

Returns

Latte\MacroTokens
MacroTokens
public Latte\MacroTokens
# shortTernaryPass( Latte\MacroTokens $tokens )

Simplified ternary expressions without third part.

Simplified ternary expressions without third part.

Returns

Latte\MacroTokens
MacroTokens
public Latte\MacroTokens
# expandCastPass( Latte\MacroTokens $tokens )

Pseudocast (expand).

Pseudocast (expand).

Returns

Latte\MacroTokens
MacroTokens
public Latte\MacroTokens
# quotingPass( Latte\MacroTokens $tokens )

Quotes symbols to strings.

Quotes symbols to strings.

Returns

Latte\MacroTokens
MacroTokens
public Latte\MacroTokens
# inOperatorPass( Latte\MacroTokens $tokens )

Syntax $entry in [item1, item2].

Syntax $entry in [item1, item2].

Returns

Latte\MacroTokens
MacroTokens
public Latte\MacroTokens
# inlineModifierPass( Latte\MacroTokens $tokens )

Process inline filters ($var|filter)

Process inline filters ($var|filter)

Returns

Latte\MacroTokens
MacroTokens
public Latte\MacroTokens
# modifierPass( Latte\MacroTokens $tokens, string|array $var, $isContent = false )

Formats modifiers calling.

Formats modifiers calling.

Parameters

$tokens
$var
$isContent

Returns

Latte\MacroTokens
MacroTokens

Throws

Latte\CompileException
CompileException
public Latte\MacroTokens
# escapePass( Latte\MacroTokens $tokens )

Escapes expression in tokens.

Escapes expression in tokens.

Returns

Latte\MacroTokens
MacroTokens
Methods used from Latte\Strict
__call(), __callStatic(), __get(), __isset(), __set(), __unset()
Nette 2.4-20180918 API API documentation generated by ApiGen 2.8.0