DTO for the application

1.0.0 2024-05-01 10:22 UTC

This package is not auto-updated.

Last update: 2024-11-14 11:18:49 UTC


README

Requirements

  • PHP (8.1+)

Usage

Create Tractikum\DTO\Services\ClickService\Campaign\CampaignDTO from default data

use Tractikum\DTO\Services\ClickService\Campaign\CampaignDTO;

CampaignDTO::createDefault()->getAttributes();

Create Tractikum\DTO\Services\Tracker\Campaign\CampaignDTO data

use Tractikum\DTO\Services\Tracker\Campaign\CampaignDTO;
use Tractikum\DTO\Services\Tracker\Campaign\GroupCollectionDTO;

CampaignDTO::create(
    name: 'US Campaign',
    guid: 'some-guid',
    type: CampaignType::Path,
    groups: GroupCollectionDTO::createDefault()
)->getAttributes();

Create Tractikum\DTO\Services\ClickService\Campaign\CampaignDTO from detailed data

use Tractikum\DTO\Services\ClickService\Campaign\CampaignDTO;
use Tractikum\DTO\Services\ClickService\Campaign\CampaignRuleDTO;
use Tractikum\DTO\Services\ClickService\Campaign\CampaignRuleCollectionDTO;
use Tractikum\DTO\Services\Tracker\TrafficSource\TrafficSourceDTO;
use Tractikum\DTO\Services\Tracker\TrafficSource\TrafficSourceParamDTO;
use Tractikum\DTO\Services\Tracker\TrafficSource\TrafficSourceParamCollectionDTO;

CampaignDTO::create(
    workspace_id: 1,
    campaign_guid: 'some-guid',
    rules: CampaignRuleCollectionDTO::create([
        CampaignRuleDTO::create(k: "a", p: "d", v: ["g"], ie: true),
        CampaignRuleDTO::create(k: "b", p: "e", v: ["h"], ie: true),
        CampaignRuleDTO::create(k: "c", p: "f", v: ["i"], ie: true),
    ]),
    traffic_source: TrafficSourceDTO::create(
        id: 1,
        params: TrafficSourceParamCollectionDTO::create([
            TrafficSourceParamDTO::create(token: "token1", ts_param: "ts_param1", ts_token: "ts_token1"),
            TrafficSourceParamDTO::create(token: "token2", ts_param: "ts_param2", ts_token: "ts_token2"),
            TrafficSourceParamDTO::create(token: "token3", ts_param: "ts_param3", ts_token: "ts_token3"),
        ]),
        postback: 'test/postback'
    ),
)->getAttributes();