public function parseSourceCampaignSettings()
    {
        if (isset($this->campaignSettingsParsed[$this->campaignId])) {
            // Campaign settings have already been parsed for this campaign/session, likely due to a batch import.
            return;
        }

        // Check that the campaign is in the whitelist for this source.
        $campaignSettings = $this->campaignSettingsModel->setContactSource($this->contactSource)
            ->getCampaignSettingsById($this->campaignId);

        // @todo - Support or thwart multiple copies of the same campaign, should it occur. In the meantime...
        $campaignSettings = reset($campaignSettings);
        if (
            !$campaignSettings
            && !$this->imported
            && !$this->contactSource->getInternal()
        ) {
            throw new ContactSourceException(
                'The campaignId supplied is not currently in the permitted list of campaigns for this source.',
                Codes::HTTP_GONE,
                null,
                Stat::TYPE_INVALID,
                'campaignId'
            );
        }
        // Establish parameters from campaign settings; skip some settings on contact import from file.
        if (!$this->imported) {
            // Establish defaults (especially for allCampaigns).
            $this->realTime  = isset($campaignSettings->realTime) ? boolval($campaignSettings->realTime) : true;
            $this->limits    = isset($campaignSettings->limits) ? $campaignSettings->limits : [];
            $this->scrubRate = isset($campaignSettings->scrubRate) ? intval($campaignSettings->scrubRate) : 0;
        }
        $this->cost      = isset($campaignSettings->cost) ? (abs(floatval($campaignSettings->cost))) : 0;
        $this->utmSource = !empty($this->contactSource->getUtmSource()) ? $this->contactSource->getUtmSource() : '';

        // Apply field overrides.
        if ($this->utmSource) {
            $this->fieldsProvided['utm_source'] = $this->utmSource;
        }
        $this->addTrace('contactSourceRealTime', $this->realTime);
        $this->addTrace('contactSourceCost', $this->cost);
        $this->addTrace('contactSourceUtmSource', $this->utmSource);

        $this->campaignSettingsParsed[$this->campaignId] = true;
    }
public function parseSourceCampaignSettings()
    {
        if (isset($this->campaignSettingsParsed[$this->campaignId])) {
            // Campaign settings have already been parsed for this campaign/session, likely due to a batch import.
            return;
        }

        // Check that the campaign is in the whitelist for this source.
        $campaignSettings = $this->campaignSettingsModel->setContactSource($this->contactSource)
            ->getCampaignSettingsById($this->campaignId);

        // @todo - Support or thwart multiple copies of the same campaign, should it occur. In the meantime...
        $campaignSettings = reset($campaignSettings);
        if (
            !$campaignSettings
            && !$this->imported
            && !$this->contactSource->getInternal()
        ) {
            throw new ContactSourceException(
                'The campaignId supplied is not currently in the permitted list of campaigns for this source.',
                Codes::HTTP_GONE,
                null,
                Stat::TYPE_INVALID,
                'campaignId'
            );
        }
        // Establish parameters from campaign settings; skip some settings on contact import from file.
        if (!$this->imported) {
            // Establish defaults (especially for allCampaigns).
            $this->realTime  = isset($campaignSettings->realTime) ? boolval($campaignSettings->realTime) : true;
            $this->limits    = isset($campaignSettings->limits) ? $campaignSettings->limits : [];
            $this->scrubRate = isset($campaignSettings->scrubRate) ? intval($campaignSettings->scrubRate) : 0;
        }
        $this->cost      = isset($campaignSettings->cost) ? (abs(floatval($campaignSettings->cost))) : 0;
        $this->utmSource = !empty($this->contactSource->getUtmSource()) ? $this->contactSource->getUtmSource() : '';

        // Apply field overrides.
        if ($this->utmSource) {
            $this->fieldsProvided['utm_source'] = $this->utmSource;
        }
        $this->addTrace('contactSourceRealTime', $this->realTime);
        $this->addTrace('contactSourceCost', $this->cost);
        $this->addTrace('contactSourceUtmSource', $this->utmSource);

        $this->campaignSettingsParsed[$this->campaignId] = true;
    }
public function parseSourceCampaignSettings ( ) { if ( isset ( $ this -> campaignSettingsParsed [ $ this -> campaignId ] ) ) { // Campaign settings have already been parsed for this campaign/session, likely due to a batch import. return ; } // Check that the campaign is in the whitelist for this source. $ campaignSettings = $ this -> campaignSettingsModel -> setContactSource ( $ this -> contactSource ) -> getCampaignSettingsById ( $ this -> campaignId ) ; // @todo - Support or thwart multiple copies of the same campaign, should it occur. In the meantime... $ campaignSettings = reset ( $ campaignSettings ) ; if ( ! $ campaignSettings && ! $ this -> imported && ! $ this -> contactSource -> getInternal ( ) ) { throw new ContactSourceException ( 'The campaignId supplied is not currently in the permitted list of campaigns for this source.' , Codes :: HTTP_GONE , null , Stat :: TYPE_INVALID , 'campaignId' ) ; } // Establish parameters from campaign settings; skip some settings on contact import from file. if ( ! $ this -> imported ) { // Establish defaults (especially for allCampaigns). $ this -> realTime = isset ( $ campaignSettings -> realTime ) ? boolval ( $ campaignSettings -> realTime ) : true ; $ this -> limits = isset ( $ campaignSettings -> limits ) ? $ campaignSettings -> limits : [ ] ; $ this -> scrubRate = isset ( $ campaignSettings -> scrubRate ) ? intval ( $ campaignSettings -> scrubRate ) : 0 ; } $ this -> cost = isset ( $ campaignSettings -> cost ) ? ( abs ( floatval ( $ campaignSettings -> cost ) ) ) : 0 ; $ this -> utmSource = ! empty ( $ this -> contactSource -> getUtmSource ( ) ) ? $ this -> contactSource -> getUtmSource ( ) : '' ; // Apply field overrides. if ( $ this -> utmSource ) { $ this -> fieldsProvided [ 'utm_source' ] = $ this -> utmSource ; } $ this -> addTrace ( 'contactSourceRealTime' , $ this -> realTime ) ; $ this -> addTrace ( 'contactSourceCost' , $ this -> cost ) ; $ this -> addTrace ( 'contactSourceUtmSource' , $ this -> utmSource ) ; $ this -> campaignSettingsParsed [ $ this -> campaignId ] = true ; }
Load the settings attached to the Source.

@throws ContactSourceException
@throws \Exception
Load the settings attached to the Source .