The
value
function returns the value it is given. However, if you pass a closure to the function, the closure will be executed and its returned value will be returned:<?php $result = value(true);
$result = value(function () {
return false;
});
<?php $first = array_shift($segments);
if (! isset($array[$first])) {
return value($default);
}
$value = $array[$first];
<?php $rulesFromOutside = array_merge_recursive(
...array_map(
fn($i) => value($i),
$this->rulesFromOutside
)
);
<?php $messagesFromOutside = array_merge(
...array_map(
fn($i) => value($i),
$this->messagesFromOutside
)
);
<?php $validationAttributesFromOutside = array_merge(
...array_map(
fn($i) => value($i),
$this->validationAttributesFromOutside
)
);
<?php function get($instance, $key, $default = null)
{
if (! isset($this->lookup[$instance])) {
return value($default);
}
if (! isset($this->lookup[$instance][$key])) {
<?php }
if (! isset($this->lookup[$instance][$key])) {
return value($default);
}
return $this->lookup[$instance][$key];
<?php function find($instance, $key, $iKey = null, $default = null)
{
if (! isset($this->lookup[$instance])) {
return value($default);
}
if (! isset($this->lookup[$instance][$key])) {
<?php }
if (! isset($this->lookup[$instance][$key])) {
return value($default);
}
if ($iKey !== null && ! isset($this->lookup[$instance][$key][$iKey])) {
<?php }
if ($iKey !== null && ! isset($this->lookup[$instance][$key][$iKey])) {
return value($default);
}
return $iKey !== null
<?php protected function render($component, $default = null)
{
if ($html = store($component)->get('skipRender', false)) {
$html = value(is_string($html) ? $html : $default);
if (! $html) return;
<?php function __call($method, $params)
{
if (! method_exists($this->target, $method)) return value($this->fallback);
try {
return ImplicitlyBoundMethod::call(app(), [$this->target, $method], $params);
<?php public function dispatchIf($boolean)
{
return value($boolean) ? $this->dispatch() : null;
}
<?php public function dispatchUnless($boolean)
{
return ! value($boolean) ? $this->dispatch() : null;
}
<?php if (is_null($value)) {
$this->event(new CacheMissed($this->getName(), $key));
$value = value($default);
} else {
$this->event(new CacheHit($this->getName(), $key, $value));
}
<?php if (is_null($value)) {
$this->event(new CacheMissed($this->getName(), $key));
return (isset($keys[$key]) && ! array_is_list($keys)) ? value($keys[$key]) : null;
}