|
@@ 330-338 (lines=9) @@
|
| 327 |
|
* @throws MappingException |
| 328 |
|
* @return mixed |
| 329 |
|
*/ |
| 330 |
|
public function max($key = null) |
| 331 |
|
{ |
| 332 |
|
return $this->reduce(function ($result, $item) use ($key) { |
| 333 |
|
$wrapper = $this->factory->make($item); |
| 334 |
|
|
| 335 |
|
return (is_null($result) || $wrapper->getEntityAttribute($key) > $result) ? |
| 336 |
|
$wrapper->getEntityAttribute($key) : $result; |
| 337 |
|
}); |
| 338 |
|
} |
| 339 |
|
|
| 340 |
|
/** |
| 341 |
|
* Get the min value of a given key. |
|
@@ 347-355 (lines=9) @@
|
| 344 |
|
* @throws MappingException |
| 345 |
|
* @return mixed |
| 346 |
|
*/ |
| 347 |
|
public function min($key = null) |
| 348 |
|
{ |
| 349 |
|
return $this->reduce(function ($result, $item) use ($key) { |
| 350 |
|
$wrapper = $this->factory->make($item); |
| 351 |
|
|
| 352 |
|
return (is_null($result) || $wrapper->getEntityAttribute($key) < $result) |
| 353 |
|
? $wrapper->getEntityAttribute($key) : $result; |
| 354 |
|
}); |
| 355 |
|
} |
| 356 |
|
|
| 357 |
|
/** |
| 358 |
|
* Get an array with the values of a given key. |