The
head
function returns the first element in the given array:<?php $array = [100, 200, 300];
$first = head($array);
<?php $this->registerComponentForNextTest($classes);
$url = '/livewire-dusk/'.urlencode(head($classes)).$queryString;
return $browser->visit($url)->waitForLivewireToLoad();
}
<?php static function beforeFirstDot($subject)
{
return head(explode('.', $subject));
}
static function afterFirstDot($subject) : string
<?php static function provide()
{
ComponentAttributeBag::macro('wire', function ($name) {
$entries = head((array) $this->whereStartsWith('wire:'.$name));
$directive = head(array_keys($entries));
$value = head(array_values($entries));
<?php ComponentAttributeBag::macro('wire', function ($name) {
$entries = head((array) $this->whereStartsWith('wire:'.$name));
$directive = head(array_keys($entries));
$value = head(array_values($entries));
return new WireDirective($name, $directive, $value);
<?php $entries = head((array) $this->whereStartsWith('wire:'.$name));
$directive = head(array_keys($entries));
$value = head(array_values($entries));
return new WireDirective($name, $directive, $value);
});
<?php public function extractOriginalNameFromFilePath($path)
{
return base64_decode(head(explode('-', last(explode('-meta', str($path)->replace('_', '/'))))));
}
public static function createFromLivewire($filePath)
<?php {
return function ($js, $expects = true) {
PHPUnit::assertEquals($expects, head($this->script(
str($js)->start('return ')
)));
return $this;
};
<?php } else {
$rule = head(array_values($rules));
$rule = (string) str($rule)->before(':');
<?php protected function flattenValue($value)
{
return is_array($value) ? head(Arr::flatten($value)) : $value;
}
<?php $column = $this->wrap($having['column']);
$min = $this->parameter(head($having['values']));
$max = $this->parameter(last($having['values']));
<?php }
if (str_starts_with($value, '--env')) {
return head(array_slice(explode('=', $value), 1));
}
}
}
<?php protected function middlewareNames($middleware)
{
$stripped = head(explode(':', $middleware));
yield $stripped;
<?php protected function mergeRulesForAttribute($results, $attribute, $rules)
{
$merge = head($this->explodeRules([$rules]));
$results[$attribute] = array_merge(
isset($results[$attribute]) ? $this->explodeExplicitRule($results[$attribute], $attribute) : [], $merge
<?php public function testHead()
{
$array = ['a', 'b', 'c'];
$this->assertSame('a', head($array));
}
public function testLast()