class ComponentTagCompiler (View source)

Properties

protected BladeCompiler $blade The Blade compiler instance.
protected array $aliases The component class aliases.
protected array $boundAttributes The "bind:" attributes that have been compiled for the current component.

Methods

void
__construct(array $aliases = [], BladeCompiler|null $blade = null)

Create new component tag compiler.

string
compile(string $value)

Compile the component and slot tags within the given string.

string
compileTags(string $value)

Compile the tags within the given string.

string
compileOpeningTags(string $value)

Compile the opening tags within the given string.

string
compileSelfClosingTags(string $value)

Compile the self-closing tags within the given string.

string
componentString(string $component, array $attributes)

Compile the Blade component string for the given component and attributes.

string
componentClass(string $component)

Get the component class for a given component alias.

string
guessClassName(string $component)

Guess the class name for the given component.

string
guessViewName(string $name)

Guess the view name for the given component.

array
partitionDataAndAttributes(string $class, array $attributes)

Partition the data and extra attributes from the given array of attributes.

string
compileClosingTags(string $value)

Compile the closing tags within the given string.

string
compileSlots(string $value)

Compile the slot tags within the given string.

array
getAttributesFromAttributeString(string $attributeString)

Get an array of attributes from the given attribute string.

string
parseBindAttributes(string $attributeString)

Parse the "bind" attributes in a given attribute string into their fully-qualified syntax.

string
compileAttributeEchos(string $attributeString)

Compile any Blade echo statements that are present in the attribute string.

string
escapeSingleQuotesOutsideOfPhpBlocks(string $value)

Escape the single quotes in the given string that are outside of PHP blocks.

string
attributesToString(array $attributes, bool $escapeBound = true)

Convert an array of attributes to a string.

string
stripQuotes(string $value)

Strip any quotes from the given string.

Details

void __construct(array $aliases = [], BladeCompiler|null $blade = null)

Create new component tag compiler.

Parameters

array $aliases
BladeCompiler|null $blade

Return Value

void

string compile(string $value)

Compile the component and slot tags within the given string.

Parameters

string $value

Return Value

string

string compileTags(string $value)

Compile the tags within the given string.

Parameters

string $value

Return Value

string

Exceptions

InvalidArgumentException

protected string compileOpeningTags(string $value)

Compile the opening tags within the given string.

Parameters

string $value

Return Value

string

Exceptions

InvalidArgumentException

protected string compileSelfClosingTags(string $value)

Compile the self-closing tags within the given string.

Parameters

string $value

Return Value

string

Exceptions

InvalidArgumentException

protected string componentString(string $component, array $attributes)

Compile the Blade component string for the given component and attributes.

Parameters

string $component
array $attributes

Return Value

string

Exceptions

InvalidArgumentException

protected string componentClass(string $component)

Get the component class for a given component alias.

Parameters

string $component

Return Value

string

Exceptions

InvalidArgumentException

string guessClassName(string $component)

Guess the class name for the given component.

Parameters

string $component

Return Value

string

string guessViewName(string $name)

Guess the view name for the given component.

Parameters

string $name

Return Value

string

protected array partitionDataAndAttributes(string $class, array $attributes)

Partition the data and extra attributes from the given array of attributes.

Parameters

string $class
array $attributes

Return Value

array

protected string compileClosingTags(string $value)

Compile the closing tags within the given string.

Parameters

string $value

Return Value

string

string compileSlots(string $value)

Compile the slot tags within the given string.

Parameters

string $value

Return Value

string

protected array getAttributesFromAttributeString(string $attributeString)

Get an array of attributes from the given attribute string.

Parameters

string $attributeString

Return Value

array

protected string parseBindAttributes(string $attributeString)

Parse the "bind" attributes in a given attribute string into their fully-qualified syntax.

Parameters

string $attributeString

Return Value

string

protected string compileAttributeEchos(string $attributeString)

Compile any Blade echo statements that are present in the attribute string.

These echo statements need to be converted to string concatenation statements.

Parameters

string $attributeString

Return Value

string

protected string escapeSingleQuotesOutsideOfPhpBlocks(string $value)

Escape the single quotes in the given string that are outside of PHP blocks.

Parameters

string $value

Return Value

string

protected string attributesToString(array $attributes, bool $escapeBound = true)

Convert an array of attributes to a string.

Parameters

array $attributes
bool $escapeBound

Return Value

string

string stripQuotes(string $value)

Strip any quotes from the given string.

Parameters

string $value

Return Value

string