示例#1
0
 /**
  * Sort the array using the given Closure.
  *
  * @param  array     $array
  * @param  \Closure  $callback
  * @return array
  */
 public static function sort($array, Closure $callback)
 {
     return Collection::make($array)->sortBy($callback)->all();
 }
示例#2
0
 public function test_paginate()
 {
     $c = new Collection(array('one', 'two', 'three', 'four'));
     $this->assertEquals(array('one', 'two'), $c->forPage(1, 2)->all());
     $this->assertEquals(array('three', 'four'), $c->forPage(2, 2)->all());
     $this->assertEquals(array(), $c->forPage(3, 2)->all());
 }