src/CallmanagerAXL/Callmanager.php
public function add_object_type_by_assoc($DATA, $TYPE)
    {
        // Get our valid object types
        $TYPES = $this->object_types();
        // Check to see if the one we were passed is valid for this function
        if (!in_array($TYPE, $TYPES)) {
            throw new \Exception("Object type provided {$TYPE} is not supported");
        }

        // Only the FIRST letter in the type needs to be lower case
        // so we cant do $TYPE = strtolower($TYPE);
        $FUNCTION = 'add'.$TYPE;
        $TYPE = lcfirst($TYPE);
        $QUERY = [$TYPE => $DATA];
        //print_r($QUERY);
        $BASETIME = $this->microtimeTicks();
        $RETURN = $this->SOAPCLIENT->$FUNCTION($QUERY);
        $DIFFTIME = $this->microtimeTicks() - $BASETIME;
        $this->log_soap_call($FUNCTION, $DIFFTIME, $QUERY, $RETURN);
        $RETURN = $this->object_to_assoc($RETURN);
        $RETURN = reset($RETURN);

        return $RETURN;
    }
public function add_object_type_by_assoc($DATA, $TYPE)
    {
        // Get our valid object types
        $TYPES = $this->object_types();
        // Check to see if the one we were passed is valid for this function
        if (!in_array($TYPE, $TYPES)) {
            throw new \Exception("Object type provided {$TYPE} is not supported");
        }

        // Only the FIRST letter in the type needs to be lower case
        // so we cant do $TYPE = strtolower($TYPE);
        $FUNCTION = 'add'.$TYPE;
        $TYPE = lcfirst($TYPE);
        $QUERY = [$TYPE => $DATA];
        //print_r($QUERY);
        $BASETIME = $this->microtimeTicks();
        $RETURN = $this->SOAPCLIENT->$FUNCTION($QUERY);
        $DIFFTIME = $this->microtimeTicks() - $BASETIME;
        $this->log_soap_call($FUNCTION, $DIFFTIME, $QUERY, $RETURN);
        $RETURN = $this->object_to_assoc($RETURN);
        $RETURN = reset($RETURN);

        return $RETURN;
    }
This generalized add function expects $DATA to be correct for $TYPE objects