/**
  * In order to improve performance for a larger number of redirects, instead of a standard array being generated
  *      an associative array (keyed on the 'from' URL) is generated which allows a direct check rather than needing
  *      to iterate through a large list (especially considering this would be done on each page request).
  *
  * @return \Heyday\Redirects\Redirect[]
  */
 public function get()
 {
     $data = array();
     /* @var \Heyday\Redirects\Redirect $redirect */
     foreach (array_map([$this->transformer, 'transform'], $this->list->toArray()) as $redirect) {
         // Format the URL so it will match the SS_HTTPRequest request URL
         $data[Redirect::formatUrl($redirect->getFrom())] = $redirect;
     }
     return $data;
 }
 /**
  * takes a DataList of Rateable DataObjects and sorts them by their average score 
  * @param DataList $list
  * @return ArrayList
  **/
 public function sortByRating(DataList $list, $dir = 'DESC')
 {
     $items = new ArrayList($list->toArray());
     foreach ($items as $item) {
         $score = $item->getAverageScore();
         $item->Score = $score ? $score : 0;
         $item->Title = $item->Title;
     }
     return $items->sort('Score', $dir);
 }
 /**
  * @return \Heyday\Redirects\Redirect[]
  */
 public function get()
 {
     return array_map([$this->transformer, 'transform'], $this->list->toArray());
 }