本文整理汇总了PHP中Illuminate\Support\Arr::build方法的典型用法代码示例。如果您正苦于以下问题:PHP Arr::build方法的具体用法?PHP Arr::build怎么用?PHP Arr::build使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Support\Arr
的用法示例。
在下文中一共展示了Arr::build方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: merge
/**
* Merges parts of a response (or parsed file contents) into a single body
*
* @param ServiceResponseInterface[] $parts
* @return ServiceResponseInterface
*/
public function merge(array $parts)
{
if (!count($parts)) {
return $this->makeNullResponse();
}
$response = $parts[0];
// if there was only one part, just return that
if (count($parts) == 1) {
return $response;
}
// if there were more parts, combine their data as an array
$response->setData(Arr::build($parts, function ($index, ServiceResponseInterface $part) {
/** @var ServiceResponse $part */
return [$index, $part->getData()];
}));
return $response;
}
示例2:
/**
* Build a new array using a callback.
*
* @param array $array
* @param callable $callback
* @return array
*
* @deprecated since version 5.2.
*/
function array_build($array, callable $callback)
{
return Arr::build($array, $callback);
}
示例3: parseFilters
/**
* Parse the given filter string.
*
* @param string $filters
* @return array
*
* @deprecated since version 5.1.
*/
public static function parseFilters($filters)
{
return Arr::build(static::explodeFilters($filters), function ($key, $value) {
return Route::parseFilter($value);
});
}
示例4:
/**
* Build a new array using a callback.
*
* @param array $array
* @param \Closure $callback
* @return array
*/
function array_build($array, Closure $callback)
{
return Arr::build($array, $callback);
}