original_string: public function setPosition(Model $model, $position)
      {
          if ($position === $model->getListifyPosition()) {
              return $position;
          }
  
          switch ($position) {
  
              case null:
              case OrderablePosition::REMOVE:
                  $model->removeFromList();
                  break;
  
              case OrderablePosition::UP:
                  $model->moveHigher();
                  break;
  
              case OrderablePosition::DOWN:
                  $model->moveLower();
                  break;
  
              case OrderablePosition::TOP:
                  if ($model->isInList()) {
                      $model->moveToTop();
                  } else {
                      $model->insertAt();
                  }
                  break;
  
              case OrderablePosition::BOTTOM:
                  if ($model->isInList()) {
                      $model->moveToBottom();
                  } else {
                      $model->insertAt();
                      $model->moveToBottom();
                  }
                  break;
  
              default:
                  $position = (int) $position;
  
                  $model->insertAt($position);
          }
  
          return $model->getListifyPosition();
      }
code: public function setPosition(Model $model, $position)
      {
          if ($position === $model->getListifyPosition()) {
              return $position;
          }
  
          switch ($position) {
  
              case null:
              case OrderablePosition::REMOVE:
                  $model->removeFromList();
                  break;
  
              case OrderablePosition::UP:
                  $model->moveHigher();
                  break;
  
              case OrderablePosition::DOWN:
                  $model->moveLower();
                  break;
  
              case OrderablePosition::TOP:
                  if ($model->isInList()) {
                      $model->moveToTop();
                  } else {
                      $model->insertAt();
                  }
                  break;
  
              case OrderablePosition::BOTTOM:
                  if ($model->isInList()) {
                      $model->moveToBottom();
                  } else {
                      $model->insertAt();
                      $model->moveToBottom();
                  }
                  break;
  
              default:
                  $position = (int) $position;
  
                  $model->insertAt($position);
          }
  
          return $model->getListifyPosition();
      }
code_tokens: public function setPosition ( Model $ model , $ position ) { if ( $ position === $ model -> getListifyPosition ( ) ) { return $ position ; } switch ( $ position ) { case null : case OrderablePosition :: REMOVE : $ model -> removeFromList ( ) ; break ; case OrderablePosition :: UP : $ model -> moveHigher ( ) ; break ; case OrderablePosition :: DOWN : $ model -> moveLower ( ) ; break ; case OrderablePosition :: TOP : if ( $ model -> isInList ( ) ) { $ model -> moveToTop ( ) ; } else { $ model -> insertAt ( ) ; } break ; case OrderablePosition :: BOTTOM : if ( $ model -> isInList ( ) ) { $ model -> moveToBottom ( ) ; } else { $ model -> insertAt ( ) ; $ model -> moveToBottom ( ) ; } break ; default : $ position = ( int ) $ position ; $ model -> insertAt ( $ position ) ; } return $ model -> getListifyPosition ( ) ; }
docstring: Sets a new orderable position for a model.
  
  @param Model|\Czim\Listify\Contracts\ListifyInterface $model
  @param mixed $position
  @return mixed|false
docstring_tokens: Sets a new orderable position for a model .