Example #1
0
 /**
  * return a proxied SortList
  */
 public function sort($sortList = null)
 {
     if (is_null($sortList)) {
         if (is_null($this->sortList)) {
             $this->sortList = new \ESQ\Sort\SortList();
         }
     } elseif ($sortList instanceof \ESQ\Sort\SortList) {
         $this->sortList = $sortList;
     } else {
         throw new \InvalidArgumentException('first argument must be instance of SortList or null');
     }
     $proxy = new Proxy($this->sortList);
     $search = $this;
     return $proxy->register('back', function () use($search) {
         return $search;
     });
 }