class Item {
private $value;
public function __construct($value) {
$this->value = $value;
}
public function getValue() {
return $this->value;
}
}
$items = [
new Item(1),
new Item(7),
new Item(7),
];
$res = \WS\Utils\Collections\CollectionFactory::from($items)
->stream()
->map(function ($a) {
return $a;
})
->sortBy(function(Item $item) {
return $item->getValue();
})
->getCollection()
;
echo $res->size();