Files
Symcon_Belevo_Energiemanage…/Ladestation_OCPP/libs/DataTransferRegistry.php
T

32 lines
744 B
PHP

<?php
class DataTransferRegistry
{
private bool $allowed;
private array $entries;
public function __construct(bool $allowed, array $entries = [])
{
$this->allowed = $allowed;
$this->entries = $entries;
}
public function isAllowed(string $vendorId, string $messageId = ''): bool
{
if (!$this->allowed) {
return false;
}
if (empty($this->entries)) {
return true;
}
foreach ($this->entries as $entry) {
if (($entry['vendorId'] ?? '') === $vendorId && (($entry['messageId'] ?? '') === '' || ($entry['messageId'] ?? '') === $messageId)) {
return true;
}
}
return false;
}
}
?>