-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(campaigns): split campaigns settings and provide correct setting …
…options list
- Loading branch information
Showing
11 changed files
with
239 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
namespace directapi\services\campaigns\enum; | ||
|
||
use directapi\components\Enum; | ||
|
||
class CpmCampaignSettingsEnum extends Enum | ||
{ | ||
public const ADD_METRICA_TAG = 'ADD_METRICA_TAG'; | ||
public const ADD_OPENSTAT_TAG = 'ADD_OPENSTAT_TAG'; | ||
public const ADD_TO_FAVORITES = 'ADD_TO_FAVORITES'; | ||
public const ENABLE_AREA_OF_INTEREST_TARGETING = 'ENABLE_AREA_OF_INTEREST_TARGETING'; | ||
public const ENABLE_SITE_MONITORING = 'ENABLE_SITE_MONITORING'; | ||
public const REQUIRE_SERVICING = 'REQUIRE_SERVICING'; | ||
public const SHARED_ACCOUNT_ENABLED = 'SHARED_ACCOUNT_ENABLED'; | ||
public const DAILY_BUDGET_ALLOWED = 'DAILY_BUDGET_ALLOWED'; | ||
|
||
/** | ||
* @var array | ||
*/ | ||
private static $getOnly = [ | ||
self::SHARED_ACCOUNT_ENABLED, | ||
self::DAILY_BUDGET_ALLOWED, | ||
]; | ||
|
||
public static function isGetOnly(CpmCampaignSettingsEnum $value): bool | ||
{ | ||
if (in_array((string)$value, self::$getOnly, true)) { | ||
return true; | ||
} | ||
return false; | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
src/services/campaigns/enum/DynamicCampaignSettingsEnum.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
namespace directapi\services\campaigns\enum; | ||
|
||
use directapi\components\Enum; | ||
|
||
class DynamicCampaignSettingsEnum extends Enum | ||
{ | ||
public const ADD_METRICA_TAG = 'ADD_METRICA_TAG'; | ||
public const ADD_OPENSTAT_TAG = 'ADD_OPENSTAT_TAG'; | ||
public const ADD_TO_FAVORITES = 'ADD_TO_FAVORITES'; | ||
public const ENABLE_AREA_OF_INTEREST_TARGETING = 'ENABLE_AREA_OF_INTEREST_TARGETING'; | ||
public const ENABLE_COMPANY_INFO = 'ENABLE_COMPANY_INFO'; | ||
public const ENABLE_EXTENDED_AD_TITLE = 'ENABLE_EXTENDED_AD_TITLE'; | ||
public const ENABLE_SITE_MONITORING = 'ENABLE_SITE_MONITORING'; | ||
public const REQUIRE_SERVICING = 'REQUIRE_SERVICING'; | ||
public const SHARED_ACCOUNT_ENABLED = 'SHARED_ACCOUNT_ENABLED'; | ||
public const DAILY_BUDGET_ALLOWED = 'DAILY_BUDGET_ALLOWED'; | ||
public const CAMPAIGN_EXACT_PHRASE_MATCHING_ENABLED = 'CAMPAIGN_EXACT_PHRASE_MATCHING_ENABLED'; | ||
|
||
/** | ||
* @var array | ||
*/ | ||
private static $getOnly = [ | ||
self::SHARED_ACCOUNT_ENABLED, | ||
self::DAILY_BUDGET_ALLOWED, | ||
self::CAMPAIGN_EXACT_PHRASE_MATCHING_ENABLED | ||
]; | ||
|
||
public static function isGetOnly(DynamicCampaignSettingsEnum $value): bool | ||
{ | ||
if (\in_array((string)$value, self::$getOnly, true)) { | ||
return true; | ||
} | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace directapi\services\campaigns\enum; | ||
|
||
use directapi\components\Enum; | ||
|
||
class SmartCampaignSettingsEnum extends Enum | ||
{ | ||
public const ADD_TO_FAVORITES = 'ADD_TO_FAVORITES'; | ||
public const ENABLE_AREA_OF_INTEREST_TARGETING = 'ENABLE_AREA_OF_INTEREST_TARGETING'; | ||
public const REQUIRE_SERVICING = 'REQUIRE_SERVICING'; | ||
public const SHARED_ACCOUNT_ENABLED = 'SHARED_ACCOUNT_ENABLED'; | ||
public const DAILY_BUDGET_ALLOWED = 'DAILY_BUDGET_ALLOWED'; | ||
|
||
/** | ||
* @var array | ||
*/ | ||
private static $getOnly = [ | ||
self::SHARED_ACCOUNT_ENABLED, | ||
self::DAILY_BUDGET_ALLOWED, | ||
self::ENABLE_AREA_OF_INTEREST_TARGETING, | ||
]; | ||
|
||
public static function isGetOnly(SmartCampaignSettingsEnum $value): bool | ||
{ | ||
if (in_array((string)$value, self::$getOnly, true)) { | ||
return true; | ||
} | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace directapi\services\campaigns\models; | ||
|
||
use directapi\common\enum\YesNoEnum; | ||
use directapi\components\constraints as DirectApiAssert; | ||
use directapi\services\campaigns\enum\CpmCampaignSettingsEnum; | ||
use Symfony\Component\Validator\Constraints as Assert; | ||
|
||
class CpmCampaignSetting | ||
{ | ||
/** | ||
* @var \directapi\services\campaigns\enum\CpmCampaignSettingsEnum | ||
* @Assert\NotBlank() | ||
* @DirectApiAssert\IsEnum(type="directapi\services\campaigns\enum\CpmCampaignSettingsEnum") | ||
*/ | ||
public $Option; | ||
|
||
/** | ||
* @var \directapi\common\enum\YesNoEnum | ||
* @Assert\NotBlank() | ||
* @DirectApiAssert\IsEnum(type="directapi\common\enum\YesNoEnum") | ||
*/ | ||
public $Value; | ||
|
||
public function __construct(?CpmCampaignSettingsEnum $option = null, ?YesNoEnum $value = null) | ||
{ | ||
$this->Option = $option; | ||
$this->Value = $value; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace directapi\services\campaigns\models; | ||
|
||
use directapi\common\enum\YesNoEnum; | ||
use directapi\components\constraints as DirectApiAssert; | ||
use directapi\services\campaigns\enum\DynamicCampaignSettingsEnum; | ||
use Symfony\Component\Validator\Constraints as Assert; | ||
|
||
class DynamicCampaignSetting | ||
{ | ||
/** | ||
* @var \directapi\services\campaigns\enum\DynamicCampaignSettingsEnum | ||
* @Assert\NotBlank() | ||
* @DirectApiAssert\IsEnum(type="directapi\services\campaigns\enum\DynamicCampaignSettingsEnum") | ||
*/ | ||
public $Option; | ||
|
||
/** | ||
* @var \directapi\common\enum\YesNoEnum | ||
* @Assert\NotBlank() | ||
* @DirectApiAssert\IsEnum(type="directapi\common\enum\YesNoEnum") | ||
*/ | ||
public $Value; | ||
|
||
public function __construct(?DynamicCampaignSettingsEnum $option = null, ?YesNoEnum $value = null) | ||
{ | ||
$this->Option = $option; | ||
$this->Value = $value; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace directapi\services\campaigns\models; | ||
|
||
use directapi\common\enum\YesNoEnum; | ||
use directapi\components\constraints as DirectApiAssert; | ||
use directapi\services\campaigns\enum\SmartCampaignSettingsEnum; | ||
use Symfony\Component\Validator\Constraints as Assert; | ||
|
||
class SmartCampaignSetting | ||
{ | ||
/** | ||
* @var \directapi\services\campaigns\enum\SmartCampaignSettingsEnum | ||
* @Assert\NotBlank() | ||
* @DirectApiAssert\IsEnum(type="directapi\services\campaigns\enum\SmartCampaignSettingsEnum") | ||
*/ | ||
public $Option; | ||
|
||
/** | ||
* @var \directapi\common\enum\YesNoEnum | ||
* @Assert\NotBlank() | ||
* @DirectApiAssert\IsEnum(type="directapi\common\enum\YesNoEnum") | ||
*/ | ||
public $Value; | ||
|
||
public function __construct(?SmartCampaignSettingsEnum $option = null, ?YesNoEnum $value = null) | ||
{ | ||
$this->Option = $option; | ||
$this->Value = $value; | ||
} | ||
} |