@@ 56-71 (lines=16) @@ | ||
53 | /** |
|
54 | * {@inheritdoc} |
|
55 | */ |
|
56 | public function sort(ComparatorInterface $criteria = null) |
|
57 | { |
|
58 | $elements = $this->collection->toArray(); |
|
59 | if ($criteria === null) { |
|
60 | $criteria = new Comparator(); |
|
61 | } |
|
62 | ||
63 | uksort($elements, function ($a, $b) use ($criteria) { |
|
64 | return $criteria->compare($a, $b); |
|
65 | }); |
|
66 | ||
67 | $this->clear(); |
|
68 | foreach ($elements as $element) { |
|
69 | $this->add($element); |
|
70 | } |
|
71 | } |
|
72 | ||
73 | /** |
|
74 | * {@inheritdoc} |
@@ 64-79 (lines=16) @@ | ||
61 | /** |
|
62 | * {@inheritdoc} |
|
63 | */ |
|
64 | public function sort(ComparatorInterface $criteria = null) |
|
65 | { |
|
66 | $elements = $this->collection->toArray(); |
|
67 | if ($criteria === null) { |
|
68 | $criteria = new Comparator(); |
|
69 | } |
|
70 | ||
71 | usort($elements, function ($a, $b) use ($criteria) { |
|
72 | return $criteria->compare($a, $b); |
|
73 | }); |
|
74 | ||
75 | $this->clear(); |
|
76 | foreach ($elements as $element) { |
|
77 | $this->add($element); |
|
78 | } |
|
79 | } |
|
80 | ||
81 | /** |
|
82 | * {@inheritdoc} |
@@ 64-79 (lines=16) @@ | ||
61 | /** |
|
62 | * {@inheritdoc} |
|
63 | */ |
|
64 | public function sort(ComparatorInterface $criteria = null) |
|
65 | { |
|
66 | $elements = $this->collection->toArray(); |
|
67 | if ($criteria === null) { |
|
68 | $criteria = new Comparator(); |
|
69 | } |
|
70 | ||
71 | usort($elements, function ($a, $b) use ($criteria) { |
|
72 | return $criteria->compare($a, $b); |
|
73 | }); |
|
74 | ||
75 | $this->clear(); |
|
76 | foreach ($elements as $element) { |
|
77 | $this->add($element); |
|
78 | } |
|
79 | } |
|
80 | ||
81 | /** |
|
82 | * {@inheritdoc} |