3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* * class.MarsImportToSsi.php * * CreatedBy: dbuchanan@cotterweb.net * CreatedOn: 4/3/15 * * Requires: _classes/class.MarsLogger.php * * Handles: * 1. sending members to SSI via import web service * 2. maintains/updates db tables ssi_member_list and ssi_member_list_prev * 3. Retrieve SSI demographics (called features) * 4. Pulls ssi and cw question/answer matches from id.survey_partner_xref * */ require_once '_classes/class.MarsLogger.php'; require_once '_classes/class.DbConnectionETL.php'; /* ------------------------------------------------------------- */ /* * Child class with SSI specific id */ /* ------------------------------------------------------------- */ class SSI extends MarketResearch_logger { private $partner_id = 10; //Dev might be different then prod, could be different between SE and IBD as well function __construct($name,$debug,$env,$site,$type) { $this->setDebug($debug); $this->initLog($name); $this->env = $env; $this->site = $site; $this->type = $type; } public function getType() { return $this->type; } public function getPartnerID() { return $this->partner_id; } } /* ------------------------------------------------------------- */ /* * For talking to SSI's import api, requires instance of SSI passed in */ /* ------------------------------------------------------------- */ ///This function is used one time to pull out unique IDS, required to be this way because of quirky 5.2 bug with array_map ///PHP 5.2 doesn't like anonymous functions function tmp_get_ids($element){ return $element['respondentID']; } class SSI_api { private $ibd_source_id = '694_1264'; private $se_source_id = '694_1266'; private $batch = 100; //number of members to send in a bulk validate/submit batch private $timeout = 1500; private $qa_url = 'https://qaproxy.surveysampling.com/partner/saas/importsvc/'; // qa private $prod_url = 'https://dkr1.ssisurveys.com/partner/saas/importsvc/'; private $base_url; private $url_context; private $ob; private $country = 'US'; private $language = 'en'; private $username = 'vnd_inboxdollars'; private $password = 'pRv\'cX2*'; private $context; function __construct(SSI $ssi) { $this->ssi = $ssi; $this->base_url = ($ssi->getEnv()=='live') ? $this->prod_url : $this->qa_url; } private function createContext($ob,$type) { $credentials = "$this->username:$this->password"; $content_type = "Content-Type: application/json"; $creds = "Authorization: Basic ". base64_encode("$credentials"); $opts = array( 'http'=> array( 'method'=>$type, 'header'=>array($content_type,$creds), 'timeout'=> $this->timeout ) ); if(isset($ob)) { $opts['http']['content']=$ob; $this->ob=$ob; } else { $this->ob=''; } ////$this->ssi->logComment("Options to send: ".$ob); $this->context = stream_context_create($opts); } private function makeRequest($url) { $this->ssi->logComment("Post request ".$url); try { $result = file_get_contents($url,false,$this->context); } catch (Exception $e) { $this->ssi->logComment($e); $this->ssi->sendEmailAlert($e); } if($result===false) { $this->ssi->logComment("Request failed for $url"); $this->ssi->sendEmailAlert("Request failed for $url"); $this->ssi->addFinishComment("Failed...$url..".$this->ob); } return $result; } private function getKey() { if($this->ssi->getSite()=='inboxdollars') return $this->ibd_source_id; else if($this->ssi->getSite()=='sendearnings') return $this->se_source_id; else { $this->ssi->logComment("No api key for this, ".$this->getEnv()); $this->ssi->sendEmailAlert("No api key for this, ".$this->getEnv()); die; } } public function getBatchCount() { return $this->batch; } public function getLanguage() { return $this->language; } public function getCountry() { return $this->country; } public function getConfig() { $this->createContext(null,'GET'); return json_decode($this->makeRequest($this->base_url.'config?sourceID='.$this->getKey().'&country='.$this->getCountry().'&language='.$this->getLanguage())); } public function validateBulk($json) { $this->createContext($json,'POST'); return json_decode($this->makeRequest($this->base_url.'validate/bulk'),true); } public function submitBulk($json) { $this->createContext($json,'POST'); return json_decode($this->makeRequest($this->base_url.'submit')); } public function sendBatch($members,$features) { $this->ssi->logComment("Batch...".count($members)); $final=array('sourceId'=>$this->getKey(),'language'=>$this->getLanguage(),'country'=>$this->getCountry(),'features'=>$features,'respondents'=>$members); $json_final = json_encode($final); $validations=$this->validateBulk($json_final); $this->ssi->logComment("Validations has ".count($validations)." errors."); ///IF there are records in validations returned, that means there are problems ///Simply remove those members and log it if(count($validations) !== 0) { $this->ssi->logComment("Validation errors are..."); $this->ssi->logComment(json_encode($validations)); $this->ssi->addFinishComment("Validation errors=".count($validations).".data>>>.".json_encode($validations)); ///Need to remove those who aren't validated and log them $valid_members = array(); $bad_members = array(); ///Pull out just the IDs $invalid_member_ids = array_map("tmp_get_ids", $validations); for($x=0; $x<count($members); $x++) { if(!in_array($members[$x]['respondentID'],$invalid_member_ids)) { array_push($valid_members,$members[$x]); } else { array_push($bad_members,$members[$x]); } } $final['respondents']=$valid_members; $json_final = json_encode($final); } ///Submit members if there are some if(count($final['respondents'])>0) { $this->ssi->logComment("Submitting ".count($final['respondents'])." members to SSI."); $submissions=$this->submitBulk($json_final); $this->ssi->logComment("Submitted has ".count($submissions)." errors."); $this->ssi->logComment(json_encode($submissions)); $this->ssi->addFinishComment("Submission errors for.batch=".count($members).".data>>>.".json_encode($submissions)); //return (count($submissions)===0) ? true : false; return count($submissions); } else { $this->ssi->logComment("No members to submit! Could be bad?"); return false; } } } /* ------------------------------------------------------------- */ /* * SSI specific db calls for ssi_member_list and ssi_member_list_prev * @param instance of SSI * @extends CW_db (class.DBConnectionETL.php) */ /* ------------------------------------------------------------- */ class SSI_db extends CW_db { function __construct(SSI $ssi) { $this->ssi=$ssi; ///Init database connections to Slave and ETL $this->init($ssi->getSite(),$ssi->getEnv()); $this->connectToSlave(); $this->ssi->logComment("Connecting to ".$this->ssi->getEnv()." SLAVE >>> ".$this->db_host); $this->connectToEtl(); $this->ssi->logComment("Connecting to ".$this->ssi->getEnv()." ETL >>> ".$this->db_host); } public function checkMemberPartnerIntegration() { $sql = "SELECT COUNT(*) FROM `{$this->etl_db}`.`member_partner_integration`"; $result = mysql_query($sql, $this->etl_con) or die($this->ssi->logComment(mysql_error())); if ( $row = mysql_fetch_array($result, MYSQL_NUM) ) { if ( (int)$row[0] == 0 ) { $this->ssi->logComment( "member_partner_integration table is empty ... exiting!"); $this->ssi->endLog('Finished: '); $this->ssi->sendEmailAlert(" Problem Alert:\n The member_partner_integration table was found empty during the daily SSI partner update.\n\n Update operation was aborted.\n\n EOD;"); return false; } } return true; } public function insertEmailPartner($name,$address_domain,$type) { $sql = "INSERT INTO `{$this->slv_db}`.`email_partner` (partner_name,email_address_domain,partner_type) VALUES ('$name','$address_domain','$type')"; $result = mysql_query($sql, $this->slv_con) or die($this->ssi->logComment(mysql_error())); } public function dropMemberListPrev() { $sql = "DROP TABLE IF EXISTS `{$this->etl_db}`.`ssi_member_list_prev`"; $result = mysql_query($sql, $this->etl_con) or die($this->ssi->logComment(mysql_error())); $this->ssi->logComment("Successfully dropped {$this->etl_db}.ssi_member_list_prev"); return true; } /* BELOW USED FOR TESTING PUPOSES public function copyFromCintPrevToSSIPrev() { $sql = "CREATE TABLE IF NOT EXISTS `{$this->etl_db}`.`ssi_member_list_prev` ( `member_id` INT(11) NOT NULL UNIQUE DEFAULT '0', `member_code` INT(11) NOT NULL DEFAULT '0', PRIMARY KEY (`member_id`)) ENGINE=MyISAM SELECT * FROM `{$this->etl_db}`.`cint_member_list_prev`"; $result = mysql_query($sql, $this->etl_con) or die($this->ssi->logComment(mysql_error())); $this->ssi->logComment("Successfully copied new {$this->etl_db}.ssi_member_list_prev from {$this->etl_db}.cint_member_list_prev"); return true; } */ public function createMemberListPrev() { $sql = "RENAME TABLE `{$this->etl_db}`.`ssi_member_list` TO `{$this->etl_db}`.`ssi_member_list_prev`"; $result = mysql_query($sql, $this->etl_con) or die($this->ssi->logComment(mysql_error())); $this->ssi->logComment("Successfully renamed {$this->etl_db}.ssi_member_list to {$this->etl_db}.ssi_member_list_prev"); return true; } public function populateMemberList() { $sql = "CREATE TABLE IF NOT EXISTS `{$this->etl_db}`.`ssi_member_list` ( `member_id` INT(11) NOT NULL UNIQUE DEFAULT '0', `member_code` INT(11) NOT NULL DEFAULT '0', PRIMARY KEY (`member_id`)) ENGINE=MyISAM SELECT * FROM `{$this->etl_db}`.`member_partner_integration`"; $result = mysql_query($sql, $this->etl_con) or die($this->ssi->logComment(mysql_error())); $this->ssi->logComment("Successfully created new {$this->etl_db}.ssi_member_list from {$this->etl_db}.member_partner_integration"); } private function getMemberListPrevCount() { $sql_prev = "SELECT COUNT(*) FROM `{$this->etl_db}`.`ssi_member_list_prev`"; $result_prev = mysql_query($sql_prev, $this->etl_con) or die($this->ssi->logComment(mysql_error())); $row = mysql_fetch_array($result_prev, MYSQL_NUM); return (int)$row[0]; } private function getMemberListCount() { $sql = "SELECT COUNT(*) FROM `{$this->etl_db}`.`ssi_member_list`"; $result = mysql_query($sql, $this->etl_con) or die($this->ssi->logComment(mysql_error())); $row = mysql_fetch_array($result, MYSQL_NUM); return (int)$row[0]; } public function compareMemberListCounts() { $prev_count = $this->getMemberListPrevCount(); $new_count = $this->getMemberListCount(); if ( $prev_count == $new_count ) { $this->ssi->logComment("ssi_member_list_prev and ssi_member_list appear identical ... exiting!"); $this->ssi->endLog('Finished: '); $this->ssi->sendEmailAlert("Problem Alert:\n\n ssi_member_list_prev and ssi_member_list appear identical during the daily SSI partner update.\n\n Update operation was aborted."); return false; } return true; } // Run this DELETE query for SE only. // This removes any SE member having a duplicate email address with a member in IBD. public function deleteDuplicateSEMembers() { $sql = "DELETE FROM `{$this->etl_db}`.`ssi_member_list` WHERE member_id IN ( SELECT se_ms.member_id FROM `sendearnings`.`member_status` se_ms, `id`.`member_status` id_ms WHERE se_ms.email = id_ms.email )"; $this->ssi->logComment($sql); $result = mysql_query($sql, $this->etl_con) or die($this->ssi->logComment(mysql_error())); $this->ssi->logComment("Successfully removed duplicate emails from SSI_MEMBER_LIST for SE."); } public function getMembersToRemove() { // Which members need to be deleted in SSI's DB? $sql = "SELECT member_id, member_code FROM `{$this->etl_db}`.`ssi_member_list_prev` WHERE member_id NOT IN (SELECT member_id FROM `{$this->etl_db}`.`ssi_member_list`)"; $result = mysql_query($sql, $this->etl_con) or die($this->ssi->logComment(mysql_error())); return $result; } public function getQuestionFromSurveyPartnerXref() { $sql = "SELECT DISTINCT survey_partner_question_desc FROM `{$this->slv_db}`.`survey_partner_xref` WHERE survey_partner_id = {$this->ssi->getPartnerID()} ORDER BY survey_partner_question_desc"; $result = mysql_query($sql, $this->etl_con) or die($this->ssi->logComment(mysql_error())); return $result; } public function getSurveyMembers($features, $only_new=true) { $sql = "SELECT DISTINCT member_code as respondentID, left(trim(ms.zip),5) AS postalcode, (SELECT month(dd.date_key) FROM $this->slv_db.survey_results_dob srdob, $this->slv_db.date_dim dd WHERE dd.julian = srdob.plain_value AND srdob.member_id = sml.member_id) AS monthdob ,(SELECT day(dd.date_key) FROM $this->slv_db.survey_results_dob srdob, $this->slv_db.date_dim dd WHERE dd.julian = srdob.plain_value AND srdob.member_id = sml.member_id) AS daydob ,(SELECT year(dd.date_key) FROM $this->slv_db.survey_results_dob srdob, $this->slv_db.date_dim dd WHERE dd.julian = srdob.plain_value AND srdob.member_id = sml.member_id) AS yeardob "; ///Loop and append select for each feature passed in foreach($features as $feature) { $sql .= ",(SELECT GROUP_CONCAT(DISTINCT survey_partner_answer_id) FROM $this->slv_db.survey_results sr, $this->slv_db.survey_partner_xref spx, $this->slv_db.survey_answers sa WHERE sr.member_id=ms.member_id AND spx.survey_partner_question_desc = '$feature' AND survey_partner_id = {$this->ssi->getPartnerID()} AND sr.survey_question_id=spx.survey_question_id AND sr.survey_answer_id=spx.survey_answer_id) as $feature"; } $sql .=" FROM $this->etl_db.ssi_member_list sml JOIN $this->slv_db.member_status ms ON sml.member_id = ms.member_id "; if($only_new===true) { $sql .=" WHERE sml.member_id NOT IN (SELECT member_id FROM `{$this->etl_db}`.`ssi_member_list_prev`)"; } ///For debugging //$sql.=" limit 20"; ////$this->ssi->logComment($sql); $result = mysql_query($sql, $this->etl_con) or die($this->ssi->logComment(mysql_error())); return $result; } public function getMemberFeatures($id) { $sql = "SELECT DISTINCT sa.answer,survey_partner_question_desc, survey_partner_answer_id,survey_partner_answer_desc FROM $this->slv_db.survey_results sr, $this->slv_db.survey_partner_xref spx, $this->slv_db.survey_answers sa WHERE sr.member_id=$id AND survey_partner_id = {$this->ssi->getPartnerID()} AND sr.survey_question_id=spx.survey_question_id AND sr.survey_answer_id=spx.survey_answer_id AND sr.survey_answer_id=sa.id ORDER BY survey_partner_question_desc"; $result = mysql_query($sql, $this->etl_con) or die($this->ssi->logComment(mysql_error())); return $result; } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/72KOL
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   INCLUDE_OR_EVAL                                          '_classes%2Fclass.MarsLogger.php', REQUIRE_ONCE
   19     1        INCLUDE_OR_EVAL                                          '_classes%2Fclass.DbConnectionETL.php', REQUIRE_ONCE
   26     2        DECLARE_CLASS                                            'ssi', 'marketresearch_logger'
  197     3        DECLARE_CLASS                                            'ssi_db', 'cw_db'
  359     4      > RETURN                                                   1

Function tmp_get_ids:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/72KOL
function name:  tmp_get_ids
number of ops:  4
compiled vars:  !0 = $element
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   49     0  E >   RECV                                             !0      
   50     1        FETCH_DIM_R                                      ~1      !0, 'respondentID'
          2      > RETURN                                                   ~1
   51     3*     > RETURN                                                   null

End of function tmp_get_ids

Class SSI:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/72KOL
function name:  __construct
number of ops:  18
compiled vars:  !0 = $name, !1 = $debug, !2 = $env, !3 = $site, !4 = $type
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
          4        RECV                                             !4      
   29     5        INIT_METHOD_CALL                                         'setDebug'
          6        SEND_VAR_EX                                              !1
          7        DO_FCALL                                      0          
   30     8        INIT_METHOD_CALL                                         'initLog'
          9        SEND_VAR_EX                                              !0
         10        DO_FCALL                                      0          
   31    11        ASSIGN_OBJ                                               'env'
         12        OP_DATA                                                  !2
   32    13        ASSIGN_OBJ                                               'site'
         14        OP_DATA                                                  !3
   33    15        ASSIGN_OBJ                                               'type'
         16        OP_DATA                                                  !4
   34    17      > RETURN                                                   null

End of function __construct

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

End of function gettype

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

End of function getpartnerid

End of class SSI.

Class SSI_api:
Function __construct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 10
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/72KOL
function name:  __construct
number of ops:  15
compiled vars:  !0 = $ssi
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   69     0  E >   RECV                                             !0      
   70     1        ASSIGN_OBJ                                               'ssi'
          2        OP_DATA                                                  !0
   71     3        INIT_METHOD_CALL                                         !0, 'getEnv'
          4        DO_FCALL                                      0  $3      
          5        IS_EQUAL                                                 $3, 'live'
          6      > JMPZ                                                     ~4, ->10
          7    >   FETCH_OBJ_R                                      ~5      'prod_url'
          8        QM_ASSIGN                                        ~6      ~5
          9      > JMP                                                      ->12
         10    >   FETCH_OBJ_R                                      ~7      'qa_url'
         11        QM_ASSIGN                                        ~6      ~7
         12    >   ASSIGN_OBJ                                               'base_url'
         13        OP_DATA                                                  ~6
   72    14      > RETURN                                                   null

End of function __construct

Function createcontext:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 31
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 33
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/72KOL
function name:  createContext
number of ops:  39
compiled vars:  !0 = $ob, !1 = $type, !2 = $credentials, !3 = $content_type, !4 = $creds, !5 = $opts
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   73     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   74     2        FETCH_OBJ_R                                      ~6      'username'
          3        ROPE_INIT                                     3  ~9      ~6
          4        ROPE_ADD                                      1  ~9      ~9, '%3A'
          5        FETCH_OBJ_R                                      ~7      'password'
          6        ROPE_END                                      2  ~8      ~9, ~7
          7        ASSIGN                                                   !2, ~8
   75     8        ASSIGN                                                   !3, 'Content-Type%3A+application%2Fjson'
   76     9        INIT_FCALL                                               'base64_encode'
         10        CAST                                          6  ~13     !2
         11        SEND_VAL                                                 ~13
         12        DO_ICALL                                         $14     
         13        CONCAT                                           ~15     'Authorization%3A+Basic+', $14
         14        ASSIGN                                                   !4, ~15
   79    15        INIT_ARRAY                                       ~17     !1, 'method'
   80    16        INIT_ARRAY                                       ~18     !3
         17        ADD_ARRAY_ELEMENT                                ~18     !4
         18        ADD_ARRAY_ELEMENT                                ~17     ~18, 'header'
   81    19        FETCH_OBJ_R                                      ~19     'timeout'
         20        ADD_ARRAY_ELEMENT                                ~17     ~19, 'timeout'
         21        INIT_ARRAY                                       ~20     ~17, 'http'
   77    22        ASSIGN                                                   !5, ~20
   84    23        ISSET_ISEMPTY_CV                                         !0
         24      > JMPZ                                                     ~22, ->31
   85    25    >   FETCH_DIM_W                                      $23     !5, 'http'
         26        ASSIGN_DIM                                               $23, 'content'
         27        OP_DATA                                                  !0
   86    28        ASSIGN_OBJ                                               'ob'
         29        OP_DATA                                                  !0
         30      > JMP                                                      ->33
   89    31    >   ASSIGN_OBJ                                               'ob'
         32        OP_DATA                                                  ''
   92    33    >   INIT_FCALL                                               'stream_context_create'
         34        SEND_VAR                                                 !5
         35        DO_ICALL                                         $28     
         36        ASSIGN_OBJ                                               'context'
         37        OP_DATA                                                  $28
   93    38      > RETURN                                                   null

End of function createcontext

Function makerequest:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 46
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 46
Found catch point at position: 14
Branch analysis from position: 14
2 jumps found. (Code = 107) Position 1 = 15, Position 2 = -2
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 46
Branch analysis from position: 25
Branch analysis from position: 46
filename:       /in/72KOL
function name:  makeRequest
number of ops:  48
compiled vars:  !0 = $url, !1 = $result, !2 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   94     0  E >   RECV                                             !0      
   95     1        FETCH_OBJ_R                                      ~3      'ssi'
          2        INIT_METHOD_CALL                                         ~3, 'logComment'
          3        CONCAT                                           ~4      'Post+request+', !0
          4        SEND_VAL_EX                                              ~4
          5        DO_FCALL                                      0          
   97     6        INIT_FCALL                                               'file_get_contents'
          7        SEND_VAR                                                 !0
          8        SEND_VAL                                                 <false>
          9        FETCH_OBJ_R                                      ~6      'context'
         10        SEND_VAL                                                 ~6
         11        DO_ICALL                                         $7      
         12        ASSIGN                                                   !1, $7
         13      > JMP                                                      ->23
   98    14  E > > CATCH                                       last         'Exception'
   99    15    >   FETCH_OBJ_R                                      ~9      'ssi'
         16        INIT_METHOD_CALL                                         ~9, 'logComment'
         17        SEND_VAR_EX                                              !2
         18        DO_FCALL                                      0          
  100    19        FETCH_OBJ_R                                      ~11     'ssi'
         20        INIT_METHOD_CALL                                         ~11, 'sendEmailAlert'
         21        SEND_VAR_EX                                              !2
         22        DO_FCALL                                      0          
  102    23    >   TYPE_CHECK                                    4          !1
         24      > JMPZ                                                     ~13, ->46
  103    25    >   FETCH_OBJ_R                                      ~14     'ssi'
         26        INIT_METHOD_CALL                                         ~14, 'logComment'
         27        NOP                                                      
         28        FAST_CONCAT                                      ~15     'Request+failed+for+', !0
         29        SEND_VAL_EX                                              ~15
         30        DO_FCALL                                      0          
  104    31        FETCH_OBJ_R                                      ~17     'ssi'
         32        INIT_METHOD_CALL                                         ~17, 'sendEmailAlert'
         33        NOP                                                      
         34        FAST_CONCAT                                      ~18     'Request+failed+for+', !0
         35        SEND_VAL_EX                                              ~18
         36        DO_FCALL                                      0          
  105    37        FETCH_OBJ_R                                      ~20     'ssi'
         38        INIT_METHOD_CALL                                         ~20, 'addFinishComment'
         39        ROPE_INIT                                     3  ~22     'Failed...'
         40        ROPE_ADD                                      1  ~22     ~22, !0
         41        ROPE_END                                      2  ~21     ~22, '..'
         42        FETCH_OBJ_R                                      ~24     'ob'
         43        CONCAT                                           ~25     ~21, ~24
         44        SEND_VAL_EX                                              ~25
         45        DO_FCALL                                      0          
  107    46    > > RETURN                                                   !1
  108    47*     > RETURN                                                   null

End of function makerequest

Function getkey:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 16
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 79) Position 1 = -2
filename:       /in/72KOL
function name:  getKey
number of ops:  32
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  110     0  E >   FETCH_OBJ_R                                      ~0      'ssi'
          1        INIT_METHOD_CALL                                         ~0, 'getSite'
          2        DO_FCALL                                      0  $1      
          3        IS_EQUAL                                                 $1, 'inboxdollars'
          4      > JMPZ                                                     ~2, ->8
  111     5    >   FETCH_OBJ_R                                      ~3      'ibd_source_id'
          6      > RETURN                                                   ~3
          7*       JMP                                                      ->31
  112     8    >   FETCH_OBJ_R                                      ~4      'ssi'
          9        INIT_METHOD_CALL                                         ~4, 'getSite'
         10        DO_FCALL                                      0  $5      
         11        IS_EQUAL                                                 $5, 'sendearnings'
         12      > JMPZ                                                     ~6, ->16
  113    13    >   FETCH_OBJ_R                                      ~7      'se_source_id'
         14      > RETURN                                                   ~7
         15*       JMP                                                      ->31
  115    16    >   FETCH_OBJ_R                                      ~8      'ssi'
         17        INIT_METHOD_CALL                                         ~8, 'logComment'
         18        INIT_METHOD_CALL                                         'getEnv'
         19        DO_FCALL                                      0  $9      
         20        CONCAT                                           ~10     'No+api+key+for+this%2C+', $9
         21        SEND_VAL_EX                                              ~10
         22        DO_FCALL                                      0          
  116    23        FETCH_OBJ_R                                      ~12     'ssi'
         24        INIT_METHOD_CALL                                         ~12, 'sendEmailAlert'
         25        INIT_METHOD_CALL                                         'getEnv'
         26        DO_FCALL                                      0  $13     
         27        CONCAT                                           ~14     'No+api+key+for+this%2C+', $13
         28        SEND_VAL_EX                                              ~14
         29        DO_FCALL                                      0          
  117    30      > EXIT                                                     
  119    31*     > RETURN                                                   null

End of function getkey

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

End of function getbatchcount

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

End of function getlanguage

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

End of function getcountry

Function getconfig:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/72KOL
function name:  getConfig
number of ops:  25
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  130     0  E >   INIT_METHOD_CALL                                         'createContext'
          1        SEND_VAL                                                 null
          2        SEND_VAL                                                 'GET'
          3        DO_FCALL                                      0          
  131     4        INIT_FCALL                                               'json_decode'
          5        INIT_METHOD_CALL                                         'makeRequest'
          6        FETCH_OBJ_R                                      ~1      'base_url'
          7        CONCAT                                           ~2      ~1, 'config%3FsourceID%3D'
          8        INIT_METHOD_CALL                                         'getKey'
          9        DO_FCALL                                      0  $3      
         10        CONCAT                                           ~4      ~2, $3
         11        CONCAT                                           ~5      ~4, '%26country%3D'
         12        INIT_METHOD_CALL                                         'getCountry'
         13        DO_FCALL                                      0  $6      
         14        CONCAT                                           ~7      ~5, $6
         15        CONCAT                                           ~8      ~7, '%26language%3D'
         16        INIT_METHOD_CALL                                         'getLanguage'
         17        DO_FCALL                                      0  $9      
         18        CONCAT                                           ~10     ~8, $9
         19        SEND_VAL                                                 ~10
         20        DO_FCALL                                      0  $11     
         21        SEND_VAR                                                 $11
         22        DO_ICALL                                         $12     
         23      > RETURN                                                   $12
  132    24*     > RETURN                                                   null

End of function getconfig

Function validatebulk:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/72KOL
function name:  validateBulk
number of ops:  16
compiled vars:  !0 = $json
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  133     0  E >   RECV                                             !0      
  134     1        INIT_METHOD_CALL                                         'createContext'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 'POST'
          4        DO_FCALL                                      0          
  135     5        INIT_FCALL                                               'json_decode'
          6        INIT_METHOD_CALL                                         'makeRequest'
          7        FETCH_OBJ_R                                      ~2      'base_url'
          8        CONCAT                                           ~3      ~2, 'validate%2Fbulk'
          9        SEND_VAL                                                 ~3
         10        DO_FCALL                                      0  $4      
         11        SEND_VAR                                                 $4
         12        SEND_VAL                                                 <true>
         13        DO_ICALL                                         $5      
         14      > RETURN                                                   $5
  136    15*     > RETURN                                                   null

End of function validatebulk

Function submitbulk:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/72KOL
function name:  submitBulk
number of ops:  15
compiled vars:  !0 = $json
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  137     0  E >   RECV                                             !0      
  138     1        INIT_METHOD_CALL                                         'createContext'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 'POST'
          4        DO_FCALL                                      0          
  139     5        INIT_FCALL                                               'json_decode'
          6        INIT_METHOD_CALL                                         'makeRequest'
          7        FETCH_OBJ_R                                      ~2      'base_url'
          8        CONCAT                                           ~3      ~2, 'submit'
          9        SEND_VAL                                                 ~3
         10        DO_FCALL                                      0  $4      
         11        SEND_VAR                                                 $4
         12        DO_ICALL                                         $5      
         13      > RETURN                                                   $5
  140    14*     > RETURN                                                   null

End of function submitbulk

Function sendbatch:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 38, Position 2 = 98
Branch analysis from position: 38
1 jumps found. (Code = 42) Position 1 = 89
Branch analysis from position: 89
2 jumps found. (Code = 44) Position 1 = 92, Position 2 = 69
Branch analysis from position: 92
2 jumps found. (Code = 43) Position 1 = 102, Position 2 = 142
Branch analysis from position: 102
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 142
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 69
2 jumps found. (Code = 43) Position 1 = 77, Position 2 = 83
Branch analysis from position: 77
1 jumps found. (Code = 42) Position 1 = 88
Branch analysis from position: 88
2 jumps found. (Code = 44) Position 1 = 92, Position 2 = 69
Branch analysis from position: 92
Branch analysis from position: 69
Branch analysis from position: 83
2 jumps found. (Code = 44) Position 1 = 92, Position 2 = 69
Branch analysis from position: 92
Branch analysis from position: 69
Branch analysis from position: 98
filename:       /in/72KOL
function name:  sendBatch
number of ops:  148
compiled vars:  !0 = $members, !1 = $features, !2 = $final, !3 = $json_final, !4 = $validations, !5 = $valid_members, !6 = $bad_members, !7 = $invalid_member_ids, !8 = $x, !9 = $submissions
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  141     0  E >   RECV                                             !0      
          1        RECV                                             !1      
  142     2        FETCH_OBJ_R                                      ~10     'ssi'
          3        INIT_METHOD_CALL                                         ~10, 'logComment'
          4        COUNT                                            ~11     !0
          5        CONCAT                                           ~12     'Batch...', ~11
          6        SEND_VAL_EX                                              ~12
          7        DO_FCALL                                      0          
  144     8        INIT_METHOD_CALL                                         'getKey'
          9        DO_FCALL                                      0  $14     
         10        INIT_ARRAY                                       ~15     $14, 'sourceId'
         11        INIT_METHOD_CALL                                         'getLanguage'
         12        DO_FCALL                                      0  $16     
         13        ADD_ARRAY_ELEMENT                                ~15     $16, 'language'
         14        INIT_METHOD_CALL                                         'getCountry'
         15        DO_FCALL                                      0  $17     
         16        ADD_ARRAY_ELEMENT                                ~15     $17, 'country'
         17        ADD_ARRAY_ELEMENT                                ~15     !1, 'features'
         18        ADD_ARRAY_ELEMENT                                ~15     !0, 'respondents'
         19        ASSIGN                                                   !2, ~15
  146    20        INIT_FCALL                                               'json_encode'
         21        SEND_VAR                                                 !2
         22        DO_ICALL                                         $19     
         23        ASSIGN                                                   !3, $19
  147    24        INIT_METHOD_CALL                                         'validateBulk'
         25        SEND_VAR_EX                                              !3
         26        DO_FCALL                                      0  $21     
         27        ASSIGN                                                   !4, $21
  148    28        FETCH_OBJ_R                                      ~23     'ssi'
         29        INIT_METHOD_CALL                                         ~23, 'logComment'
         30        COUNT                                            ~24     !4
         31        CONCAT                                           ~25     'Validations+has+', ~24
         32        CONCAT                                           ~26     ~25, '+errors.'
         33        SEND_VAL_EX                                              ~26
         34        DO_FCALL                                      0          
  152    35        COUNT                                            ~28     !4
         36        IS_NOT_IDENTICAL                                         ~28, 0
         37      > JMPZ                                                     ~29, ->98
  153    38    >   FETCH_OBJ_R                                      ~30     'ssi'
         39        INIT_METHOD_CALL                                         ~30, 'logComment'
         40        SEND_VAL_EX                                              'Validation+errors+are...'
         41        DO_FCALL                                      0          
  154    42        FETCH_OBJ_R                                      ~32     'ssi'
         43        INIT_METHOD_CALL                                         ~32, 'logComment'
         44        INIT_FCALL                                               'json_encode'
         45        SEND_VAR                                                 !4
         46        DO_ICALL                                         $33     
         47        SEND_VAR_NO_REF_EX                                       $33
         48        DO_FCALL                   

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.13 ms | 1428 KiB | 23 Q