1 | <?php |
2 | |
3 | namespace App\Components\Helpers; |
4 | |
5 | class PurchaseNetworkNameMatching |
6 | { |
7 | public static array $names = [ |
8 | 'organic' => 'Organic', |
9 | 'ironsource_int' => 'ironSource', |
10 | 'sponsorpay_int' => 'Digital Turbine', |
11 | 'applovin_int' => 'Applovin', |
12 | 'Facebook Ads' => 'Facebook', |
13 | 'unityads_int' => 'Unity Ads', |
14 | 'mintegral_int' => 'Mintegral', |
15 | 'restricted' => 'Facebook', |
16 | 'Apple Search Ads' => 'Apple Search Ads', |
17 | 'cross_promo' => 'cross_promo', |
18 | 'googleadwords_int' => 'Google Ads', |
19 | 'mistplay_int' => 'mistplay_int', |
20 | 'personalyrtb_int' => 'personalyrtb_int', |
21 | 'adjoe_int' => 'adjoe_int', |
22 | 'liftoff_int' => 'Liftoff', |
23 | 'mail.ru_int' => 'MyTarget', |
24 | 'Social_facebook' => 'Social_facebook', |
25 | 'bytedanceglobal_int' => 'bytedanceglobal_int', |
26 | 'appsflyer_sdk_test_int' => 'appsflyer_sdk_test_int', |
27 | ]; |
28 | |
29 | public static function appsflyerMatching(array $networks): array |
30 | { |
31 | $result = []; |
32 | |
33 | foreach ($networks as $network) { |
34 | $key = array_search($network, self::$names, true); |
35 | |
36 | if ($key !== false) { |
37 | $result[] = $key; |
38 | } else { |
39 | $result[] = $network; |
40 | } |
41 | } |
42 | |
43 | return $result; |
44 | } |
45 | } |