3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace TorrentPHP; /** * Interface ClientAdaptor * * If you want to add support for your own torrent client of choice, you need to create an ClientAdaptor that sends * commands to your client. For transmission and vuze, these are RPC calls over the HTTP protocol, but your client may * require command-line calls, for example. * * @package TorrentPHP */ interface ClientAdaptor { /** * Add a torrent to the client * * Each client may have different requirements to add a torrent, so an array of arguments with the key being the * argument name and the value being the argument value is required. It is therefore the specific implementation's * responsibility to provide validation throughout it's usage. * * @param array $arguments A single dimensional array of key value pairs * * @throws ClientException When the client does not return expected output to say that this action succeeded * * @return Torrent The newly added torrent object */ public function addTorrent(array $arguments); /** * Start a torrent * * @param Torrent $torrent * * @throws ClientException When the client does not return expected output to say that this action succeeded * * @return Torrent The newly started torrent object */ public function startTorrent(Torrent $torrent); /** * Pause a torrent * * @param Torrent $torrent * * @throws ClientException When the client does not return expected output to say that this action succeeded * * @return Torrent The newly paused torrent object */ public function pauseTorrent(Torrent $torrent); /** * Delete a torrent - be aware this relates to deleting the torrent file and all files associated with it * * @param Torrent $torrent * * @throws ClientException When the client does not return expected output to say that this action succeeded * * @return void */ public function deleteTorrent(Torrent $torrent); } /** * Class Torrent * * Represents the final torrent object provided by TorrentPHP * * @package TorrentPHP */ class Torrent { /** * Default status */ const STATUS_UNKNOWN = -1; /** * A torrent client error has occurred */ const STATUS_ERROR = 0; /** * Torrent is downloading */ const STATUS_DOWNLOADING = 1; /** * Torrent is paused */ const STATUS_PAUSED = 2; /** * Torrent is seeding */ const STATUS_SEEDING = 3; /** * Torrent has completed both downloading and seeding */ const STATUS_COMPLETE = 4; /** * @var array An array of status matching the status constants for validation */ private $statuses = array( self::STATUS_UNKNOWN => 'unknown', self::STATUS_ERROR => 'error', self::STATUS_DOWNLOADING => 'downloading', self::STATUS_PAUSED => 'paused', self::STATUS_SEEDING => 'seeding', self::STATUS_COMPLETE => 'complete' ); /** * @var int The torrent id (used by the torrent client, and may change on each reboot) */ private $id; /** * @var string The torrent hashString which can be used to uniquely identify this torrent */ private $hashString = ''; /** * @var string The torrent name */ private $name = ''; /** * @var int Size of the torrent in bytes */ private $size = 0; /** * @var int Torrent status must be in the $statuses array */ private $status = self::STATUS_UNKNOWN; /** * @var string A string containing an error message */ private $errorString = ''; /** * @var int Download speed in bytes */ private $downloadSpeed = 0; /** * @var int Upload speed in bytes */ private $uploadSpeed = 0; /** * @var float Percentage download completion */ private $percentDone = 0.0; /** * @var int Number of bytes downloaded */ private $bytesDownloaded = 0; /** * @var int Number of bytes uploaded */ private $bytesUploaded = 0; /** * @var float Seeding ratio */ private $seedRatio = 0.0; /** * @var File[] A list of files within the torrent */ private $files = array(); /** * @constructor * * @param int $id The id used by the torrent client (may change on each reboot) * @param string $hashString Uniquely identifiable hash string (remains constant) */ public function __construct($id, $hashString) { $this->id = $id; $this->hashString = $hashString; } /** * Set the torrent name * * @param string $name The name of the torrent */ public function setName($name) { $this->name = $name; } /** * Get torrent name * * @return string The torrent name */ public function getName() { return $this->name; } /** * Set the torrent size in bytes * * @param int $bytes The size of the torrent * * @throws \InvalidArgumentException When an invalid size given */ public function setSize($bytes) { if (is_int($bytes) && $bytes > -1) { $this->size = $bytes; } else { throw new \InvalidArgumentException( 'Invalid torrent size provided. Size should be bigger than "-1" but "%s" given', $bytes ); } } /** * Get torrent size * * @return int The torrent size in bytes */ public function getSize() { return $this->size; } /** * Set the torrent status according to a status within the $statuses array * * @param int $status The status integer (constant representing an integer) * * @throws \InvalidArgumentException When an invalid status integer given */ public function setStatus($status) { if (is_int($status) && isset($this->statuses[$status])) { $this->status = $status; } else { throw new \InvalidArgumentException(sprintf( 'Invalid torrent status provided. Status should be one of "%s", "%s" given.', print_r($this->statuses, true), $status )); } } /** * Get the status integer value * * @return int */ public function getStatus() { return $this->status; } /** * Get the status string * * @return string */ public function getStatusString() { return $this->statuses[$this->status]; } /** * Set error string * * @param string $errorString */ public function setErrorString($errorString) { $this->errorString = $errorString; } /** * Get error string * * @return string */ public function getErrorString() { return $this->errorString; } /** * Set download speed in bytes per second * * @param int $bytesPerSecond * * @throws \InvalidArgumentException When an integer is not provided as the parameter */ public function setDownloadSpeed($bytesPerSecond) { if (is_int($bytesPerSecond) && $bytesPerSecond > -1) { $this->downloadSpeed = $bytesPerSecond; } else { throw new \InvalidArgumentException(sprintf( 'Invalid torrent download speed provided. Download speed should be non-negative integer, "%s" given.', $bytesPerSecond )); } } /** * Get download speed in bytes per second * * @return int */ public function getDownloadSpeed() { return $this->downloadSpeed; } /** * Set upload speed in bytes per second * * @param int $bytesPerSecond * * @throws \InvalidArgumentException When an integer is not provided as the parameter */ public function setUploadSpeed($bytesPerSecond) { if (is_int($bytesPerSecond) && $bytesPerSecond > -1) { $this->uploadSpeed = $bytesPerSecond; } else { throw new \InvalidArgumentException(sprintf( 'Invalid torrent upload speed provided. Upload speed should be non-negative integer, "%s" given.', $bytesPerSecond )); } } /** * Get download speed in bytes per second * * @return int */ public function getUploadSpeed() { return $this->uploadSpeed; } /** * Set number of bytes downloaded * * @param int $numBytes * * @throws \InvalidArgumentException When an integer is not provided as the parameter * * @note Also sets the completion percentage and status to complete if 100% */ public function setBytesDownloaded($numBytes) { if (is_int($numBytes) && $numBytes > -1) { $this->bytesDownloaded = $numBytes; $size = $this->size; $percentDone = function() use ($size, $numBytes) { $size = ($size === 0) ? 1 : $size; $numBytes = ($size > $numBytes) ? $numBytes : 0; if ($size === 0 && $numBytes === 0) { return (float)0; } return (float)number_format(($numBytes / $size) * 100, 2, '.', ''); }; $this->percentDone = $percentDone(); if ($this->percentDone === 100 || $numBytes === $this->size) { $this->status = self::STATUS_COMPLETE; } } else { throw new \InvalidArgumentException(sprintf( 'Invalid torrent bytes downloaded provided. Amount should be non-negative integer, "%s" given.', $numBytes )); } } /** * Get number of bytes downloaded * * @return int */ public function getBytesDownloaded() { return $this->bytesDownloaded; } /** * Set number of bytes uploaded * * @param int $numBytes * * @throws \InvalidArgumentException * * @note Also sets the seed ratio percentage */ public function setBytesUploaded($numBytes) { if (is_int($numBytes) && $numBytes > -1) { $this->bytesUploaded = $numBytes; $downloaded = $this->bytesDownloaded; $seedRatio = function() use ($downloaded, $numBytes) { $downloaded = ($downloaded === 0) ? 1 : $downloaded; $numBytes = ($downloaded > $numBytes) ? $numBytes : 0; if ($downloaded === 0 && $numBytes === 0) { return (float)0; } return (float)number_format(($numBytes / $downloaded) * 100, 2, '.', ''); }; $this->seedRatio = $seedRatio(); } else { throw new \InvalidArgumentException(sprintf( 'Invalid torrent bytes uploaded provided. Amount should be non-negative integer, "%s" given.', $numBytes )); } } /** * Get number of bytes uploaded * * @return int */ public function getBytesUploaded() { return $this->bytesUploaded; } /** * Add a file to the torrent * * @param File $file */ public function addFile(File $file) { if (!in_array($file, $this->files)) { $this->files[] = $file; } } /** * Get the files list * * @return File[] */ public function getFiles() { return $this->files; } /** * Get a specific File by name * * @param string $name * * @throws FileNotFoundException When the file does not exist with the given name * * @return File The found file */ public function getFile($name) { $files = array_values(array_filter($this->files, function($file) use ($name) { /** @var File $file */ return strtolower($file->getName()) === strtolower($name); })); if (!empty($files)) { return $files[0]; } else { throw new FileNotFoundException(sprintf( 'File with name: "%s" not found for torrent: "%s"', $name, $this->name )); } } /** * Get whether or not the torrent has completed both downloading and seeding * * @return bool */ public function isComplete() { return ($this->status === self::STATUS_COMPLETE); } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ADUn5
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  533     0  E > > RETURN                                                   1

Function %00torrentphp%5C%7Bclosure%7D%2Fin%2FADUn5%3A387%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 12
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
2 jumps found. (Code = 46) Position 1 = 16, Position 2 = 18
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 21
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
Branch analysis from position: 12
2 jumps found. (Code = 46) Position 1 = 16, Position 2 = 18
Branch analysis from position: 16
Branch analysis from position: 18
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 12
Branch analysis from position: 10
Branch analysis from position: 12
filename:       /in/ADUn5
function name:  TorrentPHP\{closure}
number of ops:  32
compiled vars:  !0 = $size, !1 = $numBytes
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  387     0  E >   BIND_STATIC                                              !0
          1        BIND_STATIC                                              !1
  388     2        IS_IDENTICAL                                             !0, 0
          3      > JMPZ                                                     ~2, ->6
          4    >   QM_ASSIGN                                        ~3      1
          5      > JMP                                                      ->7
          6    >   QM_ASSIGN                                        ~3      !0
          7    >   ASSIGN                                                   !0, ~3
  389     8        IS_SMALLER                                               !1, !0
          9      > JMPZ                                                     ~5, ->12
         10    >   QM_ASSIGN                                        ~6      !1
         11      > JMP                                                      ->13
         12    >   QM_ASSIGN                                        ~6      0
         13    >   ASSIGN                                                   !1, ~6
  391    14        IS_IDENTICAL                                     ~8      !0, 0
         15      > JMPZ_EX                                          ~8      ~8, ->18
         16    >   IS_IDENTICAL                                     ~9      !1, 0
         17        BOOL                                             ~8      ~9
         18    > > JMPZ                                                     ~8, ->21
  392    19    >   CAST                                          5  ~10     0
         20      > RETURN                                                   ~10
  395    21    >   INIT_NS_FCALL_BY_NAME                                    'TorrentPHP%5Cnumber_format'
         22        DIV                                              ~11     !1, !0
         23        MUL                                              ~12     ~11, 100
         24        SEND_VAL_EX                                              ~12
         25        SEND_VAL_EX                                              2
         26        SEND_VAL_EX                                              '.'
         27        SEND_VAL_EX                                              ''
         28        DO_FCALL                                      0  $13     
         29        CAST                                          5  ~14     $13
         30      > RETURN                                                   ~14
  396    31*     > RETURN                                                   null

End of function %00torrentphp%5C%7Bclosure%7D%2Fin%2FADUn5%3A387%240

Function %00torrentphp%5C%7Bclosure%7D%2Fin%2FADUn5%3A441%241:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 12
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
2 jumps found. (Code = 46) Position 1 = 16, Position 2 = 18
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 21
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
Branch analysis from position: 12
2 jumps found. (Code = 46) Position 1 = 16, Position 2 = 18
Branch analysis from position: 16
Branch analysis from position: 18
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 12
Branch analysis from position: 10
Branch analysis from position: 12
filename:       /in/ADUn5
function name:  TorrentPHP\{closure}
number of ops:  32
compiled vars:  !0 = $downloaded, !1 = $numBytes
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  441     0  E >   BIND_STATIC                                              !0
          1        BIND_STATIC                                              !1
  442     2        IS_IDENTICAL                                             !0, 0
          3      > JMPZ                                                     ~2, ->6
          4    >   QM_ASSIGN                                        ~3      1
          5      > JMP                                                      ->7
          6    >   QM_ASSIGN                                        ~3      !0
          7    >   ASSIGN                                                   !0, ~3
  443     8        IS_SMALLER                                               !1, !0
          9      > JMPZ                                                     ~5, ->12
         10    >   QM_ASSIGN                                        ~6      !1
         11      > JMP                                                      ->13
         12    >   QM_ASSIGN                                        ~6      0
         13    >   ASSIGN                                                   !1, ~6
  445    14        IS_IDENTICAL                                     ~8      !0, 0
         15      > JMPZ_EX                                          ~8      ~8, ->18
         16    >   IS_IDENTICAL                                     ~9      !1, 0
         17        BOOL                                             ~8      ~9
         18    > > JMPZ                                                     ~8, ->21
  446    19    >   CAST                                          5  ~10     0
         20      > RETURN                                                   ~10
  449    21    >   INIT_NS_FCALL_BY_NAME                                    'TorrentPHP%5Cnumber_format'
         22        DIV                                              ~11     !1, !0
         23        MUL                                              ~12     ~11, 100
         24        SEND_VAL_EX                                              ~12
         25        SEND_VAL_EX                                              2
         26        SEND_VAL_EX                                              '.'
         27        SEND_VAL_EX                                              ''
         28        DO_FCALL                                      0  $13     
         29        CAST                                          5  ~14     $13
         30      > RETURN                                                   ~14
  450    31*     > RETURN                                                   null

End of function %00torrentphp%5C%7Bclosure%7D%2Fin%2FADUn5%3A441%241

Function %00torrentphp%5C%7Bclosure%7D%2Fin%2FADUn5%3A507%242:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ADUn5
function name:  TorrentPHP\{closure}
number of ops:  13
compiled vars:  !0 = $file, !1 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  507     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
  509     2        INIT_NS_FCALL_BY_NAME                                    'TorrentPHP%5Cstrtolower'
          3        INIT_METHOD_CALL                                         !0, 'getName'
          4        DO_FCALL                                      0  $2      
          5        SEND_VAR_NO_REF_EX                                       $2
          6        DO_FCALL                                      0  $3      
          7        INIT_NS_FCALL_BY_NAME                                    'TorrentPHP%5Cstrtolower'
          8        SEND_VAR_EX                                              !1
          9        DO_FCALL                                      0  $4      
         10        IS_IDENTICAL                                     ~5      $3, $4
         11      > RETURN                                                   ~5
  510    12*     > RETURN                                                   null

End of function %00torrentphp%5C%7Bclosure%7D%2Fin%2FADUn5%3A507%242

Class TorrentPHP\ClientAdaptor:
Function addtorrent:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ADUn5
function name:  addTorrent
number of ops:  2
compiled vars:  !0 = $arguments
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   RECV                                             !0      
          1      > RETURN                                                   null

End of function addtorrent

Function starttorrent:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ADUn5
function name:  startTorrent
number of ops:  2
compiled vars:  !0 = $torrent
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   40     0  E >   RECV                                             !0      
          1      > RETURN                                                   null

End of function starttorrent

Function pausetorrent:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ADUn5
function name:  pauseTorrent
number of ops:  2
compiled vars:  !0 = $torrent
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   51     0  E >   RECV                                             !0      
          1      > RETURN                                                   null

End of function pausetorrent

Function deletetorrent:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ADUn5
function name:  deleteTorrent
number of ops:  2
compiled vars:  !0 = $torrent
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   62     0  E >   RECV                                             !0      
          1      > RETURN                                                   null

End of function deletetorrent

End of class TorrentPHP\ClientAdaptor.

Class TorrentPHP\Torrent:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ADUn5
function name:  __construct
number of ops:  7
compiled vars:  !0 = $id, !1 = $hashString
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  187     0  E >   RECV                                             !0      
          1        RECV                                             !1      
  189     2        ASSIGN_OBJ                                               'id'
          3        OP_DATA                                                  !0
  190     4        ASSIGN_OBJ                                               'hashString'
          5        OP_DATA                                                  !1
  191     6      > RETURN                                                   null

End of function __construct

Function setname:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ADUn5
function name:  setName
number of ops:  4
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  198     0  E >   RECV                                             !0      
  200     1        ASSIGN_OBJ                                               'name'
          2        OP_DATA                                                  !0
  201     3      > RETURN                                                   null

End of function setname

Function getname:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ADUn5
function name:  getName
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  210     0  E >   FETCH_OBJ_R                                      ~0      'name'
          1      > RETURN                                                   ~0
  211     2*     > RETURN                                                   null

End of function getname

Function setsize:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 11
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 7
filename:       /in/ADUn5
function name:  setSize
number of ops:  17
compiled vars:  !0 = $bytes
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  220     0  E >   RECV                                             !0      
  222     1        INIT_NS_FCALL_BY_NAME                                    'TorrentPHP%5Cis_int'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $1      
          4      > JMPZ_EX                                          ~2      $1, ->7
          5    >   IS_SMALLER                                       ~3      -1, !0
          6        BOOL                                             ~2      ~3
          7    > > JMPZ                                                     ~2, ->11
  224     8    >   ASSIGN_OBJ                                               'size'
          9        OP_DATA                                                  !0
         10      > JMP                                                      ->16
  228    11    >   NEW                                              $5      'InvalidArgumentException'
  229    12        SEND_VAL_EX                                              'Invalid+torrent+size+provided.+Size+should+be+bigger+than+%22-1%22+but+%22%25s%22+given'
         13        SEND_VAR_EX                                              !0
         14        DO_FCALL                                      0          
         15      > THROW                                         0          $5
  232    16    > > RETURN                                                   null

End of function setsize

Function getsize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ADUn5
function name:  getSize
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  241     0  E >   FETCH_OBJ_R                                      ~0      'size'
          1      > RETURN                                                   ~0
  242     2*     > RETURN                                                   null

End of function getsize

Function setstatus:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 12
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 8
filename:       /in/ADUn5
function name:  setStatus
number of ops:  28
compiled vars:  !0 = $status
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  251     0  E >   RECV                                             !0      
  253     1        INIT_NS_FCALL_BY_NAME                                    'TorrentPHP%5Cis_int'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $1      
          4      > JMPZ_EX                                          ~2      $1, ->8
          5    >   FETCH_OBJ_IS                                     ~3      'statuses'
          6        ISSET_ISEMPTY_DIM_OBJ                         0  ~4      ~3, !0
          7        BOOL                                             ~2      ~4
          8    > > JMPZ                                                     ~2, ->12
  255     9    >   ASSIGN_OBJ                                               'status'
         10        OP_DATA                                                  !0
         11      > JMP                                                      ->27
  259    12    >   NEW                                              $6      'InvalidArgumentException'
         13        INIT_NS_FCALL_BY_NAME                                    'TorrentPHP%5Csprintf'
  260    14        SEND_VAL_EX                                              'Invalid+torrent+status+provided.+Status+should+be+one+of+%22%25s%22%2C+%22%25s%22+given.'
  261    15        INIT_NS_FCALL_BY_NAME                                    'TorrentPHP%5Cprint_r'
         16        CHECK_FUNC_ARG                                           
         17        FETCH_OBJ_FUNC_ARG                               $7      'statuses'
         18        SEND_FUNC_ARG                                            $7
         19        SEND_VAL_EX                                              <true>
         20        DO_FCALL                                      0  $8      
         21        SEND_VAR_NO_REF_EX                                       $8
  260    22        SEND_VAR_EX                                              !0
         23        DO_FCALL                                      0  $9      
         24        SEND_VAR_NO_REF_EX                                       $9
         25        DO_FCALL                                      0          
         26      > THROW                                         0          $6
  264    27    > > RETURN                                                   null

End of function setstatus

Function getstatus:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ADUn5
function name:  getStatus
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  273     0  E >   FETCH_OBJ_R                                      ~0      'status'
          1      > RETURN                                                   ~0
  274     2*     > RETURN                                                   null

End of function getstatus

Function getstatusstring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ADUn5
function name:  getStatusString
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  283     0  E >   FETCH_OBJ_R                                      ~1      'status'
          1        FETCH_OBJ_R                                      ~0      'statuses'
          2        FETCH_DIM_R                                      ~2      ~0, ~1
          3      > RETURN                                                   ~2
  284     4*     > RETURN                                                   null

End of function getstatusstring

Function seterrorstring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ADUn5
function name:  setErrorString
number of ops:  4
compiled vars:  !0 = $errorString
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  291     0  E >   RECV                                             !0      
  293     1        ASSIGN_OBJ                                               'errorString'
          2        OP_DATA                                                  !0
  294     3      > RETURN                                                   null

End of function seterrorstring

Function geterrorstring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ADUn5
function name:  getErrorString
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  303     0  E >   FETCH_OBJ_R                                      ~0      'errorString'
          1      > RETURN                                                   ~0
  304     2*     > RETURN                                                   null

End of function geterrorstring

Function setdownloadspeed:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 11
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 7
filename:       /in/ADUn5
function name:  setDownloadSpeed
number of ops:  20
compiled vars:  !0 = $bytesPerSecond
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  313     0  E >   RECV                                             !0      
  315     1        INIT_NS_FCALL_BY_NAME                                    'TorrentPHP%5Cis_int'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $1      
          4      > JMPZ_EX                                          ~2      $1, ->7
          5    >   IS_SMALLER                                       ~3      -1, !0
          6        BOOL                                             ~2      ~3
          7    > > JMPZ                                                     ~2, ->11
  317     8    >   ASSIGN_OBJ                                               'downloadSpeed'
          9        OP_DATA                                                  !0
         10      > JMP                                                      ->19
  321    11    >   NEW                                              $5      'InvalidArgumentException'
         12        INIT_NS_FCALL_BY_NAME                                    'TorrentPHP%5Csprintf'
  322    13        SEND_VAL_EX                                              'Invalid+torrent+download+speed+provided.+Download+speed+should+be+non-negative+integer%2C+%22%25s%22+given.'
         14        SEND_VAR_EX                                              !0
         15        DO_FCALL                                      0  $6      
         16        SEND_VAR_NO_REF_EX                                       $6
         17        DO_FCALL                                      0          
         18      > THROW                                         0          $5
  326    19    > > RETURN                                                   null

End of function setdownloadspeed

Function getdownloadspeed:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ADUn5
function name:  getDownloadSpeed
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  335     0  E >   FETCH_OBJ_R                                      ~0      'downloadSpeed'
          1      > RETURN                                                   ~0
  336     2*     > RETURN                                                   null

End of function getdownloadspeed

Function setuploadspeed:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 11
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 7
filename:       /in/ADUn5
function name:  setUploadSpeed
number of ops:  20
compiled vars:  !0 = $bytesPerSecond
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  345     0  E >   RECV                                             !0      
  347     1        INIT_NS_FCALL_BY_NAME                                    'TorrentPHP%5Cis_int'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $1      
          4      > JMPZ_EX                                          ~2      $1, ->7
          5    >   IS_SMALLER                                       ~3      -1, !0
          6        BOOL                                             ~2      ~3
          7    > > JMPZ                                                     ~2, ->11
  349     8    >   ASSIGN_OBJ                                               'uploadSpeed'
          9        OP_DATA                                                  !0
         10      > JMP                                                      ->19
  353    11    >   NEW                                              $5      'InvalidArgumentException'
         12        INIT_NS_FCALL_BY_NAME                                    'TorrentPHP%5Csprintf'
  354    13        SEND_VAL_EX                                              'Invalid+torrent+upload+speed+provided.+Upload+speed+should+be+non-negative+integer%2C+%22%25s%22+given.'
         14        SEND_VAR_EX                                              !0
         15        DO_FCALL                                      0  $6      
         16        SEND_VAR_NO_REF_EX                                       $6
         17        DO_FCALL                                      0          
         18      > THROW                                         0          $5
  358    19    > > RETURN                                                   null

End of function setuploadspeed

Function getuploadspeed:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ADUn5
function name:  getUploadSpeed
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  367     0  E >   FETCH_OBJ_R                                      ~0      'uploadSpeed'
          1      > RETURN                                                   ~0
  368     2*     > RETURN                                                   null

End of function getuploadspeed

Function setbytesdownloaded:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 31
Branch analysis from position: 8
2 jumps found. (Code = 47) Position 1 = 23, Position 2 = 26
Branch analysis from position: 23
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 30
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 39
Branch analysis from position: 39
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
Branch analysis from position: 26
Branch analysis from position: 31
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 7
filename:       /in/ADUn5
function name:  setBytesDownloaded
number of ops:  40
compiled vars:  !0 = $numBytes, !1 = $size, !2 = $percentDone
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  379     0  E >   RECV                                             !0      
  381     1        INIT_NS_FCALL_BY_NAME                                    'TorrentPHP%5Cis_int'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $3      
          4      > JMPZ_EX                                          ~4      $3, ->7
          5    >   IS_SMALLER                                       ~5      -1, !0
          6        BOOL                                             ~4      ~5
          7    > > JMPZ                                                     ~4, ->31
  383     8    >   ASSIGN_OBJ                                               'bytesDownloaded'
          9        OP_DATA                                                  !0
  385    10        FETCH_OBJ_R                                      ~7      'size'
         11        ASSIGN                                                   !1, ~7
  387    12        DECLARE_LAMBDA_FUNCTION                                  '%00torrentphp%5C%7Bclosure%7D%2Fin%2FADUn5%3A387%240'
         13        BIND_LEXICAL                                             ~9, !1
    

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
263.62 ms | 1428 KiB | 24 Q