original_string: protected static function _move_tour(tour $tour, $direction) {
          $currentsortorder   = $tour->get_sortorder();
          $targetsortorder    = $currentsortorder + $direction;
  
          $swapwith = helper::get_tour_from_sortorder($targetsortorder);
  
          // Set the sort order to something out of the way.
          $tour->set_sortorder(-1);
          $tour->persist();
  
          // Swap the two sort orders.
          $swapwith->set_sortorder($currentsortorder);
          $swapwith->persist();
  
          $tour->set_sortorder($targetsortorder);
          $tour->persist();
      }
code: protected static function _move_tour(tour $tour, $direction) {
          $currentsortorder   = $tour->get_sortorder();
          $targetsortorder    = $currentsortorder + $direction;
  
          $swapwith = helper::get_tour_from_sortorder($targetsortorder);
  
          // Set the sort order to something out of the way.
          $tour->set_sortorder(-1);
          $tour->persist();
  
          // Swap the two sort orders.
          $swapwith->set_sortorder($currentsortorder);
          $swapwith->persist();
  
          $tour->set_sortorder($targetsortorder);
          $tour->persist();
      }
code_tokens: protected static function _move_tour ( tour $ tour , $ direction ) { $ currentsortorder = $ tour -> get_sortorder ( ) ; $ targetsortorder = $ currentsortorder + $ direction ; $ swapwith = helper :: get_tour_from_sortorder ( $ targetsortorder ) ; // Set the sort order to something out of the way. $ tour -> set_sortorder ( - 1 ) ; $ tour -> persist ( ) ; // Swap the two sort orders. $ swapwith -> set_sortorder ( $ currentsortorder ) ; $ swapwith -> persist ( ) ; $ tour -> set_sortorder ( $ targetsortorder ) ; $ tour -> persist ( ) ; }
docstring: Move a tour up or down.
  
  @param   tour    $tour   The tour to move.
  
  @param   int     $direction
docstring_tokens: Move a tour up or down .