original_string: public function getGoodsSN() 
      {
          $step = 5000;
          $start = 100;
          $max = Goods::max('sn');
          $max = count($max) && $max > $start ? $max : $start;
          $sn = $max+1;
          $sn_str = strval($sn);
          if(str_contains($sn_str, '4')) {
              $sn_str = str_replace('4', '5', $sn_str);
          }
          $sn = intval($sn_str);
  
          $in_offer = Offer::where('sn', $sn)->first();
          $max_offer = Offer::max('sn');
  
          if(count($in_offer)) {
              $sn = $step * ceil($max_offer / $step)+ $step;
          }
          return $sn;
      }
code: public function getGoodsSN() 
      {
          $step = 5000;
          $start = 100;
          $max = Goods::max('sn');
          $max = count($max) && $max > $start ? $max : $start;
          $sn = $max+1;
          $sn_str = strval($sn);
          if(str_contains($sn_str, '4')) {
              $sn_str = str_replace('4', '5', $sn_str);
          }
          $sn = intval($sn_str);
  
          $in_offer = Offer::where('sn', $sn)->first();
          $max_offer = Offer::max('sn');
  
          if(count($in_offer)) {
              $sn = $step * ceil($max_offer / $step)+ $step;
          }
          return $sn;
      }
code_tokens: public function getGoodsSN ( ) { $ step = 5000 ; $ start = 100 ; $ max = Goods :: max ( 'sn' ) ; $ max = count ( $ max ) && $ max > $ start ? $ max : $ start ; $ sn = $ max + 1 ; $ sn_str = strval ( $ sn ) ; if ( str_contains ( $ sn_str , '4' ) ) { $ sn_str = str_replace ( '4' , '5' , $ sn_str ) ; } $ sn = intval ( $ sn_str ) ; $ in_offer = Offer :: where ( 'sn' , $ sn ) -> first ( ) ; $ max_offer = Offer :: max ( 'sn' ) ; if ( count ( $ in_offer ) ) { $ sn = $ step * ceil ( $ max_offer / $ step ) + $ step ; } return $ sn ; }
docstring: get shop sn
docstring_tokens: get shop sn