AnonymousComponent
class AnonymousComponent extends Component (View source)
Properties
protected array | $except | The properties / methods that should not be exposed to the component. |
from Component |
string | $componentName | The component alias name. |
from Component |
ComponentAttributeBag | $attributes | The component attributes. |
from Component |
static protected Factory|null | $factory | The view factory instance, if any. |
from Component |
static protected | $componentsResolver | The component resolver callback. |
from Component |
static protected array<string,string> | $bladeViewCache | The cache of blade view names, keyed by contents. |
from Component |
static protected array | $propertyCache | The cache of public property names, keyed by class. |
from Component |
static protected array | $methodCache | The cache of public method names, keyed by class. |
from Component |
static protected array<class-string,array<int,string>> | $constructorParametersCache | The cache of constructor parameters, keyed by class. |
from Component |
static protected array | $ignoredParameterNames | The cache of ignored parameter names. |
from Component |
protected string | $view | The component view. |
|
protected array | $data | The component data. |
Methods
Resolve the component instance with the given data.
Extract the constructor parameters for the component.
Resolve the Blade view or view file that should be used when rendering the component.
Create a Blade view with the raw component string content.
Create a Blade view with the raw component string content.
Get the data that should be supplied to the view.
Create a callable variable from the given method.
Create an invokable, toStringable variable for the given component method.
Determine if the given property / method should be ignored.
Set the extra attributes that the component should make available.
Get a new attribute bag instance.
Get the evaluated view contents for the given view.
Get the cached set of anonymous component constructor parameter names to exclude.
Set the callback that should be used to resolve components within views.
Create a new anonymous component instance.
Details
static Component
resolve(array $data)
Resolve the component instance with the given data.
static protected array
extractConstructorParameters()
Extract the constructor parameters for the component.
View|Htmlable|Closure|string
resolveView()
Resolve the Blade view or view file that should be used when rendering the component.
protected string
extractBladeViewFromString(string $contents)
Create a Blade view with the raw component string content.
protected string
createBladeViewFromString(Factory $factory, string $contents)
Create a Blade view with the raw component string content.
array
data()
Get the data that should be supplied to the view.
protected array
extractPublicProperties()
Extract the public properties for the component.
protected array
extractPublicMethods()
Extract the public methods for the component.
protected mixed
createVariableFromMethod(ReflectionMethod $method)
Create a callable variable from the given method.
protected InvokableComponentVariable
createInvokableVariable(string $method)
Create an invokable, toStringable variable for the given component method.
protected bool
shouldIgnore(string $name)
Determine if the given property / method should be ignored.
protected array
ignoredMethods()
Get the methods that should be ignored.
$this
withName(string $name)
Set the component alias name.
$this
withAttributes(array $attributes)
Set the extra attributes that the component should make available.
protected ComponentAttributeBag
newAttributeBag(array $attributes = [])
Get a new attribute bag instance.
bool
shouldRender()
Determine if the component should be rendered.
View
view(string|null $view, Arrayable|array $data = [], array $mergeData = [])
Get the evaluated view contents for the given view.
protected Factory
factory()
Get the view factory instance.
static array
ignoredParameterNames()
Get the cached set of anonymous component constructor parameter names to exclude.
static void
flushCache()
Flush the component's cached state.
static void
forgetFactory()
Forget the component's factory instance.
static void
forgetComponentsResolver()
internal |
Forget the component's resolver callback.
static void
resolveComponentsUsing($resolver)
internal |
Set the callback that should be used to resolve components within views.
void
__construct(string $view, array $data)
Create a new anonymous component instance.