A

AdsNetworkNameMatching

public
andrei.k Nov 23, 2023 Never 20
Clone
PHP AdsNetworkNameMatching.php 59 lines (52 loc) | 1.78 KB
1
<?php
2
3
namespace App\Components\Helpers;
4
5
class AdsNetworkNameMatching
6
{
7
public static array $names = [
8
'appsamurai' => 'appsamurai',
9
'appsamurai_int' => 'appsamurai_int',
10
'AdColony' => 'adcolony',
11
'avowtech' => 'avowtech',
12
'Apple Search Ads' => 'apple_search',
13
'Chartboost' => 'chartboost',
14
'Snapchat' => 'snapchat',
15
'Facebook' => 'facebook',
16
'Google Ads' => 'google',
17
'TikTok' => 'tiktok',
18
'moloco_int' => 'moloco',
19
'Moloco' => 'moloco',
20
'mail.ru_int' => 'mytarget',
21
'MyTarget' => 'mytarget',
22
'Liftoff' => 'liftoff',
23
'Unity Ads' => 'unity',
24
'Applovin' => 'applovin',
25
'ironSource' => 'ironsource',
26
'Mintegral' => 'mintegral',
27
'yandexdirect_int' => 'yandex_direct',
28
'sponsorpay_int' => 'sponsorpay_int',
29
'Digital Turbine' => 'fyber',
30
// 'Ocean Engine' => '',
31
'Social_facebook' => 'facebook',
32
// 'Social_instagram' => '',
33
'restricted' => 'facebook',
34
// 'facebook_web' => '',
35
// 'glance_int' => '',
36
];
37
38
public static function adsNetworkName(string $name): string
39
{
40
foreach (self::$names as $key => $value) {
41
if ($value === $name) {
42
return $key;
43
}
44
}
45
46
return $name;
47
}
48
49
public static function appsflyerMatching(array $networks): array
50
{
51
$result = [];
52
53
foreach ($networks as $network) {
54
$result[] = self::$names[$network] ?? $network;
55
}
56
57
return $result;
58
}
59
}