3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Cache { public static function has( $name ){ return false; } public static function get( $name ){ return null; } public static function put( $name, $value, $time = 1440 ){ return true; } } class Collivery { protected $token; protected $client; protected $config; protected $errors = array(); protected $check_cache = 2; protected $default_address_id; protected $client_id; protected $user_id; /** * Setup class with basic Config * * @param Array $config Configuration Array */ function __construct( array $config = array() ) { $this->config = (object) array( 'app_name' => 'Default App Name', // Application Name 'app_version' => '0.0.1', // Application Version 'app_host' => '', // Framework/CMS name and version, eg 'Wordpress 3.8.1 WooCommerce 2.0.20' / 'Joomla! 2.5.17 VirtueMart 2.0.26d' 'app_url' => '', // URL your site is hosted on 'user_email' => 'demo@collivery.co.za', 'user_password' => 'demo', 'demo' => false, ); foreach ( $config as $key => $value ) { $this->config->$key = $value; } if ( $this->config->demo ){ $this->config->user_email = 'demo@collivery.co.za'; $this->config->user_password = 'demo'; } $this->authenticate(); } /** * Setup the Soap Object * * @return SoapClient MDS Collivery Soap Client */ protected function init () { if ( ! $this->client ){ try { $this->client = new SoapClient( // Setup the soap client 'http://www.collivery.co.za/wsdl/v2', // URL to WSDL File array( 'cache_wsdl' => WSDL_CACHE_NONE ) // Don't cache the WSDL file ); } catch (SoapFault $e) { $this->catchSoapFault( $e ); return false; } } return true; } /** * Checks if the Soap Client has been set, and returns it. * * @return SoapClient Webserver Soap Client */ protected function client() { if ( ! $this->client ) { $this->init(); } if ( ! $this->token ) { $this->authenticate(); } return $this->client; } /** * Authenticate and set the token * * @return string */ protected function authenticate() { if ( ( $this->check_cache == 2 ) && Cache::has('collivery.auth') ) { $authenticate = Cache::get('collivery.auth'); $this->default_address_id = $authenticate['default_address_id']; $this->client_id = $authenticate['client_id']; $this->user_id = $authenticate['user_id']; $this->token = $authenticate['token']; return true; } else { if ( ! $this->init() ) return false; $user_email = $this->config->user_email; $user_password = $this->config->user_password; try { $authenticate = $this->client->authenticate($user_email, $user_password, $this->token, array( 'name' => $this->config->app_name . ' mds/collivery/class', 'version' => $this->config->app_version, 'host' => $this->config->app_host, 'url' => $this->config->app_url, 'lang' => 'PHP '. phpversion(), )); } catch (SoapFault $e) { $this->catchSoapFault( $e ); return false; } if ( is_array( $authenticate ) && isset( $authenticate['token'] ) ){ if ( $this->check_cache != 0 ) Cache::put( 'collivery.auth', $authenticate, 50 ); $this->default_address_id = $authenticate['default_address_id']; $this->client_id = $authenticate['client_id']; $this->user_id = $authenticate['user_id']; $this->token = $authenticate['token']; return true; } else { if ( isset( $result['error_id'] ) ) $this->setError( $result['error_id'], $result['error'] ); else $this->setError( 'result_unexpected', 'No address_id returned.' ); return false; } } } /** * Returns a list of towns and their ID's for creating new addresses. * Town can be filtered by country of province (ZAF Only). * * @param string $country Filter towns by Country * @param string $province Filter towns by South African Provinces * @return array List of towns and their ID's */ public function getTowns( $country = "ZAF", $province = null ) { if ( ( $this->check_cache == 2 ) && is_null( $province ) && Cache::has( 'collivery.towns.'. $country ) ) { return Cache::get( 'collivery.towns.'.$country ); } elseif ( ( $this->check_cache == 2 ) && ! is_null( $province ) && Cache::has( 'collivery.towns.'. $country .'.'. $province ) ) { return Cache::get( 'collivery.towns.'.$country.'.'.$province ); } else { try { $result = $this->client()->get_towns( $this->token, $country, $province ); } catch (SoapFault $e) { $this->catchSoapFault( $e ); return false; } if ( isset( $result['towns'] ) ) { if ( is_null( $province ) ) { if ( $this->check_cache != 0 ) Cache::put( 'collivery.towns.'. $country, $result['towns'], 60*24 ); } else { if ( $this->check_cache != 0 ) Cache::put( 'collivery.towns.'. $country .'.'. $province, $result['towns'], 60*24 ); } return $result['towns']; } else { if ( isset( $result['error_id'] ) ) $this->setError( $result['error_id'], $result['error'] ); else $this->setError( 'result_unexpected', 'No address_id returned.' ); return false; } } } /** * Allows you to search for town and suburb names starting with the given string. * The minimum string length to search is two characters. * Returns a list of towns, suburbs, and the towns the suburbs belong to with their ID's for creating new addresses. * The idea is that this could be used in an auto complete function. * * @param string $name Start of town/suburb name * @return array List of towns and their ID's */ function searchTowns( $name ) { if ( strlen( $name ) < 2 ) { return $this->get_towns(); } elseif ( ( $this->check_cache == 2 ) && Cache::has( 'collivery.search_towns.'. $name ) ) { return Cache::get( 'collivery.search_towns.'. $name ); } else { try { $result = $this->client()->search_towns( $name, $this->token ); } catch (SoapFault $e) { $this->catchSoapFault( $e ); return false; } if ( isset( $result ) ) { if ( $this->check_cache != 0 ) Cache::put( 'collivery.search_towns.'. $name, $result, 60*24 ); return $result; } else { if ( isset( $result['error_id'] ) ) $this->setError( $result['error_id'], $result['error'] ); else $this->setError( 'result_unexpected', 'No address_id returned.' ); return false; } } } /** * Returns all the suburbs of a town. * * @param int $town_id ID of the Town to return suburbs for * @return array */ public function getSuburbs( $town_id ) { if ( ( $this->check_cache == 2 ) && Cache::has( 'collivery.suburbs.'. $town_id ) ) { return Cache::get( 'collivery.suburbs.'. $town_id ); } else { try { $result = $this->client()->get_suburbs( $town_id, $this->token ); } catch (SoapFault $e) { $this->catchSoapFault( $e ); return false; } if ( isset( $result['suburbs'] ) ) { if ( $this->check_cache != 0 ) Cache::put( 'collivery.suburbs.'. $town_id, $result['suburbs'], 60*24*7 ); return $result['suburbs']; } else { if ( isset( $result['error_id'] ) ) $this->setError( $result['error_id'], $result['error'] ); else $this->setError( 'result_unexpected', 'No address_id returned.' ); return false; } } } /** * Returns the type of Address Locations. * Certain location type incur a surcharge due to time spent during * delivery. * * @return array */ public function getLocationTypes() { if ( ( $this->check_cache == 2 ) && Cache::has( 'collivery.location_types' ) ) { return Cache::get( 'collivery.location_types' ); } else { try { $result = $this->client()->get_location_types( $this->token ); } catch (SoapFault $e) { $this->catchSoapFault( $e ); return false; } if ( isset( $result['results'] ) ) { if ( $this->check_cache != 0 ) Cache::put( 'collivery.location_types', $result['results'], 60*24*7 ); return $result['results']; } else { if ( isset( $result['error_id'] ) ) $this->setError( $result['error_id'], $result['error'] ); else $this->setError( 'result_unexpected', 'No address_id returned.' ); return false; } } } /** * Returns the available Collivery services types. * * @return array */ public function getServices() { if ( ( $this->check_cache == 2 ) && Cache::has( 'collivery.services' ) ) { return Cache::get( 'collivery.services' ); } else { try { $result = $this->client()->get_services( $this->token ); } catch (SoapFault $e) { $this->catchSoapFault( $e ); return false; } if ( isset( $result['results'] ) ) { if ( $this->check_cache != 0 ) Cache::put( 'collivery.services', $result['results'], 60*24*7 ); return $result['results']; } else { if ( isset( $result['error_id'] ) ) $this->setError( $result['error_id'], $result['error'] ); else $this->setError( 'result_unexpected', 'No address_id returned.' ); return false; } } } /** * Returns the available Parcel Type ID and value array for use in adding a collivery. * * @return array Parcel Types */ public function getParcelTypes() { if ( ( $this->check_cache == 2 ) && Cache::has( 'collivery.parcel_types' ) ) { return Cache::get( 'collivery.parcel_types' ); } else { try { $result = $this->client()->get_parcel_types( $this->token ); } catch (SoapFault $e) { $this->catchSoapFault( $e ); return false; } if ( is_array( $result ) ) { if ( $this->check_cache != 0 ) Cache::put( 'collivery.parcel_types', $result, 60*24*7 ); return $result; } else { if ( isset( $result['error_id'] ) ) $this->setError( $result['error_id'], $result['error'] ); else $this->setError( 'result_unexpected', 'No address_id returned.' ); return false; } } } /** * Returns the available Parcel Type ID and value array for use in adding a collivery. * * @param int $address_id The ID of the address you wish to retrieve. * @return array Address */ public function getAddress( $address_id ) { if ( ( $this->check_cache == 2 ) && Cache::has( 'collivery.address.'. $this->client_id .'.'. $address_id ) ) { return Cache::get( 'collivery.address.'. $this->client_id .'.'. $address_id ); } else { try { $result = $this->client()->get_address( $address_id, $this->token ); } catch (SoapFault $e) { $this->catchSoapFault( $e ); return false; } if ( isset( $result['address'] ) ) { if ( $this->check_cache != 0 ) Cache::put( 'collivery.address.'. $this->client_id .'.'. $address_id, $result['address'], 60*24 ); return $result['address']; } else { if ( isset( $result['error_id'] ) ) $this->setError( $result['error_id'], $result['error'] ); else $this->setError( 'result_unexpected', 'No address_id returned.' ); return false; } } } /** * Returns all the addresses belonging to a client. * * @param array $filter Filter Addresses * @return array */ public function getAddresses( array $filter = array() ) { if ( ( $this->check_cache == 2 ) && empty( $filter ) && Cache::has( 'collivery.addresses.'. $this->client_id ) ) { return Cache::get( 'collivery.addresses.'. $this->client_id ); } else { try { $result = $this->client()->get_addresses( $this->token, $filter ); } catch (SoapFault $e) { $this->catchSoapFault( $e ); return false; } if ( isset( $result['addresses'] ) ) { if ( $this->check_cache != 0 ) Cache::put( 'collivery.addresses.'. $this->client_id, $result['addresses'], 60*24 ); return $result['addresses']; } else { if ( isset( $result['error_id'] ) ) $this->setError( $result['error_id'], $result['error'] ); else $this->setError( 'result_unexpected', 'No address_id returned.' ); return false; } } } /** * Handle error messages in SoapFault * * @param SoapFault $e SoapFault Object */ protected function catchSoapFault( $e ) { $this->setError( $e->faultcode, $e->faultstring ); } /** * Add a new error * * @param string $id Error ID * @param string $text Error text */ protected function setError( $id, $text ) { $this->errors[ $id ] = $text; } /** * Retrieve errors */ public function getErrors() { return $this->errors; } /** * Check if this instance has an error */ public function hasErrors() { return !empty($this->errors); } /** * Clears all the Errors */ public function clearErrors() { $this->errors = array(); } /** * Disable Cached completely and retrieve data directly from the webservice */ public function disableCache() { $this->check_cache = 0; } /** * Ignore Cached data and retrieve data directly from the webservice * Save returned data to Cache */ public function ignoreCache() { $this->check_cache = 1; } /** * Check if cache exists before querying the webservice * If webservice was queried, save returned data to Cache */ public function enableCache() { $this->check_cache = 2; } } $col = new Collivery; print_r( $col->getErrors() );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OD178
function name:  (null)
number of ops:  9
compiled vars:  !0 = $col
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  492     0  E >   NEW                                              $1      'Collivery'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
  494     3        INIT_FCALL                                               'print_r'
          4        INIT_METHOD_CALL                                         !0, 'getErrors'
          5        DO_FCALL                                      0  $4      
          6        SEND_VAR                                                 $4
          7        DO_ICALL                                                 
          8      > RETURN                                                   1

Class Cache:
Function has:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OD178
function name:  has
number of ops:  3
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1      > RETURN                                                   <false>
    7     2*     > RETURN                                                   null

End of function has

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

End of function get

Function put:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OD178
function name:  put
number of ops:  5
compiled vars:  !0 = $name, !1 = $value, !2 = $time
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV_INIT                                        !2      1440
   12     3      > RETURN                                                   <true>
   13     4*     > RETURN                                                   null

End of function put

End of class Cache.

Class Collivery:
Function __construct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 11
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 11
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 21
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
Branch analysis from position: 11
filename:       /in/OD178
function name:  __construct
number of ops:  24
compiled vars:  !0 = $config, !1 = $value, !2 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   33     0  E >   RECV_INIT                                        !0      <array>
   36     1        CAST                                          8  ~4      <array>
   35     2        ASSIGN_OBJ                                               'config'
   36     3        OP_DATA                                                  ~4
   44     4      > FE_RESET_R                                       $5      !0, ->11
          5    > > FE_FETCH_R                                       ~6      $5, !1, ->11
          6    >   ASSIGN                                                   !2, ~6
   45     7        FETCH_OBJ_W                                      $8      'config'
          8        ASSIGN_OBJ                                               $8, !2
          9        OP_DATA                                                  !1
   44    10      > JMP                                                      ->5
         11    >   FE_FREE                                                  $5
   47    12        FETCH_OBJ_R                                      ~10     'config'
         13        FETCH_OBJ_R                                      ~11     ~10, 'demo'
         14      > JMPZ                                                     ~11, ->21
   48    15    >   FETCH_OBJ_W                                      $12     'config'
         16        ASSIGN_OBJ                                               $12, 'user_email'
         17        OP_DATA                                                  'demo%40collivery.co.za'
   49    18        FETCH_OBJ_W                                      $14     'config'
         19        ASSIGN_OBJ                                               $14, 'user_password'
         20        OP_DATA                                                  'demo'
   51    21    >   INIT_METHOD_CALL                                         'authenticate'
         22        DO_FCALL                                      0          
   52    23      > RETURN                                                   null

End of function __construct

Function init:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 17
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
Found catch point at position: 12
Branch analysis from position: 12
2 jumps found. (Code = 107) Position 1 = 13, Position 2 = -2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OD178
function name:  init
number of ops:  19
compiled vars:  !0 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   61     0  E >   FETCH_OBJ_R                                      ~1      'client'
          1        BOOL_NOT                                         ~2      ~1
          2      > JMPZ                                                     ~2, ->17
   63     3    >   NEW                                              $4      'SoapClient'
   64     4        SEND_VAL_EX                                              'http%3A%2F%2Fwww.collivery.co.za%2Fwsdl%2Fv2'
   65     5        FETCH_CONSTANT                                   ~5      'WSDL_CACHE_NONE'
          6        INIT_ARRAY                                       ~6      ~5, 'cache_wsdl'
          7        SEND_VAL_EX                                              ~6
          8        DO_FCALL                                      0          
   63     9        ASSIGN_OBJ                                               'client'
   65    10        OP_DATA                                                  $4
         11      > JMP                                                      ->17
   67    12  E > > CATCH                                       last         'SoapFault'
   68    13    >   INIT_METHOD_CALL                                         'catchSoapFault'
         14        SEND_VAR_EX                                              !0
         15        DO_FCALL                                      0          
   69    16      > RETURN                                                   <false>
   72    17    > > RETURN                                                   <true>
   73    18*     > RETURN                                                   null

End of function init

Function client:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 10
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
Branch analysis from position: 5
filename:       /in/OD178
function name:  client
number of ops:  13
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   82     0  E >   FETCH_OBJ_R                                      ~0      'client'
          1        BOOL_NOT                                         ~1      ~0
          2      > JMPZ                                                     ~1, ->5
   83     3    >   INIT_METHOD_CALL                                         'init'
          4        DO_FCALL                                      0          
   86     5    >   FETCH_OBJ_R                                      ~3      'token'
          6        BOOL_NOT                                         ~4      ~3
          7      > JMPZ                                                     ~4, ->10
   87     8    >   INIT_METHOD_CALL                                         'authenticate'
          9        DO_FCALL                                      0          
   90    10    >   FETCH_OBJ_R                                      ~6      'client'
         11      > RETURN                                                   ~6
   91    12*     > RETURN                                                   null

End of function client

Function authenticate:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 3, Position 2 = 7
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 26
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
2 jumps found. (Code = 43) Position 1 = 30, Position 2 = 31
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 70
Branch analysis from position: 70
2 jumps found. (Code = 46) Position 1 = 72, Position 2 = 74
Branch analysis from position: 72
2 jumps found. (Code = 43) Position 1 = 75, Position 2 = 97
Branch analysis from position: 75
2 jumps found. (Code = 43) Position 1 = 78, Position 2 = 83
Branch analysis from position: 78
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 83
Branch analysis from position: 97
2 jumps found. (Code = 43) Position 1 = 99, Position 2 = 108
Branch analysis from position: 99
1 jumps found. (Code = 42) Position 1 = 112
Branch analysis from position: 112
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 108
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 74
Branch analysis from position: 7
Found catch point at position: 65
Branch analysis from position: 65
2 jumps found. (Code = 107) Position 1 = 66, Position 2 = -2
Branch analysis from position: 66
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OD178
function name:  authenticate
number of ops:  114
compiled vars:  !0 = $authenticate, !1 = $user_email, !2 = $user_password, !3 = $e, !4 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  100     0  E >   FETCH_OBJ_R                                      ~5      'check_cache'
          1        IS_EQUAL                                         ~6      ~5, 2
          2      > JMPZ_EX                                          ~6      ~6, ->7
          3    >   INIT_STATIC_METHOD_CALL                                  'Cache', 'has'
          4        SEND_VAL                                                 'collivery.auth'
          5        DO_FCALL                                      0  $7      
          6        BOOL                                             ~6      $7
          7    > > JMPZ                                                     ~6, ->26
  101     8    >   INIT_STATIC_METHOD_CALL                                  'Cache', 'get'
          9        SEND_VAL                                                 'collivery.auth'
         10        DO_FCALL                                      0  $8      
         11        ASSIGN                                                   !0, $8
  103    12        FETCH_DIM_R                                      ~11     !0, 'default_address_id'
         13        ASSIGN_OBJ                                               'default_address_id'
         14        OP_DATA                                                  ~11
  104    15        FETCH_DIM_R                                      ~13     !0, 'client_id'
         16        ASSIGN_OBJ                                               'client_id'
         17        OP_DATA                                                  ~13
  105    18        FETCH_DIM_R                                      ~15     !0, 'user_id'
         19        ASSIGN_OBJ                                               'user_id'
         20        OP_DATA                                                  ~15
  106    21        FETCH_DIM_R                                      ~17     !0, 'token'
         22        ASSIGN_OBJ                                               'token'
         23        OP_DATA                                                  ~17
  108    24      > RETURN                                                   <true>
         25*       JMP                                                      ->113
  110    26    >   INIT_METHOD_CALL                                         'init'
         27        DO_FCALL                                      0  $18     
         28        BOOL_NOT                                         ~19     $18
         29      > JMPZ                                                     ~19, ->31
         30    > > RETURN                                                   <false>
  112    31    >   FETCH_OBJ_R                                      ~20     'config'
         32        FETCH_OBJ_R                                      ~21     ~20, 'user_email'
         33        ASSIGN                                                   !1, ~21
  113    34        FETCH_OBJ_R                                      ~23     'config'
         35        FETCH_OBJ_R                                      ~24     ~23, 'user_password'
         36        ASSIGN                                                   !2, ~24
  116    37        FETCH_OBJ_R                                      ~26     'client'
         38        INIT_METHOD_CALL                                         ~26, 'authenticate'
         39        SEND_VAR_EX                                              !1
         40        SEND_VAR_EX                                              !2
         41        CHECK_FUNC_ARG                                           
         42        FETCH_OBJ_FUNC_ARG                               $27     'token'
         43        SEND_FUNC_ARG                                            $27
  118    44        FETCH_OBJ_R                                      ~28     'config'
         45        FETCH_OBJ_R                                      ~29     ~28, 'app_name'
         46        CONCAT                                           ~30     ~29, '+mds%2Fcollivery%2Fclass'
         47        INIT_ARRAY                                       ~31     ~30, 'name'
  119    48        FETCH_OBJ_R                                      ~32     'config'
         49        FETCH_OBJ_R                                      ~33     ~32, 'app_version'
         50        ADD_ARRAY_ELEMENT                                ~31     ~33, 'version'
  120    51        FETCH_OBJ_R                                      ~34     'config'
         52        FETCH_OBJ_R                                      ~35     ~34, 'app_host'
         53        ADD_ARRAY_ELEMENT                                ~31     ~35, 'host'
  121    54        FETCH_OBJ_R                                      ~36     'config'
         55        FETCH_OBJ_R                                      ~37     ~36, 'app_url'
         56        ADD_ARRAY_ELEMENT                                ~31     ~37, 'url'
  122    57        INIT_FCALL                                               'phpversion'
         58        DO_ICALL                                         $38     
         59        CONCAT                                           ~39     'PHP+', $38
         60        ADD_ARRAY_ELEMENT                                ~31     ~39, 'lang'
         61        SEND_VAL_EX                                              ~31
         62        DO_FCALL                                      0  $40     
  116    63        ASSIGN                                                   !0, $40
         64      > JMP                                                      ->70
  124    65  E > > CATCH                                       last         'SoapFault'
  125    66    >   INIT_METHOD_CALL                                         'catchSoapFault'
         67        SEND_VAR_EX                                              !3
         68        DO_FCALL                                      0          
  126    69      > RETURN                                                   <false>
  129    70    >   TYPE_CHECK                                  128  ~43     !0
         71      > JMPZ_EX                                          ~43     ~43, ->74
         72    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~44     !0, 'token'
         73        BOOL                                             ~43     ~44
         74    > > JMPZ                                                     ~43, ->97
  130    75    >   FETCH_OBJ_R                                      ~45     'check_cache'
         76        IS_NOT_EQUAL                                             ~45, 0
         77      > JMPZ                                                     ~46, ->83
         78    >   INIT_STATIC_METHOD_CALL                                  'Cache', 'put'
         79        SEND_VAL                                                 'collivery.auth'
         80        SEND_VAR                                                 !0
         81        SEND_VAL                                                 50
         82        DO_FCALL                                      0          
  132    83    >   FETCH_DIM_R                                      ~49     !0, 'default_address_id'
         84        ASSIGN_OBJ                                               'default_address_id'
         85        OP_DATA                                                  ~49
  133    86        FETCH_DIM_R                                      ~51     !0, 'client_id'
         87        ASSIGN_OBJ                                               'client_id'
         88        OP_DATA                                                  ~51
  134    89        FETCH_DIM_R                                      ~53     !0, 'user_id'
         90        ASSIGN_OBJ                                               'user_id'
         91        OP_DATA                                                  ~53
  135    92        FETCH_DIM_R                                      ~55     !0, 'token'
         93        ASSIGN_OBJ                                               'token'
         94        OP_DATA                                                  ~55
  137    95      > RETURN                                                   <true>
         96*       JMP                                                      ->113
  139    97    >   ISSET_ISEMPTY_DIM_OBJ                         0          !4, 'error_id'
         98      > JMPZ                                                     ~56, ->108
  140    99    >   INIT_METHOD_CALL                                         'setError'
        100        CHECK_FUNC_ARG                                           
        101        FETCH_DIM_FUNC_ARG                               $57     !4, 'error_id'
        102        SEND_FUNC_ARG                                            $57
        103        CHECK_FUNC_ARG                                           
        104        FETCH_DIM_FUNC_ARG                               $58     !4, 'error'
        105        SEND_FUNC_ARG                                            $58
        106        DO_FCALL                                      0          
        107      > JMP                                                      ->112
  142   108    >   INIT_METHOD_CALL                                         'setError'
        109        SEND_VAL_EX                                              'result_unexpected'
        110        SEND_VAL_EX                                              'No+address_id+returned.'
        111        DO_FCALL                                      0          
  144   112    > > RETURN                                                   <false>
  147   113*     > RETURN                                                   null

End of function authenticate

Function gettowns:
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 = 46) Position 1 = 8, Position 2 = 13
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 20
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
2 jumps found. (Code = 46) Position 1 = 23, Position 2 = 26
Branch analysis from position: 23
2 jumps found. (Code = 46) Position 1 = 27, Position 2 = 34
Branch analysis from position: 27
2 jumps found. (Code = 43) Position 1 = 35, Position 2 = 43
Branch analysis from position: 35
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 43
1 jumps found. (Code = 42) Position 1 = 59
Branch analysis from position: 59
2 jumps found. (Code = 43) Position 1 = 61, Position 2 = 89
Branch analysis from position: 61
2 jumps found. (Code = 43) Position 1 = 63, Position 2 = 74
Branch analysis from position: 63
2 jumps found. (Code = 43) Position 1 = 66, Position 2 = 73
Branch analysis from position: 66
1 jumps found. (Code = 42) Position 1 = 86
Branch analysis from position: 86
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 73
Branch analysis from position: 74
2 jumps found. (Code = 43) Position 1 = 77, Position 2 = 86
Branch analysis from position: 77
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 86
Branch analysis from position: 89
2 jumps found. (Code = 43) Position 1 = 91, Position 2 = 100
Branch analysis from position: 91
1 jumps found. (Code = 42) Position 1 = 104
Branch analysis from position: 104
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 100
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 34
Branch analysis from position: 26
Branch analysis from position: 13
Branch analysis from position: 7
Found catch point at position: 54
Branch analysis from position: 54
2 jumps found. (Code = 107) Position 1 = 55, Position 2 = -2
Branch analysis from position: 55
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OD178
function name:  getTowns
number of ops:  106
compiled vars:  !0 = $country, !1 = $province, !2 = $result, !3 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  157     0  E >   RECV_INIT                                        !0      'ZAF'
          1        RECV_INIT                                        !1      null
  159     2        FETCH_OBJ_R                                      ~4      'check_cache'
          3        IS_EQUAL                                         ~5      ~4, 2
          4      > JMPZ_EX                                          ~5      ~5, ->7
          5    >   TYPE_CHECK                                    2  ~6      !1
          6        BOOL                                             ~5      ~6
          7    > > JMPZ_EX                                          ~5      ~5, ->13
          8    >   INIT_STATIC_METHOD_CALL                                  'Cache', 'has'
          9        CONCAT                                           ~7      'collivery.towns.', !0
         10        SEND_VAL                                                 ~7
         11        DO_FCALL                                      0  $8      
         12        BOOL                                             ~5      $8
         13    > > JMPZ                                                     ~5, ->20
  160    14    >   INIT_STATIC_METHOD_CALL                                  'Cache', 'get'
         15        CONCAT                                           ~9      'collivery.towns.', !0
         16        SEND_VAL                                                 ~9
         17        DO_FCALL                                      0  $10     
         18      > RETURN                                                   $10
         19*       JMP                                                      ->105
  161    20    >   FETCH_OBJ_R                                      ~11     'check_cache'
         21        IS_EQUAL                                         ~12     ~11, 2
         22      > JMPZ_EX                                          ~12     ~12, ->26
         23    >   TYPE_CHECK                                    2  ~13     !1
         24        BOOL_NOT                                         ~14     ~13
         25        BOOL                                             ~12     ~14
         26    > > JMPZ_EX                                          ~12     ~12, ->34
         27    >   INIT_STATIC_METHOD_CALL                                  'Cache', 'has'
         28        CONCAT                                           ~15     'collivery.towns.', !0
         29        CONCAT                                           ~16     ~15, '.'
         30        CONCAT                                           ~17     ~16, !1
         31        SEND_VAL                                                 ~17
         32        DO_FCALL                                      0  $18     
         33        BOOL                                             ~12     $18
         34    > > JMPZ                                                     ~12, ->43
  162    35    >   INIT_STATIC_METHOD_CALL                                  'Cache', 'get'
         36        CONCAT                                           ~19     'collivery.towns.', !0
         37        CONCAT                                           ~20     ~19, '.'
         38        CONCAT                                           ~21     ~20, !1
         39        SEND_VAL                                                 ~21
         40        DO_FCALL                                      0  $22     
         41      > RETURN                                                   $22
         42*       JMP                                                      ->105
  165    43    >   INIT_METHOD_CALL                                         'client'
         44        DO_FCALL                                      0  $23     
         45        INIT_METHOD_CALL                                         $23, 'get_towns'
         46        CHECK_FUNC_ARG                                           
         47        FETCH_OBJ_FUNC_ARG                               $24     'token'
         48        SEND_FUNC_ARG                                            $24
         49        SEND_VAR_EX                                              !0
         50        SEND_VAR_EX                                              !1
         51        DO_FCALL                                      0  $25     
         52        ASSIGN                                                   !2, $25
         53      > JMP                                                      ->59
  166    54  E > > CATCH                                       last         'SoapFault'
  167    55    >   INIT_METHOD_CALL                                         'catchSoapFault'
         56        SEND_VAR_EX                                              !3
         57        DO_FCALL                                      0          
  168    58      > RETURN                                                   <false>
  171    59    >   ISSET_ISEMPTY_DIM_OBJ                         0          !2, 'towns'
         60      > JMPZ                                                     ~28, ->89
  172    61    >   TYPE_CHECK                                    2          !1
         62      > JMPZ                                                     ~29, ->74
  173    63    >   FETCH_OBJ_R                                      ~30     'check_cache'
         64        IS_NOT_EQUAL                                             ~30, 0
         65      > JMPZ                                                     ~31, ->73
         66    >   INIT_STATIC_METHOD_CALL                                  'Cache', 'put'
         67        CONCAT                                           ~32     'collivery.towns.', !0
         68        SEND_VAL                                                 ~32
         69        FETCH_DIM_R                                      ~33     !2, 'towns'
         70        SEND_VAL                                                 ~33
         71        SEND_VAL                                                 1440
         72        DO_FCALL                                      0          
         73    > > JMP                                                      ->86
  175    74    >   FETCH_OBJ_R                                      ~35     'check_cache'
         75        IS_NOT_EQUAL                                             ~35, 0
         76      > JMPZ                                                     ~36, ->86
         77    >   INIT_STATIC_METHOD_CALL                                  'Cache', 'put'
         78        CONCAT                                           ~37     'collivery.towns.', !0
         79        CONCAT                                           ~38     ~37, '.'
         80        CONCAT                                           ~39     ~38, !1
         81        SEND_VAL                                                 ~39
         82        FETCH_DIM_R                                      ~40     !2, 'towns'
         83        SEND_VAL                                                 ~40
         84        SEND_VAL                                                 1440
         85        DO_FCALL                                      0          
  177    86    >   FETCH_DIM_R                                      ~42     !2, 'towns'
         87      > RETURN                                                   ~42
         88*       JMP                                                      ->105
  179    89    >   ISSET_ISEMPTY_DIM_OBJ                         0          !2, 'error_id'
         90      > JMPZ                                                     ~43, ->100
  180    91    >   INIT_METHOD_CALL                                         'setError'
         92        CHECK_FUNC_ARG                                           
         93        FETCH_DIM_FUNC_ARG                               $44     !2, 'error_id'
         94        SEND_FUNC_ARG                                            $44
         95        CHECK_FUNC_ARG                                           
         96        FETCH_DIM_FUNC_ARG                               $45     !2, 'error'
         97        SEND_FUNC_ARG                                            $45
         98        DO_FCALL              

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
254.66 ms | 1428 KiB | 18 Q