本文整理匯總了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);
}