-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: device lists in distributor classes
- Loading branch information
1 parent
948d7aa
commit 5c58a12
Showing
37 changed files
with
387 additions
and
1,359 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
require_once 'vendor/autoload.php'; | ||
|
||
use Runalyze\Devices\Device\DeviceInterface; | ||
use Runalyze\Devices\Device\DeviceProfile; | ||
use Runalyze\Devices\Distributor\DistributorInterface; | ||
use Runalyze\Devices\Distributor\DistributorProfile; | ||
|
||
/** @var DistributorInterface[] $distributor */ | ||
$distributor = array_combine( | ||
DistributorProfile::getEnum(), | ||
array_map(fn(int $enum) => DistributorProfile::get($enum), DistributorProfile::getEnum()) | ||
); | ||
$distributorKeys = array_flip(DistributorProfile::getEnum()); | ||
$missingByDistributor = []; | ||
|
||
foreach (DeviceProfile::getEnum() as $deviceKey => $deviceEnum) { | ||
/** @var DeviceInterface $device */ | ||
$device = DeviceProfile::get($deviceEnum); | ||
|
||
if (!in_array($deviceEnum, $distributor[$device->getDistributorEnum()]->getDeviceEnumList())) { | ||
$missingByDistributor[$device->getDistributorEnum()][] = sprintf('%s (ID %d)', $deviceKey, $deviceEnum); | ||
} | ||
} | ||
|
||
foreach ($missingByDistributor as $distributorEnum => $missingDevices) { | ||
echo sprintf("%s (ID %d):\n", $distributorKeys[$distributorEnum], $distributorEnum); | ||
echo " ".implode("\n ", $missingDevices); | ||
echo "\n"; | ||
} |
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
Oops, something went wrong.