original_string: public static function progress()
      {
          static $filesize = null;
  
          $args           = func_get_args();
          $isCurlResource = is_resource($args[0]) && get_resource_type($args[0]) === 'curl';
  
          $notification_code = !$isCurlResource ? $args[0] : false;
          $bytes_transferred = $isCurlResource ? $args[2] : $args[4];
  
          if ($isCurlResource) {
              $filesize = $args[1];
          } elseif ($notification_code == STREAM_NOTIFY_FILE_SIZE_IS) {
              $filesize = $args[5];
          }
  
          if ($bytes_transferred > 0) {
              if ($notification_code == STREAM_NOTIFY_PROGRESS | STREAM_NOTIFY_COMPLETED || $isCurlResource) {
  
                  $progress = [
                      'code'        => $notification_code,
                      'filesize'    => $filesize,
                      'transferred' => $bytes_transferred,
                      'percent'     => $filesize <= 0 ? '-' : round(($bytes_transferred * 100) / $filesize, 1)
                  ];
  
                  if (self::$callback !== null) {
                      call_user_func(self::$callback, $progress);
                  }
              }
          }
      }
code: public static function progress()
      {
          static $filesize = null;
  
          $args           = func_get_args();
          $isCurlResource = is_resource($args[0]) && get_resource_type($args[0]) === 'curl';
  
          $notification_code = !$isCurlResource ? $args[0] : false;
          $bytes_transferred = $isCurlResource ? $args[2] : $args[4];
  
          if ($isCurlResource) {
              $filesize = $args[1];
          } elseif ($notification_code == STREAM_NOTIFY_FILE_SIZE_IS) {
              $filesize = $args[5];
          }
  
          if ($bytes_transferred > 0) {
              if ($notification_code == STREAM_NOTIFY_PROGRESS | STREAM_NOTIFY_COMPLETED || $isCurlResource) {
  
                  $progress = [
                      'code'        => $notification_code,
                      'filesize'    => $filesize,
                      'transferred' => $bytes_transferred,
                      'percent'     => $filesize <= 0 ? '-' : round(($bytes_transferred * 100) / $filesize, 1)
                  ];
  
                  if (self::$callback !== null) {
                      call_user_func(self::$callback, $progress);
                  }
              }
          }
      }
code_tokens: public static function progress ( ) { static $ filesize = null ; $ args = func_get_args ( ) ; $ isCurlResource = is_resource ( $ args [ 0 ] ) && get_resource_type ( $ args [ 0 ] ) === 'curl' ; $ notification_code = ! $ isCurlResource ? $ args [ 0 ] : false ; $ bytes_transferred = $ isCurlResource ? $ args [ 2 ] : $ args [ 4 ] ; if ( $ isCurlResource ) { $ filesize = $ args [ 1 ] ; } elseif ( $ notification_code == STREAM_NOTIFY_FILE_SIZE_IS ) { $ filesize = $ args [ 5 ] ; } if ( $ bytes_transferred > 0 ) { if ( $ notification_code == STREAM_NOTIFY_PROGRESS | STREAM_NOTIFY_COMPLETED || $ isCurlResource ) { $ progress = [ 'code' => $ notification_code , 'filesize' => $ filesize , 'transferred' => $ bytes_transferred , 'percent' => $ filesize <= 0 ? '-' : round ( ( $ bytes_transferred * 100 ) / $ filesize , 1 ) ] ; if ( self :: $ callback !== null ) { call_user_func ( self :: $ callback , $ progress ) ; } } } }
docstring: Progress normalized for cURL and Fopen
  Accepts a variable length of arguments passed in by stream method
docstring_tokens: Progress normalized for cURL and Fopen Accepts a variable length of arguments passed in by stream method