custom/plugins/TanmarNgGoogleAdsTracking/src/Components/GoogleAdsData.php line 9

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace Tanmar\GoogleAdsTracking\Components;
  4. use Shopware\Core\Framework\Struct\Struct;
  5. class GoogleAdsData extends Struct {
  6.     protected bool $active;
  7.     protected bool $retargetingActive;
  8.     protected string $conversionId;
  9.     protected string $conversionLabel;
  10.     protected string $eventName;
  11.     protected array $eventData;
  12.     public function __construct() {
  13.         $this->active false;
  14.         $this->retargetingActive false;
  15.         $this->conversionId '';
  16.         $this->conversionLabel '';
  17.         $this->eventName '';
  18.         $this->eventData = array();
  19.     }
  20.     public function getActive(): bool {
  21.         return $this->active;
  22.     }
  23.     public function getRetargetingActive(): bool {
  24.         return $this->retargetingActive;
  25.     }
  26.     public function getConversionId(): string {
  27.         return $this->checkConversionId($this->conversionId);
  28.     }
  29.     public function getConversionLabel(): string {
  30.         return $this->conversionLabel;
  31.     }
  32.     public function getEventName(): string {
  33.         return $this->eventName;
  34.     }
  35.     public function getEventData(): array {
  36.         return $this->eventData;
  37.     }
  38.     /**
  39.      * 
  40.      * @param string $conversionId
  41.      * @return string
  42.      */
  43.     private function checkConversionId(string $conversionId): string {
  44.         $conversionId preg_replace('#[^0-9]#'''$conversionId);
  45.         $conversionId = ($conversionId != '') ? ('AW-' $conversionId) : $conversionId;
  46.         return $conversionId;
  47.     }
  48. }