Neues Ladestationsmodul mit ocpp Modul erstellt.
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user