Skip to content

Commit 9cfca62

Browse files
committed
Better organization
1 parent 526e0d5 commit 9cfca62

16 files changed

+210
-169
lines changed

bin/etl.php

+8-7
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace AdsWarehouse;
44

5+
use AdsWarehouse\Account\Account;
56
use AdsWarehouse\ETL\AdWords;
67
use AdsWarehouse\ETL\ETL;
78
use AdsWarehouse\ETL\FacebookAds;
@@ -37,11 +38,11 @@
3738
$api->setLogger(new CurlLogger());
3839
}
3940

40-
$elt = [
41-
new AdWords($warehouse, $analytics, getenv('GA_VIEW_ID')),
42-
new FacebookAds($warehouse, $api, getenv('FB_AD_ACCOUNT_ID')),
43-
];
41+
$accounts = $warehouse->accounts();
4442

45-
array_walk($elt, function (ETL $etl): void {
46-
$etl->load();
47-
});
43+
$etl = array_map(fn(Account $account) => [
44+
new AdWords($warehouse, $analytics, $account->gaViewId),
45+
new FacebookAds($warehouse, $api, $account->fbAdAccountId),
46+
], $accounts);
47+
48+
array_walk_recursive($elt, fn(ETL $etl): void => $etl->load());

composer.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
]
4040
},
4141
"scripts": {
42-
"etl": "docker-compose exec -T server php bin/etl.php"
42+
"etl": "docker-compose exec -T server php bin/etl.php",
43+
"analyze": "psalm"
4344
}
4445
}

0 commit comments

Comments
 (0)