original_string: protected function setFilename(&$name, $folder, $override = false)
      {
          $folder = trim($folder, '/');
          $extension = strrchr($name, '.');
          $len = mb_strlen($name) - mb_strlen($extension);
          $nameOrig = substr($name,0,$len);
          $num = 0;
          do {
              if (!$override && $num > 0) {
                  $name = "{$nameOrig}-{$num}{$extension}";
              }
              $num++;
  
              $filename  = "/{$folder}/{$name}";
          } while ($this->storage->exists($filename));
  
          return $filename;
      }
code: protected function setFilename(&$name, $folder, $override = false)
      {
          $folder = trim($folder, '/');
          $extension = strrchr($name, '.');
          $len = mb_strlen($name) - mb_strlen($extension);
          $nameOrig = substr($name,0,$len);
          $num = 0;
          do {
              if (!$override && $num > 0) {
                  $name = "{$nameOrig}-{$num}{$extension}";
              }
              $num++;
  
              $filename  = "/{$folder}/{$name}";
          } while ($this->storage->exists($filename));
  
          return $filename;
      }
code_tokens: protected function setFilename ( & $ name , $ folder , $ override = false ) { $ folder = trim ( $ folder , '/' ) ; $ extension = strrchr ( $ name , '.' ) ; $ len = mb_strlen ( $ name ) - mb_strlen ( $ extension ) ; $ nameOrig = substr ( $ name , 0 , $ len ) ; $ num = 0 ; do { if ( ! $ override && $ num > 0 ) { $ name = "{$nameOrig}-{$num}{$extension}" ; } $ num ++ ; $ filename = "/{$folder}/{$name}" ; } while ( $ this -> storage -> exists ( $ filename ) ) ; return $ filename ; }
docstring: Crypt filename and concat with folder
  
  @param string $name   Name Original, Return Referer
  @param string $folder Remote Folder
  
  @return string
  @throws
docstring_tokens: Crypt filename and concat with folder