diff --git a/README.md b/README.md
index 3c8eee13..c66e1c93 100644
--- a/README.md
+++ b/README.md
@@ -20,6 +20,8 @@
[![Black](https://img.shields.io/badge/black-enabled-brightgreen.svg?style=flat-square)](https://github.com/psf/black)
[![MyPy](https://img.shields.io/badge/mypy-enabled-brightgreen.svg?style=flat-square)](http://mypy-lang.org)
+***
+
## What is FastyBird IoT devices module?
Devices module is a combined [Nette framework](https://nette.org) extension, [Vuex ORM](https://vuex-orm.org) plugin
diff --git a/composer.json b/composer.json
index c496fc00..72d26f61 100644
--- a/composer.json
+++ b/composer.json
@@ -43,10 +43,10 @@
"ext-pcntl" : "*",
"contributte/flysystem" : "^0.3.0",
"cweagans/composer-patches" : "^1.7",
- "fastybird/exchange" : "^0.59",
- "fastybird/json-api" : "^0.11",
- "fastybird/metadata" : "^0.76",
- "fastybird/simple-auth" : "^0.4",
+ "fastybird/exchange" : "^0.60",
+ "fastybird/json-api" : "^0.13",
+ "fastybird/metadata" : "^0.77",
+ "fastybird/simple-auth" : "^0.5",
"ipub/doctrine-dynamic-discriminator-map" : "^1.4",
"ipub/doctrine-timestampable" : "^1.5",
"ipub/slim-router" : "^0.2",
diff --git a/phpcs.xml b/phpcs.xml
index cb4f2a5c..14c85f26 100644
--- a/phpcs.xml
+++ b/phpcs.xml
@@ -18,7 +18,7 @@
-
+
diff --git a/requirements.txt b/requirements.txt
index 1e4469cc..81b7f2bb 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,6 +1,6 @@
fastnumbers>=3.2
-fastybird-exchange>=0.59
-fastybird-metadata>=0.76
+fastybird-exchange>=0.60
+fastybird-metadata>=0.77
inflection>=0.5
kink>=0.6
setuptools>=57.4
diff --git a/src/Commands/Connector.php b/src/Commands/Connector.php
index 8ac8ac8c..a22be479 100644
--- a/src/Commands/Connector.php
+++ b/src/Commands/Connector.php
@@ -63,20 +63,20 @@ class Connector extends Console\Command\Command
private Log\LoggerInterface $logger;
public function __construct(
- private Models\DataStorage\ConnectorsRepository $connectorsRepository,
- private Models\DataStorage\DevicesRepository $devicesRepository,
- private Models\DataStorage\DevicePropertiesRepository $devicesPropertiesRepository,
- private Models\DataStorage\ChannelsRepository $channelsRepository,
- private Models\DataStorage\ChannelPropertiesRepository $channelsPropertiesRepository,
- private Models\States\ConnectorConnectionStateManager $connectorConnectionStateManager,
- private Models\States\DeviceConnectionStateManager $deviceConnectionStateManager,
- private Models\States\DevicePropertyStateManager $devicePropertyStateManager,
- private Models\States\ChannelPropertyStateManager $channelPropertyStateManager,
- private Consumers\Connector $connectorConsumer,
- private ExchangeConsumer\Consumer $consumer,
- private DateTimeFactory\DateTimeFactory $dateTimeFactory,
- private EventLoop\LoopInterface $eventLoop,
- private PsrEventDispatcher\EventDispatcherInterface|null $dispatcher,
+ private readonly Models\DataStorage\ConnectorsRepository $connectorsRepository,
+ private readonly Models\DataStorage\DevicesRepository $devicesRepository,
+ private readonly Models\DataStorage\DevicePropertiesRepository $devicesPropertiesRepository,
+ private readonly Models\DataStorage\ChannelsRepository $channelsRepository,
+ private readonly Models\DataStorage\ChannelPropertiesRepository $channelsPropertiesRepository,
+ private readonly Models\States\ConnectorConnectionStateManager $connectorConnectionStateManager,
+ private readonly Models\States\DeviceConnectionStateManager $deviceConnectionStateManager,
+ private readonly Models\States\DevicePropertyStateManager $devicePropertyStateManager,
+ private readonly Models\States\ChannelPropertyStateManager $channelPropertyStateManager,
+ private readonly Consumers\Connector $connectorConsumer,
+ private readonly ExchangeConsumer\Container $consumer,
+ private readonly DateTimeFactory\Factory $dateTimeFactory,
+ private readonly EventLoop\LoopInterface $eventLoop,
+ private readonly PsrEventDispatcher\EventDispatcherInterface|null $dispatcher,
Log\LoggerInterface|null $logger = null,
string|null $name = null,
)
@@ -180,6 +180,7 @@ protected function execute(Input\InputInterface $input, Output\OutputInterface $
/**
* @throws Exceptions\Terminate
+ * @throws Metadata\Exceptions\FileNotFound
*/
private function executeConnector(Style\SymfonyStyle $io, Input\InputInterface $input): void
{
@@ -298,7 +299,7 @@ private function executeConnector(Style\SymfonyStyle $io, Input\InputInterface $
try {
$this->resetConnectorDevices(
$connector,
- MetadataTypes\ConnectionStateType::get(MetadataTypes\ConnectionStateType::STATE_UNKNOWN),
+ MetadataTypes\ConnectionState::get(MetadataTypes\ConnectionState::STATE_UNKNOWN),
);
// Start connector service
@@ -306,7 +307,7 @@ private function executeConnector(Style\SymfonyStyle $io, Input\InputInterface $
$this->connectorConnectionStateManager->setState(
$connector,
- MetadataTypes\ConnectionStateType::get(MetadataTypes\ConnectionStateType::STATE_RUNNING),
+ MetadataTypes\ConnectionState::get(MetadataTypes\ConnectionState::STATE_RUNNING),
);
} catch (Throwable $ex) {
throw new Exceptions\Terminate('Connector can\'t be started', $ex->getCode(), $ex);
@@ -315,7 +316,7 @@ private function executeConnector(Style\SymfonyStyle $io, Input\InputInterface $
$this->dispatcher?->dispatch(new Events\AfterConnectorStart($connector));
});
- $this->eventLoop->addSignal(SIGINT, function (int $signal) use ($connector, $service): void {
+ $this->eventLoop->addSignal(SIGINT, function () use ($connector, $service): void {
$this->logger->info('Stopping connector...', [
'source' => Metadata\Constants::MODULE_DEVICES_SOURCE,
'type' => 'service-cmd',
@@ -328,7 +329,7 @@ private function executeConnector(Style\SymfonyStyle $io, Input\InputInterface $
$this->resetConnectorDevices(
$connector,
- MetadataTypes\ConnectionStateType::get(MetadataTypes\ConnectionStateType::STATE_DISCONNECTED),
+ MetadataTypes\ConnectionState::get(MetadataTypes\ConnectionState::STATE_DISCONNECTED),
);
$now = $this->dateTimeFactory->getNow();
@@ -351,12 +352,12 @@ private function executeConnector(Style\SymfonyStyle $io, Input\InputInterface $
$this->connectorConnectionStateManager->setState(
$connector,
- MetadataTypes\ConnectionStateType::get(MetadataTypes\ConnectionStateType::STATE_STOPPED),
+ MetadataTypes\ConnectionState::get(MetadataTypes\ConnectionState::STATE_STOPPED),
);
$this->eventLoop->stop();
} catch (Throwable $ex) {
- $this->logger->error('Connector couldn\'t be stopped. An unexpected error occurred', [
+ $this->logger->error('Connector could not be stopped. An unexpected error occurred', [
'source' => Metadata\Constants::MODULE_DEVICES_SOURCE,
'type' => 'service-cmd',
'exception' => [
@@ -374,27 +375,30 @@ private function executeConnector(Style\SymfonyStyle $io, Input\InputInterface $
});
}
+ /**
+ * @throws Metadata\Exceptions\FileNotFound
+ */
private function resetConnectorDevices(
- MetadataEntities\Modules\DevicesModule\IConnectorEntity $connector,
- MetadataTypes\ConnectionStateType $state,
+ MetadataEntities\DevicesModule\Connector $connector,
+ MetadataTypes\ConnectionState $state,
): void
{
foreach ($this->devicesRepository->findAllByConnector($connector->getId()) as $device) {
$this->deviceConnectionStateManager->setState($device, $state);
- /** @var Array $properties */
+ /** @var Array $properties */
$properties = $this->devicesPropertiesRepository->findAllByDevice(
$device->getId(),
- MetadataEntities\Modules\DevicesModule\DeviceDynamicPropertyEntity::class,
+ MetadataEntities\DevicesModule\DeviceDynamicProperty::class,
);
$this->devicePropertyStateManager->setValidState($properties, false);
foreach ($this->channelsRepository->findAllByDevice($device->getId()) as $channel) {
- /** @var Array $properties */
+ /** @var Array $properties */
$properties = $this->channelsPropertiesRepository->findAllByChannel(
$channel->getId(),
- MetadataEntities\Modules\DevicesModule\ChannelDynamicPropertyEntity::class,
+ MetadataEntities\DevicesModule\ChannelDynamicProperty::class,
);
$this->channelPropertyStateManager->setValidState($properties, false);
diff --git a/src/Commands/Initialize.php b/src/Commands/Initialize.php
index aa755a3a..e0dd239e 100644
--- a/src/Commands/Initialize.php
+++ b/src/Commands/Initialize.php
@@ -40,7 +40,7 @@ class Initialize extends Console\Command\Command
private Log\LoggerInterface $logger;
public function __construct(
- private DataStorage\Writer $writer,
+ private readonly DataStorage\Writer $writer,
Log\LoggerInterface|null $logger = null,
string|null $name = null,
)
diff --git a/src/Connectors/ConnectorFactory.php b/src/Connectors/ConnectorFactory.php
index afbd51c8..3d51d713 100644
--- a/src/Connectors/ConnectorFactory.php
+++ b/src/Connectors/ConnectorFactory.php
@@ -28,6 +28,6 @@
interface ConnectorFactory
{
- public function create(MetadataEntities\Modules\DevicesModule\IConnectorEntity $connector): Connector;
+ public function create(MetadataEntities\DevicesModule\Connector $connector): Connector;
}
diff --git a/src/Consumers/Connector.php b/src/Consumers/Connector.php
index 4f62467b..ab43caec 100644
--- a/src/Consumers/Connector.php
+++ b/src/Consumers/Connector.php
@@ -33,25 +33,23 @@
*
* @author Adam Kadlec
*/
-final class Connector implements ExchangeConsumer\IConsumer
+final class Connector implements ExchangeConsumer\Consumer
{
use Nette\SmartObject;
- public function __construct(private DataStorage\Reader $reader)
+ public function __construct(private readonly DataStorage\Reader $reader)
{
}
/**
- * {@inheritDoc}
- *
* @throws Utils\JsonException
* @throws Flysystem\FilesystemException
*/
public function consume(
- MetadataTypes\ModuleSourceType|MetadataTypes\PluginSourceType|MetadataTypes\ConnectorSourceType $source,
- MetadataTypes\RoutingKeyType $routingKey,
- MetadataEntities\IEntity|null $entity,
+ MetadataTypes\ModuleSource|MetadataTypes\PluginSource|MetadataTypes\ConnectorSource $source,
+ MetadataTypes\RoutingKey $routingKey,
+ MetadataEntities\Entity|null $entity,
): void
{
if (
diff --git a/src/Controllers/BaseV1.php b/src/Controllers/BaseV1.php
index f6af79ea..91a756be 100644
--- a/src/Controllers/BaseV1.php
+++ b/src/Controllers/BaseV1.php
@@ -62,7 +62,7 @@ abstract class BaseV1
protected Router\Validator $routesValidator;
- protected JsonApiHydrators\HydratorsContainer $hydratorsContainer;
+ protected JsonApiHydrators\Container $hydratorsContainer;
protected Log\LoggerInterface $logger;
@@ -91,13 +91,13 @@ public function injectRoutesValidator(Router\Validator $validator): void
$this->routesValidator = $validator;
}
- public function injectHydratorsContainer(JsonApiHydrators\HydratorsContainer $hydratorsContainer): void
+ public function injectHydratorsContainer(JsonApiHydrators\Container $hydratorsContainer): void
{
$this->hydratorsContainer = $hydratorsContainer;
}
/**
- * @throws JsonApiExceptions\IJsonApiException
+ * @throws JsonApiExceptions\JsonApi
*/
public function readRelationship(
Message\ServerRequestInterface $request,
@@ -108,7 +108,7 @@ public function readRelationship(
$relationEntity = Utils\Strings::lower(strval($request->getAttribute(Router\Routes::RELATION_ENTITY)));
if ($relationEntity !== '') {
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_NOT_FOUND,
$this->translator->translate('//devices-module.base.messages.relationNotFound.heading'),
$this->translator->translate(
@@ -118,7 +118,7 @@ public function readRelationship(
);
}
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_NOT_FOUND,
$this->translator->translate('//devices-module.base.messages.unknownRelation.heading'),
$this->translator->translate('//devices-module.base.messages.unknownRelation.message'),
@@ -126,7 +126,7 @@ public function readRelationship(
}
/**
- * @throws JsonApiExceptions\IJsonApiException
+ * @throws JsonApiExceptions\JsonApi
*/
protected function createDocument(Message\ServerRequestInterface $request): JsonAPIDocument\IDocument
{
@@ -134,7 +134,7 @@ protected function createDocument(Message\ServerRequestInterface $request): Json
$content = Utils\Json::decode($request->getBody()->getContents());
if (!$content instanceof stdClass) {
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_BAD_REQUEST,
$this->translator->translate('//devices-module.base.messages.notValidJsonApi.heading'),
$this->translator->translate('//devices-module.base.messages.notValidJsonApi.message'),
@@ -144,13 +144,13 @@ protected function createDocument(Message\ServerRequestInterface $request): Json
$document = new JsonAPIDocument\Document($content);
} catch (Utils\JsonException) {
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_BAD_REQUEST,
$this->translator->translate('//devices-module.base.messages.notValidJson.heading'),
$this->translator->translate('//devices-module.base.messages.notValidJson.message'),
);
} catch (JsonAPIDocument\Exceptions\RuntimeException) {
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_BAD_REQUEST,
$this->translator->translate('//devices-module.base.messages.notValidJsonApi.heading'),
$this->translator->translate('//devices-module.base.messages.notValidJsonApi.message'),
@@ -161,7 +161,7 @@ protected function createDocument(Message\ServerRequestInterface $request): Json
}
/**
- * @throws JsonApiExceptions\JsonApiErrorException
+ * @throws JsonApiExceptions\JsonApiError
*/
protected function validateIdentifier(
Message\ServerRequestInterface $request,
@@ -176,7 +176,7 @@ protected function validateIdentifier(
&& $request->getAttribute(Router\Routes::URL_ITEM_ID) !== null
&& $request->getAttribute(Router\Routes::URL_ITEM_ID) !== $document->getResource()->getId()
) {
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_BAD_REQUEST,
$this->translator->translate('//devices-module.base.messages.invalidIdentifier.heading'),
$this->translator->translate('//devices-module.base.messages.invalidIdentifier.message'),
diff --git a/src/Controllers/ChannelControlsV1.php b/src/Controllers/ChannelControlsV1.php
index e7a48430..b199e684 100644
--- a/src/Controllers/ChannelControlsV1.php
+++ b/src/Controllers/ChannelControlsV1.php
@@ -46,16 +46,16 @@ final class ChannelControlsV1 extends BaseV1
use Controllers\Finders\TChannel;
public function __construct(
- protected Models\Devices\DevicesRepository $devicesRepository,
- protected Models\Channels\ChannelsRepository $channelsRepository,
- protected Models\Channels\Controls\ControlsRepository $channelControlsRepository,
+ protected readonly Models\Devices\DevicesRepository $devicesRepository,
+ protected readonly Models\Channels\ChannelsRepository $channelsRepository,
+ protected readonly Models\Channels\Controls\ControlsRepository $channelControlsRepository,
)
{
}
/**
* @throws Exception
- * @throws JsonApiExceptions\IJsonApiException
+ * @throws JsonApiExceptions\JsonApi
*/
public function index(
Message\ServerRequestInterface $request,
@@ -79,7 +79,7 @@ public function index(
/**
* @throws Exception
- * @throws JsonApiExceptions\IJsonApiException
+ * @throws JsonApiExceptions\JsonApi
*/
public function read(
Message\ServerRequestInterface $request,
@@ -105,7 +105,7 @@ public function read(
}
}
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_NOT_FOUND,
$this->translator->translate('//devices-module.base.messages.notFound.heading'),
$this->translator->translate('//devices-module.base.messages.notFound.message'),
@@ -114,7 +114,7 @@ public function read(
/**
* @throws Exception
- * @throws JsonApiExceptions\IJsonApiException
+ * @throws JsonApiExceptions\JsonApi
*/
public function readRelationship(
Message\ServerRequestInterface $request,
@@ -143,7 +143,7 @@ public function readRelationship(
return $this->buildResponse($request, $response, $device);
}
} else {
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_NOT_FOUND,
$this->translator->translate('//devices-module.base.messages.notFound.heading'),
$this->translator->translate('//devices-module.base.messages.notFound.message'),
diff --git a/src/Controllers/ChannelPropertiesV1.php b/src/Controllers/ChannelPropertiesV1.php
index 38d5db4f..1df0efe3 100644
--- a/src/Controllers/ChannelPropertiesV1.php
+++ b/src/Controllers/ChannelPropertiesV1.php
@@ -55,17 +55,17 @@ final class ChannelPropertiesV1 extends BaseV1
use Controllers\Finders\TChannelProperty;
public function __construct(
- protected Models\Devices\DevicesRepository $devicesRepository,
- protected Models\Channels\ChannelsRepository $channelsRepository,
- protected Models\Channels\Properties\PropertiesRepository $channelPropertiesRepository,
- protected Models\Channels\Properties\PropertiesManager $channelPropertiesManager,
+ protected readonly Models\Devices\DevicesRepository $devicesRepository,
+ protected readonly Models\Channels\ChannelsRepository $channelsRepository,
+ protected readonly Models\Channels\Properties\PropertiesRepository $channelPropertiesRepository,
+ protected readonly Models\Channels\Properties\PropertiesManager $channelPropertiesManager,
)
{
}
/**
* @throws Exception
- * @throws JsonApiExceptions\IJsonApiException
+ * @throws JsonApiExceptions\JsonApi
*/
public function index(
Message\ServerRequestInterface $request,
@@ -88,7 +88,7 @@ public function index(
/**
* @throws Exception
- * @throws JsonApiExceptions\IJsonApiException
+ * @throws JsonApiExceptions\JsonApi
*/
public function read(
Message\ServerRequestInterface $request,
@@ -108,8 +108,8 @@ public function read(
/**
* @throws Doctrine\DBAL\Exception
* @throws Exception
- * @throws JsonApiExceptions\IJsonApiException
- * @throws JsonApiExceptions\JsonApiErrorException
+ * @throws JsonApiExceptions\JsonApi
+ * @throws JsonApiExceptions\JsonApiError
*
* @Secured
* @Secured\Role(manager,administrator)
@@ -138,10 +138,10 @@ public function create(
// Commit all changes into database
$this->getOrmConnection()->commit();
- } catch (JsonApiExceptions\IJsonApiException $ex) {
+ } catch (JsonApiExceptions\JsonApi $ex) {
throw $ex;
} catch (DoctrineCrudExceptions\MissingRequiredFieldException $ex) {
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY,
$this->translator->translate('//devices-module.base.messages.missingAttribute.heading'),
$this->translator->translate('//devices-module.base.messages.missingAttribute.message'),
@@ -150,7 +150,7 @@ public function create(
],
);
} catch (DoctrineCrudExceptions\EntityCreationException $ex) {
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY,
$this->translator->translate('//devices-module.base.messages.missingAttribute.heading'),
$this->translator->translate('//devices-module.base.messages.missingAttribute.message'),
@@ -160,7 +160,7 @@ public function create(
);
} catch (Doctrine\DBAL\Exception\UniqueConstraintViolationException $ex) {
if (preg_match("%PRIMARY'%", $ex->getMessage(), $match) === 1) {
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY,
$this->translator->translate('//devices-module.base.messages.uniqueIdentifier.heading'),
$this->translator->translate('//devices-module.base.messages.uniqueIdentifier.message'),
@@ -173,7 +173,7 @@ public function create(
$columnKey = end($columnParts);
if (is_string($columnKey) && Utils\Strings::startsWith($columnKey, 'property_')) {
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY,
$this->translator->translate('//devices-module.base.messages.uniqueAttribute.heading'),
$this->translator->translate('//devices-module.base.messages.uniqueAttribute.message'),
@@ -184,7 +184,7 @@ public function create(
}
}
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY,
$this->translator->translate('//devices-module.base.messages.uniqueAttribute.heading'),
$this->translator->translate('//devices-module.base.messages.uniqueAttribute.message'),
@@ -200,7 +200,7 @@ public function create(
],
]);
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY,
$this->translator->translate('//devices-module.base.messages.notCreated.heading'),
$this->translator->translate('//devices-module.base.messages.notCreated.message'),
@@ -217,7 +217,7 @@ public function create(
return $response->withStatus(StatusCodeInterface::STATUS_CREATED);
}
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY,
$this->translator->translate('//devices-module.base.messages.invalidType.heading'),
$this->translator->translate('//devices-module.base.messages.invalidType.message'),
@@ -230,8 +230,8 @@ public function create(
/**
* @throws Doctrine\DBAL\Exception
* @throws Exception
- * @throws JsonApiExceptions\IJsonApiException
- * @throws JsonApiExceptions\JsonApiErrorException
+ * @throws JsonApiExceptions\JsonApi
+ * @throws JsonApiExceptions\JsonApiError
*
* @Secured
* @Secured\Role(manager,administrator)
@@ -267,7 +267,7 @@ public function update(
// Commit all changes into database
$this->getOrmConnection()->commit();
- } catch (JsonApiExceptions\IJsonApiException $ex) {
+ } catch (JsonApiExceptions\JsonApi $ex) {
throw $ex;
} catch (Throwable $ex) {
// Log caught exception
@@ -280,7 +280,7 @@ public function update(
],
]);
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY,
$this->translator->translate('//devices-module.base.messages.notUpdated.heading'),
$this->translator->translate('//devices-module.base.messages.notUpdated.message'),
@@ -295,7 +295,7 @@ public function update(
return $this->buildResponse($request, $response, $property);
}
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY,
$this->translator->translate('//devices-module.base.messages.invalidType.heading'),
$this->translator->translate('//devices-module.base.messages.invalidType.message'),
@@ -307,8 +307,8 @@ public function update(
/**
* @throws Doctrine\DBAL\Exception
- * @throws JsonApiExceptions\IJsonApiException
- * @throws JsonApiExceptions\JsonApiErrorException
+ * @throws JsonApiExceptions\JsonApi
+ * @throws JsonApiExceptions\JsonApiError
*
* @Secured
* @Secured\Role(manager,administrator)
@@ -346,7 +346,7 @@ public function delete(
],
]);
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY,
$this->translator->translate('//devices-module.base.messages.notDeleted.heading'),
$this->translator->translate('//devices-module.base.messages.notDeleted.message'),
@@ -363,7 +363,7 @@ public function delete(
/**
* @throws Exception
- * @throws JsonApiExceptions\IJsonApiException
+ * @throws JsonApiExceptions\JsonApi
*/
public function readRelationship(
Message\ServerRequestInterface $request,
diff --git a/src/Controllers/ChannelPropertyChildrenV1.php b/src/Controllers/ChannelPropertyChildrenV1.php
index de3b83c3..364483c9 100644
--- a/src/Controllers/ChannelPropertyChildrenV1.php
+++ b/src/Controllers/ChannelPropertyChildrenV1.php
@@ -43,15 +43,15 @@ final class ChannelPropertyChildrenV1 extends BaseV1
use Controllers\Finders\TChannelProperty;
public function __construct(
- protected Models\Devices\DevicesRepository $devicesRepository,
- protected Models\Channels\Properties\PropertiesRepository $channelPropertiesRepository,
+ protected readonly Models\Devices\DevicesRepository $devicesRepository,
+ protected readonly Models\Channels\Properties\PropertiesRepository $channelPropertiesRepository,
)
{
}
/**
* @throws Exception
- * @throws JsonApiExceptions\IJsonApiException
+ * @throws JsonApiExceptions\JsonApi
*/
public function index(
Message\ServerRequestInterface $request,
diff --git a/src/Controllers/ChannelsV1.php b/src/Controllers/ChannelsV1.php
index 6eec6e20..228ca183 100644
--- a/src/Controllers/ChannelsV1.php
+++ b/src/Controllers/ChannelsV1.php
@@ -51,16 +51,16 @@ final class ChannelsV1 extends BaseV1
use Controllers\Finders\TChannel;
public function __construct(
- protected Models\Devices\DevicesRepository $devicesRepository,
- protected Models\Channels\ChannelsRepository $channelsRepository,
- protected Models\Channels\ChannelsManager $channelsManager,
+ protected readonly Models\Devices\DevicesRepository $devicesRepository,
+ protected readonly Models\Channels\ChannelsRepository $channelsRepository,
+ protected readonly Models\Channels\ChannelsManager $channelsManager,
)
{
}
/**
* @throws Exception
- * @throws JsonApiExceptions\IJsonApiException
+ * @throws JsonApiExceptions\JsonApi
*/
public function index(
Message\ServerRequestInterface $request,
@@ -81,7 +81,7 @@ public function index(
/**
* @throws Exception
- * @throws JsonApiExceptions\IJsonApiException
+ * @throws JsonApiExceptions\JsonApi
*/
public function read(
Message\ServerRequestInterface $request,
@@ -99,8 +99,8 @@ public function read(
/**
* @throws Doctrine\DBAL\Exception
* @throws Exception
- * @throws JsonApiExceptions\IJsonApiException
- * @throws JsonApiExceptions\JsonApiErrorException
+ * @throws JsonApiExceptions\JsonApi
+ * @throws JsonApiExceptions\JsonApiError
*
* @Secured
* @Secured\Role(manager,administrator)
@@ -127,10 +127,10 @@ public function create(
// Commit all changes into database
$this->getOrmConnection()->commit();
- } catch (JsonApiExceptions\IJsonApiException $ex) {
+ } catch (JsonApiExceptions\JsonApi $ex) {
throw $ex;
} catch (DoctrineCrudExceptions\MissingRequiredFieldException $ex) {
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY,
$this->translator->translate('//devices-module.base.messages.missingAttribute.heading'),
$this->translator->translate('//devices-module.base.messages.missingAttribute.message'),
@@ -139,7 +139,7 @@ public function create(
],
);
} catch (DoctrineCrudExceptions\EntityCreationException $ex) {
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY,
$this->translator->translate('//devices-module.base.messages.missingAttribute.heading'),
$this->translator->translate('//devices-module.base.messages.missingAttribute.message'),
@@ -149,7 +149,7 @@ public function create(
);
} catch (Doctrine\DBAL\Exception\UniqueConstraintViolationException $ex) {
if (preg_match("%PRIMARY'%", $ex->getMessage(), $match) === 1) {
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY,
$this->translator->translate('//devices-module.base.messages.uniqueIdentifier.heading'),
$this->translator->translate('//devices-module.base.messages.uniqueIdentifier.message'),
@@ -162,7 +162,7 @@ public function create(
$columnKey = end($columnParts);
if (is_string($columnKey) && Utils\Strings::startsWith($columnKey, 'channel_')) {
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY,
$this->translator->translate('//devices-module.base.messages.uniqueAttribute.heading'),
$this->translator->translate('//devices-module.base.messages.uniqueAttribute.message'),
@@ -173,7 +173,7 @@ public function create(
}
}
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY,
$this->translator->translate('//devices-module.base.messages.uniqueAttribute.heading'),
$this->translator->translate('//devices-module.base.messages.uniqueAttribute.message'),
@@ -189,7 +189,7 @@ public function create(
],
]);
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY,
$this->translator->translate('//devices-module.base.messages.notCreated.heading'),
$this->translator->translate('//devices-module.base.messages.notCreated.message'),
@@ -206,7 +206,7 @@ public function create(
return $response->withStatus(StatusCodeInterface::STATUS_CREATED);
}
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY,
$this->translator->translate('//devices-module.base.messages.invalidType.heading'),
$this->translator->translate('//devices-module.base.messages.invalidType.message'),
@@ -219,8 +219,8 @@ public function create(
/**
* @throws Doctrine\DBAL\Exception
* @throws Exception
- * @throws JsonApiExceptions\IJsonApiException
- * @throws JsonApiExceptions\JsonApiErrorException
+ * @throws JsonApiExceptions\JsonApi
+ * @throws JsonApiExceptions\JsonApiError
*
* @Secured
* @Secured\Role(manager,administrator)
@@ -251,7 +251,7 @@ public function update(
// Commit all changes into database
$this->getOrmConnection()->commit();
- } catch (JsonApiExceptions\IJsonApiException $ex) {
+ } catch (JsonApiExceptions\JsonApi $ex) {
throw $ex;
} catch (Throwable $ex) {
// Log caught exception
@@ -264,7 +264,7 @@ public function update(
],
]);
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY,
$this->translator->translate('//devices-module.base.messages.notUpdated.heading'),
$this->translator->translate('//devices-module.base.messages.notUpdated.message'),
@@ -279,7 +279,7 @@ public function update(
return $this->buildResponse($request, $response, $channel);
}
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY,
$this->translator->translate('//devices-module.base.messages.invalidType.heading'),
$this->translator->translate('//devices-module.base.messages.invalidType.message'),
@@ -291,8 +291,8 @@ public function update(
/**
* @throws Doctrine\DBAL\Exception
- * @throws JsonApiExceptions\IJsonApiException
- * @throws JsonApiExceptions\JsonApiErrorException
+ * @throws JsonApiExceptions\JsonApi
+ * @throws JsonApiExceptions\JsonApiError
*
* @Secured
* @Secured\Role(manager,administrator)
@@ -328,7 +328,7 @@ public function delete(
],
]);
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY,
$this->translator->translate('//devices-module.base.messages.notDeleted.heading'),
$this->translator->translate('//devices-module.base.messages.notDeleted.message'),
@@ -345,7 +345,7 @@ public function delete(
/**
* @throws Exception
- * @throws JsonApiExceptions\IJsonApiException
+ * @throws JsonApiExceptions\JsonApi
*/
public function readRelationship(
Message\ServerRequestInterface $request,
diff --git a/src/Controllers/ConnectorControlsV1.php b/src/Controllers/ConnectorControlsV1.php
index ffdb0eb7..541a8416 100644
--- a/src/Controllers/ConnectorControlsV1.php
+++ b/src/Controllers/ConnectorControlsV1.php
@@ -45,15 +45,15 @@ final class ConnectorControlsV1 extends BaseV1
use Controllers\Finders\TConnector;
public function __construct(
- protected Models\Connectors\ConnectorsRepository $connectorsRepository,
- private Models\Connectors\Controls\ControlsRepository $connectorControlsRepository,
+ protected readonly Models\Connectors\ConnectorsRepository $connectorsRepository,
+ private readonly Models\Connectors\Controls\ControlsRepository $connectorControlsRepository,
)
{
}
/**
* @throws Exception
- * @throws JsonApiExceptions\IJsonApiException
+ * @throws JsonApiExceptions\JsonApi
*/
public function index(
Message\ServerRequestInterface $request,
@@ -74,7 +74,7 @@ public function index(
/**
* @throws Exception
- * @throws JsonApiExceptions\IJsonApiException
+ * @throws JsonApiExceptions\JsonApi
*/
public function read(
Message\ServerRequestInterface $request,
@@ -97,7 +97,7 @@ public function read(
}
}
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_NOT_FOUND,
$this->translator->translate('//devices-module.base.messages.notFound.heading'),
$this->translator->translate('//devices-module.base.messages.notFound.message'),
@@ -106,7 +106,7 @@ public function read(
/**
* @throws Exception
- * @throws JsonApiExceptions\IJsonApiException
+ * @throws JsonApiExceptions\JsonApi
*/
public function readRelationship(
Message\ServerRequestInterface $request,
@@ -132,7 +132,7 @@ public function readRelationship(
return $this->buildResponse($request, $response, $control->getConnector());
}
} else {
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_NOT_FOUND,
$this->translator->translate('//devices-module.base.messages.notFound.heading'),
$this->translator->translate('//devices-module.base.messages.notFound.message'),
diff --git a/src/Controllers/ConnectorPropertiesV1.php b/src/Controllers/ConnectorPropertiesV1.php
index 81d292c9..ad6dd233 100644
--- a/src/Controllers/ConnectorPropertiesV1.php
+++ b/src/Controllers/ConnectorPropertiesV1.php
@@ -55,16 +55,16 @@ final class ConnectorPropertiesV1 extends BaseV1
use Controllers\Finders\TConnector;
public function __construct(
- protected Models\Connectors\ConnectorsRepository $connectorsRepository,
- protected Models\Connectors\Properties\PropertiesRepository $connectorPropertiesRepository,
- protected Models\Connectors\Properties\PropertiesManager $connectorPropertiesManager,
+ protected readonly Models\Connectors\ConnectorsRepository $connectorsRepository,
+ protected readonly Models\Connectors\Properties\PropertiesRepository $connectorPropertiesRepository,
+ protected readonly Models\Connectors\Properties\PropertiesManager $connectorPropertiesManager,
)
{
}
/**
* @throws Exception
- * @throws JsonApiExceptions\IJsonApiException
+ * @throws JsonApiExceptions\JsonApi
*/
public function index(
Message\ServerRequestInterface $request,
@@ -85,7 +85,7 @@ public function index(
/**
* @throws Exception
- * @throws JsonApiExceptions\IJsonApiException
+ * @throws JsonApiExceptions\JsonApi
*/
public function read(
Message\ServerRequestInterface $request,
@@ -103,8 +103,8 @@ public function read(
/**
* @throws Doctrine\DBAL\Exception
* @throws Exception
- * @throws JsonApiExceptions\IJsonApiException
- * @throws JsonApiExceptions\JsonApiErrorException
+ * @throws JsonApiExceptions\JsonApi
+ * @throws JsonApiExceptions\JsonApiError
*
* @Secured
* @Secured\Role(manager,administrator)
@@ -131,10 +131,10 @@ public function create(
// Commit all changes into database
$this->getOrmConnection()->commit();
- } catch (JsonApiExceptions\IJsonApiException $ex) {
+ } catch (JsonApiExceptions\JsonApi $ex) {
throw $ex;
} catch (DoctrineCrudExceptions\MissingRequiredFieldException $ex) {
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY,
$this->translator->translate('//devices-module.base.messages.missingAttribute.heading'),
$this->translator->translate('//devices-module.base.messages.missingAttribute.message'),
@@ -143,7 +143,7 @@ public function create(
],
);
} catch (DoctrineCrudExceptions\EntityCreationException $ex) {
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY,
$this->translator->translate('//devices-module.base.messages.missingAttribute.heading'),
$this->translator->translate('//devices-module.base.messages.missingAttribute.message'),
@@ -153,7 +153,7 @@ public function create(
);
} catch (Doctrine\DBAL\Exception\UniqueConstraintViolationException $ex) {
if (preg_match("%PRIMARY'%", $ex->getMessage(), $match) === 1) {
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY,
$this->translator->translate('//devices-module.base.messages.uniqueIdentifier.heading'),
$this->translator->translate('//devices-module.base.messages.uniqueIdentifier.message'),
@@ -166,7 +166,7 @@ public function create(
$columnKey = end($columnParts);
if (is_string($columnKey) && Utils\Strings::startsWith($columnKey, 'property_')) {
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY,
$this->translator->translate('//devices-module.base.messages.uniqueAttribute.heading'),
$this->translator->translate('//devices-module.base.messages.uniqueAttribute.message'),
@@ -177,7 +177,7 @@ public function create(
}
}
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY,
$this->translator->translate('//devices-module.base.messages.uniqueAttribute.heading'),
$this->translator->translate('//devices-module.base.messages.uniqueAttribute.message'),
@@ -193,7 +193,7 @@ public function create(
],
]);
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY,
$this->translator->translate('//devices-module.base.messages.notCreated.heading'),
$this->translator->translate('//devices-module.base.messages.notCreated.message'),
@@ -210,7 +210,7 @@ public function create(
return $response->withStatus(StatusCodeInterface::STATUS_CREATED);
}
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY,
$this->translator->translate('//devices-module.base.messages.invalidType.heading'),
$this->translator->translate('//devices-module.base.messages.invalidType.message'),
@@ -223,8 +223,8 @@ public function create(
/**
* @throws Doctrine\DBAL\Exception
* @throws Exception
- * @throws JsonApiExceptions\IJsonApiException
- * @throws JsonApiExceptions\JsonApiErrorException
+ * @throws JsonApiExceptions\JsonApi
+ * @throws JsonApiExceptions\JsonApiError
*
* @Secured
* @Secured\Role(manager,administrator)
@@ -258,7 +258,7 @@ public function update(
// Commit all changes into database
$this->getOrmConnection()->commit();
- } catch (JsonApiExceptions\IJsonApiException $ex) {
+ } catch (JsonApiExceptions\JsonApi $ex) {
throw $ex;
} catch (Throwable $ex) {
// Log caught exception
@@ -271,7 +271,7 @@ public function update(
],
]);
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY,
$this->translator->translate('//devices-module.base.messages.notUpdated.heading'),
$this->translator->translate('//devices-module.base.messages.notUpdated.message'),
@@ -286,7 +286,7 @@ public function update(
return $this->buildResponse($request, $response, $property);
}
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY,
$this->translator->translate('//devices-module.base.messages.invalidType.heading'),
$this->translator->translate('//devices-module.base.messages.invalidType.message'),
@@ -298,8 +298,8 @@ public function update(
/**
* @throws Doctrine\DBAL\Exception
- * @throws JsonApiExceptions\IJsonApiException
- * @throws JsonApiExceptions\JsonApiErrorException
+ * @throws JsonApiExceptions\JsonApi
+ * @throws JsonApiExceptions\JsonApiError
*
* @Secured
* @Secured\Role(manager,administrator)
@@ -335,7 +335,7 @@ public function delete(
],
]);
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY,
$this->translator->translate('//devices-module.base.messages.notDeleted.heading'),
$this->translator->translate('//devices-module.base.messages.notDeleted.message'),
@@ -352,7 +352,7 @@ public function delete(
/**
* @throws Exception
- * @throws JsonApiExceptions\IJsonApiException
+ * @throws JsonApiExceptions\JsonApi
*/
public function readRelationship(
Message\ServerRequestInterface $request,
@@ -378,7 +378,7 @@ public function readRelationship(
}
/**
- * @throws JsonApiExceptions\IJsonApiException
+ * @throws JsonApiExceptions\JsonApi
*/
private function findProperty(
string $id,
@@ -393,14 +393,14 @@ private function findProperty(
$property = $this->connectorPropertiesRepository->findOneBy($findQuery);
if ($property === null) {
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_NOT_FOUND,
$this->translator->translate('//devices-module.base.messages.notFound.heading'),
$this->translator->translate('//devices-module.base.messages.notFound.message'),
);
}
} catch (Uuid\Exception\InvalidUuidStringException) {
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_NOT_FOUND,
$this->translator->translate('//devices-module.base.messages.notFound.heading'),
$this->translator->translate('//devices-module.base.messages.notFound.message'),
diff --git a/src/Controllers/ConnectorsV1.php b/src/Controllers/ConnectorsV1.php
index 304b9cdd..b7e0e341 100644
--- a/src/Controllers/ConnectorsV1.php
+++ b/src/Controllers/ConnectorsV1.php
@@ -46,8 +46,8 @@ class ConnectorsV1 extends BaseV1
{
public function __construct(
- private Models\Connectors\ConnectorsRepository $connectorsRepository,
- private Models\Connectors\ConnectorsManager $connectorsManager,
+ private readonly Models\Connectors\ConnectorsRepository $connectorsRepository,
+ private readonly Models\Connectors\ConnectorsManager $connectorsManager,
)
{
}
@@ -70,7 +70,7 @@ public function index(
/**
* @throws Exception
- * @throws JsonApiExceptions\IJsonApiException
+ * @throws JsonApiExceptions\JsonApi
*/
public function read(
Message\ServerRequestInterface $request,
@@ -85,8 +85,8 @@ public function read(
/**
* @throws Doctrine\DBAL\Exception
* @throws Exception
- * @throws JsonApiExceptions\IJsonApiException
- * @throws JsonApiExceptions\JsonApiErrorException
+ * @throws JsonApiExceptions\JsonApi
+ * @throws JsonApiExceptions\JsonApiError
*
* @Secured
* @Secured\Role(manager,administrator)
@@ -114,7 +114,7 @@ public function update(
// Commit all changes into database
$this->getOrmConnection()->commit();
- } catch (JsonApiExceptions\IJsonApiException $ex) {
+ } catch (JsonApiExceptions\JsonApi $ex) {
throw $ex;
} catch (Throwable $ex) {
// Log caught exception
@@ -127,7 +127,7 @@ public function update(
],
]);
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY,
$this->translator->translate('//devices-module.base.messages.notUpdated.heading'),
$this->translator->translate('//devices-module.base.messages.notUpdated.message'),
@@ -142,7 +142,7 @@ public function update(
return $this->buildResponse($request, $response, $connector);
}
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY,
$this->translator->translate('//devices-module.base.messages.invalidType.heading'),
$this->translator->translate('//devices-module.base.messages.invalidType.message'),
@@ -154,7 +154,7 @@ public function update(
/**
* @throws Exception
- * @throws JsonApiExceptions\IJsonApiException
+ * @throws JsonApiExceptions\JsonApi
*/
public function readRelationship(
Message\ServerRequestInterface $request,
@@ -177,7 +177,7 @@ public function readRelationship(
}
/**
- * @throws JsonApiExceptions\IJsonApiException
+ * @throws JsonApiExceptions\JsonApi
*/
protected function findConnector(string $id): Entities\Connectors\Connector
{
@@ -188,14 +188,14 @@ protected function findConnector(string $id): Entities\Connectors\Connector
$connector = $this->connectorsRepository->findOneBy($findQuery);
if ($connector === null) {
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_NOT_FOUND,
$this->translator->translate('//devices-module.base.messages.notFound.heading'),
$this->translator->translate('//devices-module.base.messages.notFound.message'),
);
}
} catch (Uuid\Exception\InvalidUuidStringException) {
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_NOT_FOUND,
$this->translator->translate('//devices-module.base.messages.notFound.heading'),
$this->translator->translate('//devices-module.base.messages.notFound.message'),
diff --git a/src/Controllers/DeviceAttributesV1.php b/src/Controllers/DeviceAttributesV1.php
index 51c2cd3a..78613026 100644
--- a/src/Controllers/DeviceAttributesV1.php
+++ b/src/Controllers/DeviceAttributesV1.php
@@ -45,15 +45,15 @@ final class DeviceAttributesV1 extends BaseV1
use Controllers\Finders\TDevice;
public function __construct(
- protected Models\Devices\DevicesRepository $devicesRepository,
- private Models\Devices\Attributes\AttributesRepository $deviceAttributesRepository,
+ protected readonly Models\Devices\DevicesRepository $devicesRepository,
+ private readonly Models\Devices\Attributes\AttributesRepository $deviceAttributesRepository,
)
{
}
/**
* @throws Exception
- * @throws JsonApiExceptions\IJsonApiException
+ * @throws JsonApiExceptions\JsonApi
*/
public function index(
Message\ServerRequestInterface $request,
@@ -74,7 +74,7 @@ public function index(
/**
* @throws Exception
- * @throws JsonApiExceptions\IJsonApiException
+ * @throws JsonApiExceptions\JsonApi
*/
public function read(
Message\ServerRequestInterface $request,
@@ -97,7 +97,7 @@ public function read(
}
}
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_NOT_FOUND,
$this->translator->translate('//devices-module.base.messages.notFound.heading'),
$this->translator->translate('//devices-module.base.messages.notFound.message'),
@@ -106,7 +106,7 @@ public function read(
/**
* @throws Exception
- * @throws JsonApiExceptions\IJsonApiException
+ * @throws JsonApiExceptions\JsonApi
*/
public function readRelationship(
Message\ServerRequestInterface $request,
@@ -132,7 +132,7 @@ public function readRelationship(
return $this->buildResponse($request, $response, $attribute->getDevice());
}
} else {
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_NOT_FOUND,
$this->translator->translate('//devices-module.base.messages.notFound.heading'),
$this->translator->translate('//devices-module.base.messages.notFound.message'),
diff --git a/src/Controllers/DeviceChildrenV1.php b/src/Controllers/DeviceChildrenV1.php
index 2f0aafea..c8e1bea1 100644
--- a/src/Controllers/DeviceChildrenV1.php
+++ b/src/Controllers/DeviceChildrenV1.php
@@ -41,14 +41,14 @@ final class DeviceChildrenV1 extends BaseV1
use Controllers\Finders\TDevice;
public function __construct(
- protected Models\Devices\DevicesRepository $devicesRepository,
+ protected readonly Models\Devices\DevicesRepository $devicesRepository,
)
{
}
/**
* @throws Exception
- * @throws JsonApiExceptions\IJsonApiException
+ * @throws JsonApiExceptions\JsonApi
*/
public function index(
Message\ServerRequestInterface $request,
diff --git a/src/Controllers/DeviceControlsV1.php b/src/Controllers/DeviceControlsV1.php
index e15457c1..093bf656 100644
--- a/src/Controllers/DeviceControlsV1.php
+++ b/src/Controllers/DeviceControlsV1.php
@@ -45,15 +45,15 @@ final class DeviceControlsV1 extends BaseV1
use Controllers\Finders\TDevice;
public function __construct(
- protected Models\Devices\DevicesRepository $devicesRepository,
- private Models\Devices\Controls\ControlsRepository $deviceControlsRepository,
+ protected readonly Models\Devices\DevicesRepository $devicesRepository,
+ private readonly Models\Devices\Controls\ControlsRepository $deviceControlsRepository,
)
{
}
/**
* @throws Exception
- * @throws JsonApiExceptions\IJsonApiException
+ * @throws JsonApiExceptions\JsonApi
*/
public function index(
Message\ServerRequestInterface $request,
@@ -74,7 +74,7 @@ public function index(
/**
* @throws Exception
- * @throws JsonApiExceptions\IJsonApiException
+ * @throws JsonApiExceptions\JsonApi
*/
public function read(
Message\ServerRequestInterface $request,
@@ -97,7 +97,7 @@ public function read(
}
}
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_NOT_FOUND,
$this->translator->translate('//devices-module.base.messages.notFound.heading'),
$this->translator->translate('//devices-module.base.messages.notFound.message'),
@@ -106,7 +106,7 @@ public function read(
/**
* @throws Exception
- * @throws JsonApiExceptions\IJsonApiException
+ * @throws JsonApiExceptions\JsonApi
*/
public function readRelationship(
Message\ServerRequestInterface $request,
@@ -132,7 +132,7 @@ public function readRelationship(
return $this->buildResponse($request, $response, $control->getDevice());
}
} else {
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_NOT_FOUND,
$this->translator->translate('//devices-module.base.messages.notFound.heading'),
$this->translator->translate('//devices-module.base.messages.notFound.message'),
diff --git a/src/Controllers/DeviceParentsV1.php b/src/Controllers/DeviceParentsV1.php
index 171880a8..347870b2 100644
--- a/src/Controllers/DeviceParentsV1.php
+++ b/src/Controllers/DeviceParentsV1.php
@@ -41,14 +41,14 @@ final class DeviceParentsV1 extends BaseV1
use Controllers\Finders\TDevice;
public function __construct(
- protected Models\Devices\DevicesRepository $devicesRepository,
+ protected readonly Models\Devices\DevicesRepository $devicesRepository,
)
{
}
/**
* @throws Exception
- * @throws JsonApiExceptions\IJsonApiException
+ * @throws JsonApiExceptions\JsonApi
*/
public function index(
Message\ServerRequestInterface $request,
diff --git a/src/Controllers/DevicePropertiesV1.php b/src/Controllers/DevicePropertiesV1.php
index 8e2979e0..1199bc21 100644
--- a/src/Controllers/DevicePropertiesV1.php
+++ b/src/Controllers/DevicePropertiesV1.php
@@ -54,16 +54,16 @@ final class DevicePropertiesV1 extends BaseV1
use Controllers\Finders\TDeviceProperty;
public function __construct(
- protected Models\Devices\DevicesRepository $devicesRepository,
- private Models\Devices\Properties\PropertiesRepository $devicePropertiesRepository,
- protected Models\Devices\Properties\PropertiesManager $devicePropertiesManager,
+ protected readonly Models\Devices\DevicesRepository $devicesRepository,
+ private readonly Models\Devices\Properties\PropertiesRepository $devicePropertiesRepository,
+ protected readonly Models\Devices\Properties\PropertiesManager $devicePropertiesManager,
)
{
}
/**
* @throws Exception
- * @throws JsonApiExceptions\IJsonApiException
+ * @throws JsonApiExceptions\JsonApi
*/
public function index(
Message\ServerRequestInterface $request,
@@ -84,7 +84,7 @@ public function index(
/**
* @throws Exception
- * @throws JsonApiExceptions\IJsonApiException
+ * @throws JsonApiExceptions\JsonApi
*/
public function read(
Message\ServerRequestInterface $request,
@@ -102,8 +102,8 @@ public function read(
/**
* @throws Doctrine\DBAL\Exception
* @throws Exception
- * @throws JsonApiExceptions\IJsonApiException
- * @throws JsonApiExceptions\JsonApiErrorException
+ * @throws JsonApiExceptions\JsonApi
+ * @throws JsonApiExceptions\JsonApiError
*
* @Secured
* @Secured\Role(manager,administrator)
@@ -130,10 +130,10 @@ public function create(
// Commit all changes into database
$this->getOrmConnection()->commit();
- } catch (JsonApiExceptions\IJsonApiException $ex) {
+ } catch (JsonApiExceptions\JsonApi $ex) {
throw $ex;
} catch (DoctrineCrudExceptions\MissingRequiredFieldException $ex) {
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY,
$this->translator->translate('//devices-module.base.messages.missingAttribute.heading'),
$this->translator->translate('//devices-module.base.messages.missingAttribute.message'),
@@ -142,7 +142,7 @@ public function create(
],
);
} catch (DoctrineCrudExceptions\EntityCreationException $ex) {
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY,
$this->translator->translate('//devices-module.base.messages.missingAttribute.heading'),
$this->translator->translate('//devices-module.base.messages.missingAttribute.message'),
@@ -152,7 +152,7 @@ public function create(
);
} catch (Doctrine\DBAL\Exception\UniqueConstraintViolationException $ex) {
if (preg_match("%PRIMARY'%", $ex->getMessage(), $match) === 1) {
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY,
$this->translator->translate('//devices-module.base.messages.uniqueIdentifier.heading'),
$this->translator->translate('//devices-module.base.messages.uniqueIdentifier.message'),
@@ -165,7 +165,7 @@ public function create(
$columnKey = end($columnParts);
if (is_string($columnKey) && Utils\Strings::startsWith($columnKey, 'property_')) {
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY,
$this->translator->translate('//devices-module.base.messages.uniqueAttribute.heading'),
$this->translator->translate('//devices-module.base.messages.uniqueAttribute.message'),
@@ -176,7 +176,7 @@ public function create(
}
}
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY,
$this->translator->translate('//devices-module.base.messages.uniqueAttribute.heading'),
$this->translator->translate('//devices-module.base.messages.uniqueAttribute.message'),
@@ -192,7 +192,7 @@ public function create(
],
]);
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY,
$this->translator->translate('//devices-module.base.messages.notCreated.heading'),
$this->translator->translate('//devices-module.base.messages.notCreated.message'),
@@ -209,7 +209,7 @@ public function create(
return $response->withStatus(StatusCodeInterface::STATUS_CREATED);
}
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY,
$this->translator->translate('//devices-module.base.messages.invalidType.heading'),
$this->translator->translate('//devices-module.base.messages.invalidType.message'),
@@ -222,8 +222,8 @@ public function create(
/**
* @throws Doctrine\DBAL\Exception
* @throws Exception
- * @throws JsonApiExceptions\IJsonApiException
- * @throws JsonApiExceptions\JsonApiErrorException
+ * @throws JsonApiExceptions\JsonApi
+ * @throws JsonApiExceptions\JsonApiError
*
* @Secured
* @Secured\Role(manager,administrator)
@@ -254,7 +254,7 @@ public function update(
// Commit all changes into database
$this->getOrmConnection()->commit();
- } catch (JsonApiExceptions\IJsonApiException $ex) {
+ } catch (JsonApiExceptions\JsonApi $ex) {
throw $ex;
} catch (Throwable $ex) {
// Log caught exception
@@ -267,7 +267,7 @@ public function update(
],
]);
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY,
$this->translator->translate('//devices-module.base.messages.notUpdated.heading'),
$this->translator->translate('//devices-module.base.messages.notUpdated.message'),
@@ -282,7 +282,7 @@ public function update(
return $this->buildResponse($request, $response, $property);
}
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY,
$this->translator->translate('//devices-module.base.messages.invalidType.heading'),
$this->translator->translate('//devices-module.base.messages.invalidType.message'),
@@ -294,8 +294,8 @@ public function update(
/**
* @throws Doctrine\DBAL\Exception
- * @throws JsonApiExceptions\IJsonApiException
- * @throws JsonApiExceptions\JsonApiErrorException
+ * @throws JsonApiExceptions\JsonApi
+ * @throws JsonApiExceptions\JsonApiError
*
* @Secured
* @Secured\Role(manager,administrator)
@@ -331,7 +331,7 @@ public function delete(
],
]);
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY,
$this->translator->translate('//devices-module.base.messages.notDeleted.heading'),
$this->translator->translate('//devices-module.base.messages.notDeleted.message'),
@@ -348,7 +348,7 @@ public function delete(
/**
* @throws Exception
- * @throws JsonApiExceptions\IJsonApiException
+ * @throws JsonApiExceptions\JsonApi
*/
public function readRelationship(
Message\ServerRequestInterface $request,
diff --git a/src/Controllers/DevicePropertyChildrenV1.php b/src/Controllers/DevicePropertyChildrenV1.php
index d5eceb5f..417f83e5 100644
--- a/src/Controllers/DevicePropertyChildrenV1.php
+++ b/src/Controllers/DevicePropertyChildrenV1.php
@@ -42,15 +42,15 @@ final class DevicePropertyChildrenV1 extends BaseV1
use Controllers\Finders\TDeviceProperty;
public function __construct(
- protected Models\Devices\DevicesRepository $devicesRepository,
- private Models\Devices\Properties\PropertiesRepository $devicePropertiesRepository,
+ protected readonly Models\Devices\DevicesRepository $devicesRepository,
+ private readonly Models\Devices\Properties\PropertiesRepository $devicePropertiesRepository,
)
{
}
/**
* @throws Exception
- * @throws JsonApiExceptions\IJsonApiException
+ * @throws JsonApiExceptions\JsonApi
*/
public function index(
Message\ServerRequestInterface $request,
diff --git a/src/Controllers/DevicesV1.php b/src/Controllers/DevicesV1.php
index f72da093..84e5a97a 100644
--- a/src/Controllers/DevicesV1.php
+++ b/src/Controllers/DevicesV1.php
@@ -52,10 +52,10 @@ class DevicesV1 extends BaseV1
use Controllers\Finders\TDevice;
public function __construct(
- protected Models\Devices\DevicesRepository $devicesRepository,
- protected Models\Devices\DevicesManager $devicesManager,
- protected Models\Channels\ChannelsRepository $channelsRepository,
- protected Models\Channels\ChannelsManager $channelsManager,
+ protected readonly Models\Devices\DevicesRepository $devicesRepository,
+ protected readonly Models\Devices\DevicesManager $devicesManager,
+ protected readonly Models\Channels\ChannelsRepository $channelsRepository,
+ protected readonly Models\Channels\ChannelsManager $channelsManager,
)
{
}
@@ -78,7 +78,7 @@ public function index(
/**
* @throws Exception
- * @throws JsonApiExceptions\IJsonApiException
+ * @throws JsonApiExceptions\JsonApi
*/
public function read(
Message\ServerRequestInterface $request,
@@ -93,8 +93,8 @@ public function read(
/**
* @throws Doctrine\DBAL\Exception
* @throws Exception
- * @throws JsonApiExceptions\IJsonApiException
- * @throws JsonApiExceptions\JsonApiErrorException
+ * @throws JsonApiExceptions\JsonApi
+ * @throws JsonApiExceptions\JsonApiError
*
* @Secured
* @Secured\Role(manager,administrator)
@@ -118,10 +118,10 @@ public function create(
// Commit all changes into database
$this->getOrmConnection()->commit();
- } catch (JsonApiExceptions\IJsonApiException $ex) {
+ } catch (JsonApiExceptions\JsonApi $ex) {
throw $ex;
} catch (DoctrineCrudExceptions\MissingRequiredFieldException $ex) {
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY,
$this->translator->translate('//devices-module.base.messages.missingAttribute.heading'),
$this->translator->translate('//devices-module.base.messages.missingAttribute.message'),
@@ -130,7 +130,7 @@ public function create(
],
);
} catch (DoctrineCrudExceptions\EntityCreationException $ex) {
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY,
$this->translator->translate('//devices-module.base.messages.missingAttribute.heading'),
$this->translator->translate('//devices-module.base.messages.missingAttribute.message'),
@@ -140,7 +140,7 @@ public function create(
);
} catch (Doctrine\DBAL\Exception\UniqueConstraintViolationException $ex) {
if (preg_match("%PRIMARY'%", $ex->getMessage(), $match) === 1) {
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY,
$this->translator->translate('//devices-module.base.messages.uniqueIdentifier.heading'),
$this->translator->translate('//devices-module.base.messages.uniqueIdentifier.message'),
@@ -153,7 +153,7 @@ public function create(
$columnKey = end($columnParts);
if (is_string($columnKey) && Utils\Strings::startsWith($columnKey, 'device_')) {
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY,
$this->translator->translate('//devices-module.base.messages.uniqueAttribute.heading'),
$this->translator->translate('//devices-module.base.messages.uniqueAttribute.message'),
@@ -164,7 +164,7 @@ public function create(
}
}
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY,
$this->translator->translate('//devices-module.base.messages.uniqueAttribute.heading'),
$this->translator->translate('//devices-module.base.messages.uniqueAttribute.message'),
@@ -180,7 +180,7 @@ public function create(
],
]);
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY,
$this->translator->translate('//devices-module.base.messages.notCreated.heading'),
$this->translator->translate('//devices-module.base.messages.notCreated.message'),
@@ -197,7 +197,7 @@ public function create(
return $response->withStatus(StatusCodeInterface::STATUS_CREATED);
}
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY,
$this->translator->translate('//devices-module.base.messages.invalidType.heading'),
$this->translator->translate('//devices-module.base.messages.invalidType.message'),
@@ -210,8 +210,8 @@ public function create(
/**
* @throws Doctrine\DBAL\Exception
* @throws Exception
- * @throws JsonApiExceptions\IJsonApiException
- * @throws JsonApiExceptions\JsonApiErrorException
+ * @throws JsonApiExceptions\JsonApi
+ * @throws JsonApiExceptions\JsonApiError
*
* @Secured
* @Secured\Role(manager,administrator)
@@ -239,7 +239,7 @@ public function update(
// Commit all changes into database
$this->getOrmConnection()->commit();
- } catch (JsonApiExceptions\IJsonApiException $ex) {
+ } catch (JsonApiExceptions\JsonApi $ex) {
throw $ex;
} catch (Doctrine\DBAL\Exception\UniqueConstraintViolationException $ex) {
if (preg_match("%key '(?P.+)_unique'%", $ex->getMessage(), $match) !== false) {
@@ -247,7 +247,7 @@ public function update(
$columnKey = end($columnParts);
if (is_string($columnKey) && Utils\Strings::startsWith($columnKey, 'device_')) {
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY,
$this->translator->translate('//devices-module.base.messages.uniqueAttribute.heading'),
$this->translator->translate('//devices-module.base.messages.uniqueAttribute.message'),
@@ -258,7 +258,7 @@ public function update(
}
}
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY,
$this->translator->translate('//devices-module.base.messages.uniqueAttribute.heading'),
$this->translator->translate('//devices-module.base.messages.uniqueAttribute.message'),
@@ -274,7 +274,7 @@ public function update(
],
]);
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY,
$this->translator->translate('//devices-module.base.messages.notUpdated.heading'),
$this->translator->translate('//devices-module.base.messages.notUpdated.message'),
@@ -289,7 +289,7 @@ public function update(
return $this->buildResponse($request, $response, $device);
}
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY,
$this->translator->translate('//devices-module.base.messages.invalidType.heading'),
$this->translator->translate('//devices-module.base.messages.invalidType.message'),
@@ -301,8 +301,8 @@ public function update(
/**
* @throws Doctrine\DBAL\Exception
- * @throws JsonApiExceptions\IJsonApiException
- * @throws JsonApiExceptions\JsonApiErrorException
+ * @throws JsonApiExceptions\JsonApi
+ * @throws JsonApiExceptions\JsonApiError
*
* @Secured
* @Secured\Role(manager,administrator)
@@ -340,7 +340,7 @@ public function delete(
],
]);
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY,
$this->translator->translate('//devices-module.base.messages.notDeleted.heading'),
$this->translator->translate('//devices-module.base.messages.notDeleted.message'),
@@ -356,8 +356,8 @@ public function delete(
}
/**
- * @throws Exception
- * @throws JsonApiExceptions\IJsonApiException
+ * @throws JsonApiExceptions\JsonApi
+ * @throws Throwable
*/
public function readRelationship(
Message\ServerRequestInterface $request,
diff --git a/src/Controllers/Finders/TChannel.php b/src/Controllers/Finders/TChannel.php
index 2501d89a..9463894e 100644
--- a/src/Controllers/Finders/TChannel.php
+++ b/src/Controllers/Finders/TChannel.php
@@ -31,7 +31,7 @@ trait TChannel
{
/**
- * @throws JsonApiExceptions\IJsonApiException
+ * @throws JsonApiExceptions\JsonApi
*/
protected function findChannel(
string $id,
@@ -46,14 +46,14 @@ protected function findChannel(
$channel = $this->channelsRepository->findOneBy($findQuery);
if ($channel === null) {
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_NOT_FOUND,
$this->translator->translate('//devices-module.base.messages.notFound.heading'),
$this->translator->translate('//devices-module.base.messages.notFound.message'),
);
}
} catch (Uuid\Exception\InvalidUuidStringException) {
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_NOT_FOUND,
$this->translator->translate('//devices-module.base.messages.notFound.heading'),
$this->translator->translate('//devices-module.base.messages.notFound.message'),
diff --git a/src/Controllers/Finders/TChannelProperty.php b/src/Controllers/Finders/TChannelProperty.php
index c7a2bfe3..e69868f1 100644
--- a/src/Controllers/Finders/TChannelProperty.php
+++ b/src/Controllers/Finders/TChannelProperty.php
@@ -31,7 +31,7 @@ trait TChannelProperty
{
/**
- * @throws JsonApiExceptions\IJsonApiException
+ * @throws JsonApiExceptions\JsonApi
*/
private function findProperty(
string $id,
@@ -46,14 +46,14 @@ private function findProperty(
$property = $this->channelPropertiesRepository->findOneBy($findQuery);
if ($property === null) {
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_NOT_FOUND,
$this->translator->translate('//devices-module.base.messages.notFound.heading'),
$this->translator->translate('//devices-module.base.messages.notFound.message'),
);
}
} catch (Uuid\Exception\InvalidUuidStringException) {
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_NOT_FOUND,
$this->translator->translate('//devices-module.base.messages.notFound.heading'),
$this->translator->translate('//devices-module.base.messages.notFound.message'),
diff --git a/src/Controllers/Finders/TConnector.php b/src/Controllers/Finders/TConnector.php
index 3b865a22..3bf5d30d 100644
--- a/src/Controllers/Finders/TConnector.php
+++ b/src/Controllers/Finders/TConnector.php
@@ -31,7 +31,7 @@ trait TConnector
{
/**
- * @throws JsonApiExceptions\IJsonApiException
+ * @throws JsonApiExceptions\JsonApi
*/
protected function findConnector(string $id): Entities\Connectors\Connector
{
@@ -42,14 +42,14 @@ protected function findConnector(string $id): Entities\Connectors\Connector
$connector = $this->connectorsRepository->findOneBy($findQuery);
if ($connector === null) {
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_NOT_FOUND,
$this->translator->translate('//devices-module.base.messages.notFound.heading'),
$this->translator->translate('//devices-module.base.messages.notFound.message'),
);
}
} catch (Uuid\Exception\InvalidUuidStringException) {
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_NOT_FOUND,
$this->translator->translate('//devices-module.base.messages.notFound.heading'),
$this->translator->translate('//devices-module.base.messages.notFound.message'),
diff --git a/src/Controllers/Finders/TDevice.php b/src/Controllers/Finders/TDevice.php
index ec5f3b15..d9cea8d4 100644
--- a/src/Controllers/Finders/TDevice.php
+++ b/src/Controllers/Finders/TDevice.php
@@ -31,7 +31,7 @@ trait TDevice
{
/**
- * @throws JsonApiExceptions\IJsonApiException
+ * @throws JsonApiExceptions\JsonApi
*/
protected function findDevice(string $id): Entities\Devices\Device
{
@@ -42,14 +42,14 @@ protected function findDevice(string $id): Entities\Devices\Device
$device = $this->devicesRepository->findOneBy($findQuery);
if ($device === null) {
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_NOT_FOUND,
$this->translator->translate('//devices-module.base.messages.notFound.heading'),
$this->translator->translate('//devices-module.base.messages.notFound.message'),
);
}
} catch (Uuid\Exception\InvalidUuidStringException) {
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_NOT_FOUND,
$this->translator->translate('//devices-module.base.messages.notFound.heading'),
$this->translator->translate('//devices-module.base.messages.notFound.message'),
diff --git a/src/Controllers/Finders/TDeviceProperty.php b/src/Controllers/Finders/TDeviceProperty.php
index e659d7ad..dc0d3625 100644
--- a/src/Controllers/Finders/TDeviceProperty.php
+++ b/src/Controllers/Finders/TDeviceProperty.php
@@ -31,7 +31,7 @@ trait TDeviceProperty
{
/**
- * @throws JsonApiExceptions\IJsonApiException
+ * @throws JsonApiExceptions\JsonApi
*/
private function findProperty(
string $id,
@@ -46,14 +46,14 @@ private function findProperty(
$property = $this->devicePropertiesRepository->findOneBy($findQuery);
if ($property === null) {
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_NOT_FOUND,
$this->translator->translate('//devices-module.base.messages.notFound.heading'),
$this->translator->translate('//devices-module.base.messages.notFound.message'),
);
}
} catch (Uuid\Exception\InvalidUuidStringException) {
- throw new JsonApiExceptions\JsonApiErrorException(
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_NOT_FOUND,
$this->translator->translate('//devices-module.base.messages.notFound.heading'),
$this->translator->translate('//devices-module.base.messages.notFound.message'),
diff --git a/src/DI/DevicesModuleExtension.php b/src/DI/DevicesModuleExtension.php
index c1a75a81..942f0240 100644
--- a/src/DI/DevicesModuleExtension.php
+++ b/src/DI/DevicesModuleExtension.php
@@ -281,7 +281,10 @@ public function loadConfiguration(): void
)
->setType(Schemas\Devices\Properties\Dynamic::class);
- $builder->addDefinition($this->prefix('schemas.device.property.static'), new DI\Definitions\ServiceDefinition())
+ $builder->addDefinition(
+ $this->prefix('schemas.device.property.variable'),
+ new DI\Definitions\ServiceDefinition(),
+ )
->setType(Schemas\Devices\Properties\Variable::class);
$builder->addDefinition($this->prefix('schemas.device.property.mapped'), new DI\Definitions\ServiceDefinition())
@@ -303,7 +306,7 @@ public function loadConfiguration(): void
->setType(Schemas\Channels\Properties\Dynamic::class);
$builder->addDefinition(
- $this->prefix('schemas.channel.property.static'),
+ $this->prefix('schemas.channel.property.variable'),
new DI\Definitions\ServiceDefinition(),
)
->setType(Schemas\Channels\Properties\Variable::class);
@@ -327,7 +330,7 @@ public function loadConfiguration(): void
->setType(Schemas\Connectors\Properties\Dynamic::class);
$builder->addDefinition(
- $this->prefix('schemas.connector.property.static'),
+ $this->prefix('schemas.connector.property.variable'),
new DI\Definitions\ServiceDefinition(),
)
->setType(Schemas\Connectors\Properties\Variable::class);
@@ -346,7 +349,7 @@ public function loadConfiguration(): void
->setType(Hydrators\Properties\DeviceDynamic::class);
$builder->addDefinition(
- $this->prefix('hydrators.device.property.static'),
+ $this->prefix('hydrators.device.property.variable'),
new DI\Definitions\ServiceDefinition(),
)
->setType(Hydrators\Properties\DeviceVariable::class);
@@ -367,7 +370,7 @@ public function loadConfiguration(): void
->setType(Hydrators\Properties\ChannelDynamic::class);
$builder->addDefinition(
- $this->prefix('hydrators.channel.property.static'),
+ $this->prefix('hydrators.channel.property.variable'),
new DI\Definitions\ServiceDefinition(),
)
->setType(Hydrators\Properties\ChannelVariable::class);
@@ -388,7 +391,7 @@ public function loadConfiguration(): void
->setType(Hydrators\Properties\ConnectorDynamic::class);
$builder->addDefinition(
- $this->prefix('hydrators.connector.property.static'),
+ $this->prefix('hydrators.connector.property.variable'),
new DI\Definitions\ServiceDefinition(),
)
->setType(Hydrators\Properties\ConnectorVariable::class);
diff --git a/src/DataStorage/Reader.php b/src/DataStorage/Reader.php
index c3a18fce..7aee73bf 100644
--- a/src/DataStorage/Reader.php
+++ b/src/DataStorage/Reader.php
@@ -41,18 +41,18 @@ final class Reader
use Nette\SmartObject;
public function __construct(
- private Models\DataStorage\ConnectorsRepository $connectorsRepository,
- private Models\DataStorage\ConnectorPropertiesRepository $connectorPropertiesRepository,
- private Models\DataStorage\ConnectorControlsRepository $connectorControlsRepository,
- private Models\DataStorage\DevicesRepository $devicesRepository,
- private Models\DataStorage\DevicePropertiesRepository $devicePropertiesRepository,
- private Models\DataStorage\DeviceControlsRepository $deviceControlsRepository,
- private Models\DataStorage\DeviceAttributesRepository $deviceAttributesRepository,
- private Models\DataStorage\ChannelsRepository $channelsRepository,
- private Models\DataStorage\ChannelPropertiesRepository $channelPropertiesRepository,
- private Models\DataStorage\ChannelControlsRepository $channelControlsRepository,
- private Flysystem\Filesystem $filesystem,
- private EventDispatcher\EventDispatcherInterface|null $dispatcher,
+ private readonly Models\DataStorage\ConnectorsRepository $connectorsRepository,
+ private readonly Models\DataStorage\ConnectorPropertiesRepository $connectorPropertiesRepository,
+ private readonly Models\DataStorage\ConnectorControlsRepository $connectorControlsRepository,
+ private readonly Models\DataStorage\DevicesRepository $devicesRepository,
+ private readonly Models\DataStorage\DevicePropertiesRepository $devicePropertiesRepository,
+ private readonly Models\DataStorage\DeviceControlsRepository $deviceControlsRepository,
+ private readonly Models\DataStorage\DeviceAttributesRepository $deviceAttributesRepository,
+ private readonly Models\DataStorage\ChannelsRepository $channelsRepository,
+ private readonly Models\DataStorage\ChannelPropertiesRepository $channelPropertiesRepository,
+ private readonly Models\DataStorage\ChannelControlsRepository $channelControlsRepository,
+ private readonly Flysystem\Filesystem $filesystem,
+ private readonly EventDispatcher\EventDispatcherInterface|null $dispatcher,
)
{
}
diff --git a/src/DataStorage/Writer.php b/src/DataStorage/Writer.php
index c649ba4e..0e709d2f 100644
--- a/src/DataStorage/Writer.php
+++ b/src/DataStorage/Writer.php
@@ -23,6 +23,7 @@
use Nette;
use Nette\Utils;
use Psr\EventDispatcher;
+use Throwable;
use function array_merge;
/**
@@ -39,19 +40,19 @@ final class Writer
use Nette\SmartObject;
public function __construct(
- private Models\Connectors\ConnectorsRepository $connectorsRepository,
- private Models\Connectors\Properties\PropertiesRepository $connectorsPropertiesRepository,
- private Models\Connectors\Controls\ControlsRepository $connectorsControlsRepository,
- private Models\Devices\DevicesRepository $devicesRepository,
- private Models\Devices\Properties\PropertiesRepository $devicesPropertiesRepository,
- private Models\Devices\Controls\ControlsRepository $devicesControlsRepository,
- private Models\Devices\Attributes\AttributesRepository $devicesAttributesRepository,
- private Models\Channels\ChannelsRepository $channelsRepository,
- private Models\Channels\Properties\PropertiesRepository $channelsPropertiesRepository,
- private Models\Channels\Controls\ControlsRepository $channelsControlsRepository,
- private Reader $reader,
- private Flysystem\Filesystem $filesystem,
- private EventDispatcher\EventDispatcherInterface|null $dispatcher,
+ private readonly Models\Connectors\ConnectorsRepository $connectorsRepository,
+ private readonly Models\Connectors\Properties\PropertiesRepository $connectorsPropertiesRepository,
+ private readonly Models\Connectors\Controls\ControlsRepository $connectorsControlsRepository,
+ private readonly Models\Devices\DevicesRepository $devicesRepository,
+ private readonly Models\Devices\Properties\PropertiesRepository $devicesPropertiesRepository,
+ private readonly Models\Devices\Controls\ControlsRepository $devicesControlsRepository,
+ private readonly Models\Devices\Attributes\AttributesRepository $devicesAttributesRepository,
+ private readonly Models\Channels\ChannelsRepository $channelsRepository,
+ private readonly Models\Channels\Properties\PropertiesRepository $channelsPropertiesRepository,
+ private readonly Models\Channels\Controls\ControlsRepository $channelsControlsRepository,
+ private readonly Reader $reader,
+ private readonly Flysystem\Filesystem $filesystem,
+ private readonly EventDispatcher\EventDispatcherInterface|null $dispatcher,
)
{
}
@@ -59,6 +60,7 @@ public function __construct(
/**
* @throws Flysystem\FilesystemException
* @throws Utils\JsonException
+ * @throws Throwable
*/
public function write(): void
{
diff --git a/src/Entities/Channels/Properties/Dynamic.php b/src/Entities/Channels/Properties/Dynamic.php
index 8b85facf..4b59bcb5 100644
--- a/src/Entities/Channels/Properties/Dynamic.php
+++ b/src/Entities/Channels/Properties/Dynamic.php
@@ -24,9 +24,9 @@
class Dynamic extends Property
{
- public function getType(): MetadataTypes\PropertyTypeType
+ public function getType(): MetadataTypes\PropertyType
{
- return MetadataTypes\PropertyTypeType::get(MetadataTypes\PropertyTypeType::TYPE_DYNAMIC);
+ return MetadataTypes\PropertyType::get(MetadataTypes\PropertyType::TYPE_DYNAMIC);
}
}
diff --git a/src/Entities/Channels/Properties/Mapped.php b/src/Entities/Channels/Properties/Mapped.php
index 4764d994..d6c9dacc 100644
--- a/src/Entities/Channels/Properties/Mapped.php
+++ b/src/Entities/Channels/Properties/Mapped.php
@@ -45,9 +45,9 @@ public function __construct(
$this->parent = $parent;
}
- public function getType(): MetadataTypes\PropertyTypeType
+ public function getType(): MetadataTypes\PropertyType
{
- return MetadataTypes\PropertyTypeType::get(MetadataTypes\PropertyTypeType::TYPE_MAPPED);
+ return MetadataTypes\PropertyType::get(MetadataTypes\PropertyType::TYPE_MAPPED);
}
public function getParent(): Property
diff --git a/src/Entities/Channels/Properties/Property.php b/src/Entities/Channels/Properties/Property.php
index d6d75ad7..123b0127 100644
--- a/src/Entities/Channels/Properties/Property.php
+++ b/src/Entities/Channels/Properties/Property.php
@@ -163,7 +163,7 @@ public function isSettable(): bool
{
if (
$this->getParent() !== null && !$this->getType()
- ->equalsValue(MetadataTypes\PropertyTypeType::TYPE_MAPPED)
+ ->equalsValue(MetadataTypes\PropertyType::TYPE_MAPPED)
) {
return $this->getParent()->isSettable();
}
@@ -175,7 +175,7 @@ public function setSettable(bool $settable): void
{
if (
$this->getParent() !== null && !$this->getType()
- ->equalsValue(MetadataTypes\PropertyTypeType::TYPE_MAPPED)
+ ->equalsValue(MetadataTypes\PropertyType::TYPE_MAPPED)
) {
throw new Exceptions\InvalidState('Settable setter is allowed only for parent');
}
@@ -187,7 +187,7 @@ public function isQueryable(): bool
{
if (
$this->getParent() !== null && !$this->getType()
- ->equalsValue(MetadataTypes\PropertyTypeType::TYPE_MAPPED)
+ ->equalsValue(MetadataTypes\PropertyType::TYPE_MAPPED)
) {
return $this->getParent()->isQueryable();
}
@@ -199,7 +199,7 @@ public function setQueryable(bool $queryable): void
{
if (
$this->getParent() !== null && !$this->getType()
- ->equalsValue(MetadataTypes\PropertyTypeType::TYPE_MAPPED)
+ ->equalsValue(MetadataTypes\PropertyType::TYPE_MAPPED)
) {
throw new Exceptions\InvalidState('Queryable setter is allowed only for parent');
}
@@ -207,11 +207,11 @@ public function setQueryable(bool $queryable): void
parent::setQueryable($queryable);
}
- public function getDataType(): MetadataTypes\DataTypeType
+ public function getDataType(): MetadataTypes\DataType
{
if (
$this->getParent() !== null && !$this->getType()
- ->equalsValue(MetadataTypes\PropertyTypeType::TYPE_MAPPED)
+ ->equalsValue(MetadataTypes\PropertyType::TYPE_MAPPED)
) {
return $this->getParent()->getDataType();
}
@@ -219,11 +219,11 @@ public function getDataType(): MetadataTypes\DataTypeType
return parent::getDataType();
}
- public function setDataType(MetadataTypes\DataTypeType $dataType): void
+ public function setDataType(MetadataTypes\DataType $dataType): void
{
if (
$this->getParent() !== null && !$this->getType()
- ->equalsValue(MetadataTypes\PropertyTypeType::TYPE_MAPPED)
+ ->equalsValue(MetadataTypes\PropertyType::TYPE_MAPPED)
) {
throw new Exceptions\InvalidState('Data type setter is allowed only for parent');
}
@@ -235,7 +235,7 @@ public function getUnit(): string|null
{
if (
$this->getParent() !== null && !$this->getType()
- ->equalsValue(MetadataTypes\PropertyTypeType::TYPE_MAPPED)
+ ->equalsValue(MetadataTypes\PropertyType::TYPE_MAPPED)
) {
return $this->getParent()->getUnit();
}
@@ -247,7 +247,7 @@ public function setUnit(string|null $unit): void
{
if (
$this->getParent() !== null && !$this->getType()
- ->equalsValue(MetadataTypes\PropertyTypeType::TYPE_MAPPED)
+ ->equalsValue(MetadataTypes\PropertyType::TYPE_MAPPED)
) {
throw new Exceptions\InvalidState('Value unit setter is allowed only for parent');
}
@@ -258,7 +258,7 @@ public function setUnit(string|null $unit): void
public function getFormat(): MetadataValueObjects\StringEnumFormat|MetadataValueObjects\NumberRangeFormat|MetadataValueObjects\CombinedEnumFormat|null
{
if (
- $this->getParent() !== null && !$this->getType()->equalsValue(MetadataTypes\PropertyTypeType::TYPE_MAPPED)
+ $this->getParent() !== null && !$this->getType()->equalsValue(MetadataTypes\PropertyType::TYPE_MAPPED)
) {
return $this->getParent()->getFormat();
}
@@ -270,7 +270,7 @@ public function setFormat(array|string|null $format): void
{
if (
$this->getParent() !== null && !$this->getType()
- ->equalsValue(MetadataTypes\PropertyTypeType::TYPE_MAPPED)
+ ->equalsValue(MetadataTypes\PropertyType::TYPE_MAPPED)
) {
throw new Exceptions\InvalidState('Value format setter is allowed only for parent');
}
@@ -282,7 +282,7 @@ public function getInvalid(): float|int|string|null
{
if (
$this->getParent() !== null && !$this->getType()
- ->equalsValue(MetadataTypes\PropertyTypeType::TYPE_MAPPED)
+ ->equalsValue(MetadataTypes\PropertyType::TYPE_MAPPED)
) {
return $this->getParent()->getInvalid();
}
@@ -294,7 +294,7 @@ public function setInvalid(string|null $invalid): void
{
if (
$this->getParent() !== null && !$this->getType()
- ->equalsValue(MetadataTypes\PropertyTypeType::TYPE_MAPPED)
+ ->equalsValue(MetadataTypes\PropertyType::TYPE_MAPPED)
) {
throw new Exceptions\InvalidState('Invalid value setter is allowed only for parent');
}
@@ -306,7 +306,7 @@ public function getNumberOfDecimals(): int|null
{
if (
$this->getParent() !== null && !$this->getType()
- ->equalsValue(MetadataTypes\PropertyTypeType::TYPE_MAPPED)
+ ->equalsValue(MetadataTypes\PropertyType::TYPE_MAPPED)
) {
return $this->getParent()->getNumberOfDecimals();
}
@@ -318,7 +318,7 @@ public function setNumberOfDecimals(int|null $numberOfDecimals): void
{
if (
$this->getParent() !== null && !$this->getType()
- ->equalsValue(MetadataTypes\PropertyTypeType::TYPE_MAPPED)
+ ->equalsValue(MetadataTypes\PropertyType::TYPE_MAPPED)
) {
throw new Exceptions\InvalidState('Number of decimals setter is allowed only for parent');
}
@@ -326,11 +326,11 @@ public function setNumberOfDecimals(int|null $numberOfDecimals): void
parent::setNumberOfDecimals($numberOfDecimals);
}
- public function getDefault(): bool|float|int|string|DateTimeInterface|MetadataTypes\ButtonPayloadType|MetadataTypes\SwitchPayloadType|null
+ public function getDefault(): bool|float|int|string|DateTimeInterface|MetadataTypes\ButtonPayload|MetadataTypes\SwitchPayload|null
{
if (
$this->getParent() !== null && !$this->getType()
- ->equalsValue(MetadataTypes\PropertyTypeType::TYPE_MAPPED)
+ ->equalsValue(MetadataTypes\PropertyType::TYPE_MAPPED)
) {
return $this->getParent()->getDefault();
}
@@ -342,7 +342,7 @@ public function setDefault(string|null $default): void
{
if (
$this->getParent() !== null && !$this->getType()
- ->equalsValue(MetadataTypes\PropertyTypeType::TYPE_MAPPED)
+ ->equalsValue(MetadataTypes\PropertyType::TYPE_MAPPED)
) {
throw new Exceptions\InvalidState('Default value setter is allowed only for parent');
}
diff --git a/src/Entities/Channels/Properties/Variable.php b/src/Entities/Channels/Properties/Variable.php
index 7fe6caa5..f407c059 100644
--- a/src/Entities/Channels/Properties/Variable.php
+++ b/src/Entities/Channels/Properties/Variable.php
@@ -26,12 +26,12 @@
class Variable extends Property
{
- public function getType(): MetadataTypes\PropertyTypeType
+ public function getType(): MetadataTypes\PropertyType
{
- return MetadataTypes\PropertyTypeType::get(MetadataTypes\PropertyTypeType::TYPE_STATIC);
+ return MetadataTypes\PropertyType::get(MetadataTypes\PropertyType::TYPE_VARIABLE);
}
- public function getValue(): bool|float|int|string|DateTimeInterface|MetadataTypes\ButtonPayloadType|MetadataTypes\SwitchPayloadType|null
+ public function getValue(): bool|float|int|string|DateTimeInterface|MetadataTypes\ButtonPayload|MetadataTypes\SwitchPayload|null
{
if ($this->getParent() !== null) {
return $this->getParent()->getValue();
diff --git a/src/Entities/Connectors/Connector.php b/src/Entities/Connectors/Connector.php
index 456d15ae..6d0340cc 100644
--- a/src/Entities/Connectors/Connector.php
+++ b/src/Entities/Connectors/Connector.php
@@ -52,14 +52,14 @@
*/
abstract class Connector implements Entities\Entity,
Entities\EntityParams,
- SimpleAuthEntities\IEntityOwner,
+ SimpleAuthEntities\Owner,
DoctrineTimestampable\Entities\IEntityCreated, DoctrineTimestampable\Entities\IEntityUpdated,
DoctrineDynamicDiscriminatorMapEntities\IDiscriminatorProvider
{
use Entities\TEntity;
use Entities\TEntityParams;
- use SimpleAuthEntities\TEntityOwner;
+ use SimpleAuthEntities\TOwner;
use DoctrineTimestampable\Entities\TEntityCreated;
use DoctrineTimestampable\Entities\TEntityUpdated;
diff --git a/src/Entities/Connectors/Properties/Dynamic.php b/src/Entities/Connectors/Properties/Dynamic.php
index 25414d77..88ada660 100644
--- a/src/Entities/Connectors/Properties/Dynamic.php
+++ b/src/Entities/Connectors/Properties/Dynamic.php
@@ -24,9 +24,9 @@
class Dynamic extends Property
{
- public function getType(): MetadataTypes\PropertyTypeType
+ public function getType(): MetadataTypes\PropertyType
{
- return MetadataTypes\PropertyTypeType::get(MetadataTypes\PropertyTypeType::TYPE_DYNAMIC);
+ return MetadataTypes\PropertyType::get(MetadataTypes\PropertyType::TYPE_DYNAMIC);
}
}
diff --git a/src/Entities/Connectors/Properties/Variable.php b/src/Entities/Connectors/Properties/Variable.php
index 5c21ea01..9a0682d5 100644
--- a/src/Entities/Connectors/Properties/Variable.php
+++ b/src/Entities/Connectors/Properties/Variable.php
@@ -24,9 +24,9 @@
class Variable extends Property
{
- public function getType(): MetadataTypes\PropertyTypeType
+ public function getType(): MetadataTypes\PropertyType
{
- return MetadataTypes\PropertyTypeType::get(MetadataTypes\PropertyTypeType::TYPE_STATIC);
+ return MetadataTypes\PropertyType::get(MetadataTypes\PropertyType::TYPE_VARIABLE);
}
}
diff --git a/src/Entities/Devices/Attributes/Attribute.php b/src/Entities/Devices/Attributes/Attribute.php
index cc279714..174c642b 100644
--- a/src/Entities/Devices/Attributes/Attribute.php
+++ b/src/Entities/Devices/Attributes/Attribute.php
@@ -121,35 +121,35 @@ public function setName(string|null $name): void
public function getContent(
bool $plain = false,
- ): string|MetadataTypes\HardwareManufacturerType|MetadataTypes\FirmwareManufacturerType|MetadataTypes\DeviceModelType|null
+ ): string|MetadataTypes\HardwareManufacturer|MetadataTypes\FirmwareManufacturer|MetadataTypes\DeviceModel|null
{
- if ($this->getIdentifier() === MetadataTypes\DeviceAttributeIdentifierType::IDENTIFIER_HARDWARE_MANUFACTURER) {
- if ($this->content !== null && MetadataTypes\HardwareManufacturerType::isValidValue($this->content)) {
- return MetadataTypes\HardwareManufacturerType::get($this->content);
+ if ($this->getIdentifier() === MetadataTypes\DeviceAttributeIdentifier::IDENTIFIER_HARDWARE_MANUFACTURER) {
+ if ($this->content !== null && MetadataTypes\HardwareManufacturer::isValidValue($this->content)) {
+ return MetadataTypes\HardwareManufacturer::get($this->content);
}
if ($this->content !== null && $plain) {
return $this->content;
}
- return MetadataTypes\HardwareManufacturerType::get(
- MetadataTypes\HardwareManufacturerType::MANUFACTURER_GENERIC,
+ return MetadataTypes\HardwareManufacturer::get(
+ MetadataTypes\HardwareManufacturer::MANUFACTURER_GENERIC,
);
}
- if ($this->getIdentifier() === MetadataTypes\DeviceAttributeIdentifierType::IDENTIFIER_HARDWARE_MODEL) {
- if ($this->content !== null && MetadataTypes\DeviceModelType::isValidValue($this->content)) {
- return MetadataTypes\DeviceModelType::get($this->content);
+ if ($this->getIdentifier() === MetadataTypes\DeviceAttributeIdentifier::IDENTIFIER_HARDWARE_MODEL) {
+ if ($this->content !== null && MetadataTypes\DeviceModel::isValidValue($this->content)) {
+ return MetadataTypes\DeviceModel::get($this->content);
}
if ($this->content !== null && $plain) {
return $this->content;
}
- return MetadataTypes\DeviceModelType::get(MetadataTypes\DeviceModelType::MODEL_CUSTOM);
+ return MetadataTypes\DeviceModel::get(MetadataTypes\DeviceModel::MODEL_CUSTOM);
}
- if ($this->getIdentifier() === MetadataTypes\DeviceAttributeIdentifierType::IDENTIFIER_HARDWARE_MAC_ADDRESS) {
+ if ($this->getIdentifier() === MetadataTypes\DeviceAttributeIdentifier::IDENTIFIER_HARDWARE_MAC_ADDRESS) {
if (
$this->content !== null
&& (
@@ -166,17 +166,17 @@ public function getContent(
return null;
}
- if ($this->getIdentifier() === MetadataTypes\DeviceAttributeIdentifierType::IDENTIFIER_FIRMWARE_MANUFACTURER) {
- if ($this->content !== null && MetadataTypes\FirmwareManufacturerType::isValidValue($this->content)) {
- return MetadataTypes\FirmwareManufacturerType::get($this->content);
+ if ($this->getIdentifier() === MetadataTypes\DeviceAttributeIdentifier::IDENTIFIER_FIRMWARE_MANUFACTURER) {
+ if ($this->content !== null && MetadataTypes\FirmwareManufacturer::isValidValue($this->content)) {
+ return MetadataTypes\FirmwareManufacturer::get($this->content);
}
if ($this->content !== null && $plain) {
return $this->content;
}
- return MetadataTypes\FirmwareManufacturerType::get(
- MetadataTypes\FirmwareManufacturerType::MANUFACTURER_GENERIC,
+ return MetadataTypes\FirmwareManufacturer::get(
+ MetadataTypes\FirmwareManufacturer::MANUFACTURER_GENERIC,
);
}
@@ -184,22 +184,22 @@ public function getContent(
}
public function setContent(
- string|MetadataTypes\HardwareManufacturerType|MetadataTypes\FirmwareManufacturerType|MetadataTypes\DeviceModelType|null $content,
+ string|MetadataTypes\HardwareManufacturer|MetadataTypes\FirmwareManufacturer|MetadataTypes\DeviceModel|null $content,
): void
{
- if ($this->getIdentifier() === MetadataTypes\DeviceAttributeIdentifierType::IDENTIFIER_HARDWARE_MANUFACTURER) {
- if ($content instanceof MetadataTypes\HardwareManufacturerType) {
+ if ($this->getIdentifier() === MetadataTypes\DeviceAttributeIdentifier::IDENTIFIER_HARDWARE_MANUFACTURER) {
+ if ($content instanceof MetadataTypes\HardwareManufacturer) {
$this->content = strval($content->getValue());
} else {
$this->content = $content !== null ? Utils\Strings::lower((string) $content) : null;
}
- } elseif ($this->getIdentifier() === MetadataTypes\DeviceAttributeIdentifierType::IDENTIFIER_HARDWARE_MODEL) {
- if ($content instanceof MetadataTypes\DeviceModelType) {
+ } elseif ($this->getIdentifier() === MetadataTypes\DeviceAttributeIdentifier::IDENTIFIER_HARDWARE_MODEL) {
+ if ($content instanceof MetadataTypes\DeviceModel) {
$this->content = strval($content->getValue());
} else {
$this->content = $content !== null ? Utils\Strings::lower((string) $content) : null;
}
- } elseif ($this->getIdentifier() === MetadataTypes\DeviceAttributeIdentifierType::IDENTIFIER_HARDWARE_MAC_ADDRESS) {
+ } elseif ($this->getIdentifier() === MetadataTypes\DeviceAttributeIdentifier::IDENTIFIER_HARDWARE_MAC_ADDRESS) {
if (
$content !== null
&& preg_match('/^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/', (string) $content) === 0
@@ -212,8 +212,8 @@ public function setContent(
':',
'-',
], '', (string) $content)) : null;
- } elseif ($this->getIdentifier() === MetadataTypes\DeviceAttributeIdentifierType::IDENTIFIER_FIRMWARE_MANUFACTURER) {
- if ($content instanceof MetadataTypes\FirmwareManufacturerType) {
+ } elseif ($this->getIdentifier() === MetadataTypes\DeviceAttributeIdentifier::IDENTIFIER_FIRMWARE_MANUFACTURER) {
+ if ($content instanceof MetadataTypes\FirmwareManufacturer) {
$this->content = strval($content->getValue());
} else {
$this->content = $content !== null ? Utils\Strings::lower((string) $content) : null;
diff --git a/src/Entities/Devices/Device.php b/src/Entities/Devices/Device.php
index d20978e9..59da0ddd 100644
--- a/src/Entities/Devices/Device.php
+++ b/src/Entities/Devices/Device.php
@@ -52,14 +52,14 @@
*/
abstract class Device implements Entities\Entity,
Entities\EntityParams,
- SimpleAuthEntities\IEntityOwner,
+ SimpleAuthEntities\Owner,
DoctrineTimestampable\Entities\IEntityCreated, DoctrineTimestampable\Entities\IEntityUpdated,
DoctrineDynamicDiscriminatorMapEntities\IDiscriminatorProvider
{
use Entities\TEntity;
use Entities\TEntityParams;
- use SimpleAuthEntities\TEntityOwner;
+ use SimpleAuthEntities\TOwner;
use DoctrineTimestampable\Entities\TEntityCreated;
use DoctrineTimestampable\Entities\TEntityUpdated;
diff --git a/src/Entities/Devices/Properties/Dynamic.php b/src/Entities/Devices/Properties/Dynamic.php
index 7fee98f8..6ae1c94a 100644
--- a/src/Entities/Devices/Properties/Dynamic.php
+++ b/src/Entities/Devices/Properties/Dynamic.php
@@ -24,9 +24,9 @@
class Dynamic extends Property
{
- public function getType(): MetadataTypes\PropertyTypeType
+ public function getType(): MetadataTypes\PropertyType
{
- return MetadataTypes\PropertyTypeType::get(MetadataTypes\PropertyTypeType::TYPE_DYNAMIC);
+ return MetadataTypes\PropertyType::get(MetadataTypes\PropertyType::TYPE_DYNAMIC);
}
}
diff --git a/src/Entities/Devices/Properties/Mapped.php b/src/Entities/Devices/Properties/Mapped.php
index b0281d02..a2629b1b 100644
--- a/src/Entities/Devices/Properties/Mapped.php
+++ b/src/Entities/Devices/Properties/Mapped.php
@@ -45,9 +45,9 @@ public function __construct(
$this->parent = $parent;
}
- public function getType(): MetadataTypes\PropertyTypeType
+ public function getType(): MetadataTypes\PropertyType
{
- return MetadataTypes\PropertyTypeType::get(MetadataTypes\PropertyTypeType::TYPE_MAPPED);
+ return MetadataTypes\PropertyType::get(MetadataTypes\PropertyType::TYPE_MAPPED);
}
public function getParent(): Property
diff --git a/src/Entities/Devices/Properties/Property.php b/src/Entities/Devices/Properties/Property.php
index 73720665..8427b626 100644
--- a/src/Entities/Devices/Properties/Property.php
+++ b/src/Entities/Devices/Properties/Property.php
@@ -162,7 +162,7 @@ public function isSettable(): bool
{
if (
$this->getParent() !== null && !$this->getType()
- ->equalsValue(MetadataTypes\PropertyTypeType::TYPE_MAPPED)
+ ->equalsValue(MetadataTypes\PropertyType::TYPE_MAPPED)
) {
return $this->getParent()->isSettable();
}
@@ -173,7 +173,7 @@ public function isSettable(): bool
public function setSettable(bool $settable): void
{
if (
- $this->getParent() !== null && !$this->getType()->equalsValue(MetadataTypes\PropertyTypeType::TYPE_MAPPED)
+ $this->getParent() !== null && !$this->getType()->equalsValue(MetadataTypes\PropertyType::TYPE_MAPPED)
) {
throw new Exceptions\InvalidState('Settable setter is allowed only for parent');
}
@@ -185,7 +185,7 @@ public function isQueryable(): bool
{
if (
$this->getParent() !== null && !$this->getType()
- ->equalsValue(MetadataTypes\PropertyTypeType::TYPE_MAPPED)
+ ->equalsValue(MetadataTypes\PropertyType::TYPE_MAPPED)
) {
return $this->getParent()->isQueryable();
}
@@ -197,7 +197,7 @@ public function setQueryable(bool $queryable): void
{
if (
$this->getParent() !== null && !$this->getType()
- ->equalsValue(MetadataTypes\PropertyTypeType::TYPE_MAPPED)
+ ->equalsValue(MetadataTypes\PropertyType::TYPE_MAPPED)
) {
throw new Exceptions\InvalidState('Queryable setter is allowed only for parent');
}
@@ -205,11 +205,11 @@ public function setQueryable(bool $queryable): void
parent::setQueryable($queryable);
}
- public function getDataType(): MetadataTypes\DataTypeType
+ public function getDataType(): MetadataTypes\DataType
{
if (
$this->getParent() !== null && !$this->getType()
- ->equalsValue(MetadataTypes\PropertyTypeType::TYPE_MAPPED)
+ ->equalsValue(MetadataTypes\PropertyType::TYPE_MAPPED)
) {
return $this->getParent()->getDataType();
}
@@ -217,11 +217,11 @@ public function getDataType(): MetadataTypes\DataTypeType
return parent::getDataType();
}
- public function setDataType(MetadataTypes\DataTypeType $dataType): void
+ public function setDataType(MetadataTypes\DataType $dataType): void
{
if (
$this->getParent() !== null && !$this->getType()
- ->equalsValue(MetadataTypes\PropertyTypeType::TYPE_MAPPED)
+ ->equalsValue(MetadataTypes\PropertyType::TYPE_MAPPED)
) {
throw new Exceptions\InvalidState('Data type setter is allowed only for parent');
}
@@ -233,7 +233,7 @@ public function getUnit(): string|null
{
if (
$this->getParent() !== null && !$this->getType()
- ->equalsValue(MetadataTypes\PropertyTypeType::TYPE_MAPPED)
+ ->equalsValue(MetadataTypes\PropertyType::TYPE_MAPPED)
) {
return $this->getParent()->getUnit();
}
@@ -245,7 +245,7 @@ public function setUnit(string|null $unit): void
{
if (
$this->getParent() !== null && !$this->getType()
- ->equalsValue(MetadataTypes\PropertyTypeType::TYPE_MAPPED)
+ ->equalsValue(MetadataTypes\PropertyType::TYPE_MAPPED)
) {
throw new Exceptions\InvalidState('Value unit setter is allowed only for parent');
}
@@ -257,7 +257,7 @@ public function getFormat(): MetadataValueObjects\StringEnumFormat|MetadataValue
{
if (
$this->getParent() !== null && !$this->getType()
- ->equalsValue(MetadataTypes\PropertyTypeType::TYPE_MAPPED)
+ ->equalsValue(MetadataTypes\PropertyType::TYPE_MAPPED)
) {
return $this->getParent()->getFormat();
}
@@ -269,7 +269,7 @@ public function setFormat(array|string|null $format): void
{
if (
$this->getParent() !== null && !$this->getType()
- ->equalsValue(MetadataTypes\PropertyTypeType::TYPE_MAPPED)
+ ->equalsValue(MetadataTypes\PropertyType::TYPE_MAPPED)
) {
throw new Exceptions\InvalidState('Value format setter is allowed only for parent');
}
@@ -281,7 +281,7 @@ public function getInvalid(): float|int|string|null
{
if (
$this->getParent() !== null && !$this->getType()
- ->equalsValue(MetadataTypes\PropertyTypeType::TYPE_MAPPED)
+ ->equalsValue(MetadataTypes\PropertyType::TYPE_MAPPED)
) {
return $this->getParent()->getInvalid();
}
@@ -293,7 +293,7 @@ public function setInvalid(string|null $invalid): void
{
if (
$this->getParent() !== null && !$this->getType()
- ->equalsValue(MetadataTypes\PropertyTypeType::TYPE_MAPPED)
+ ->equalsValue(MetadataTypes\PropertyType::TYPE_MAPPED)
) {
throw new Exceptions\InvalidState('Invalid value setter is allowed only for parent');
}
@@ -305,7 +305,7 @@ public function getNumberOfDecimals(): int|null
{
if (
$this->getParent() !== null && !$this->getType()
- ->equalsValue(MetadataTypes\PropertyTypeType::TYPE_MAPPED)
+ ->equalsValue(MetadataTypes\PropertyType::TYPE_MAPPED)
) {
return $this->getParent()->getNumberOfDecimals();
}
@@ -317,7 +317,7 @@ public function setNumberOfDecimals(int|null $numberOfDecimals): void
{
if (
$this->getParent() !== null && !$this->getType()
- ->equalsValue(MetadataTypes\PropertyTypeType::TYPE_MAPPED)
+ ->equalsValue(MetadataTypes\PropertyType::TYPE_MAPPED)
) {
throw new Exceptions\InvalidState('Number of decimals setter is allowed only for parent');
}
@@ -325,11 +325,11 @@ public function setNumberOfDecimals(int|null $numberOfDecimals): void
parent::setNumberOfDecimals($numberOfDecimals);
}
- public function getDefault(): bool|float|int|string|DateTimeInterface|MetadataTypes\ButtonPayloadType|MetadataTypes\SwitchPayloadType|null
+ public function getDefault(): bool|float|int|string|DateTimeInterface|MetadataTypes\ButtonPayload|MetadataTypes\SwitchPayload|null
{
if (
$this->getParent() !== null && !$this->getType()
- ->equalsValue(MetadataTypes\PropertyTypeType::TYPE_MAPPED)
+ ->equalsValue(MetadataTypes\PropertyType::TYPE_MAPPED)
) {
return $this->getParent()->getDefault();
}
@@ -341,7 +341,7 @@ public function setDefault(string|null $default): void
{
if (
$this->getParent() !== null && !$this->getType()
- ->equalsValue(MetadataTypes\PropertyTypeType::TYPE_MAPPED)
+ ->equalsValue(MetadataTypes\PropertyType::TYPE_MAPPED)
) {
throw new Exceptions\InvalidState('Default value setter is allowed only for parent');
}
diff --git a/src/Entities/Devices/Properties/Variable.php b/src/Entities/Devices/Properties/Variable.php
index 59b2207a..230733d9 100644
--- a/src/Entities/Devices/Properties/Variable.php
+++ b/src/Entities/Devices/Properties/Variable.php
@@ -26,12 +26,12 @@
class Variable extends Property
{
- public function getType(): MetadataTypes\PropertyTypeType
+ public function getType(): MetadataTypes\PropertyType
{
- return MetadataTypes\PropertyTypeType::get(MetadataTypes\PropertyTypeType::TYPE_STATIC);
+ return MetadataTypes\PropertyType::get(MetadataTypes\PropertyType::TYPE_VARIABLE);
}
- public function getValue(): bool|float|int|string|DateTimeInterface|MetadataTypes\ButtonPayloadType|MetadataTypes\SwitchPayloadType|null
+ public function getValue(): bool|float|int|string|DateTimeInterface|MetadataTypes\ButtonPayload|MetadataTypes\SwitchPayload|null
{
if ($this->getParent() !== null) {
return $this->getParent()->getValue();
diff --git a/src/Entities/Entity.php b/src/Entities/Entity.php
index 570db97e..deff5183 100644
--- a/src/Entities/Entity.php
+++ b/src/Entities/Entity.php
@@ -39,6 +39,6 @@ public function getPlainId(): string;
*/
public function toArray(): array;
- public function getSource(): MetadataTypes\ModuleSourceType|MetadataTypes\PluginSourceType|MetadataTypes\ConnectorSourceType;
+ public function getSource(): MetadataTypes\ModuleSource|MetadataTypes\PluginSource|MetadataTypes\ConnectorSource;
}
diff --git a/src/Entities/Property.php b/src/Entities/Property.php
index 804c97dc..e977ac16 100644
--- a/src/Entities/Property.php
+++ b/src/Entities/Property.php
@@ -83,11 +83,11 @@ abstract class Property implements Entity,
protected bool $queryable = false;
/**
- * @var MetadataTypes\DataTypeType
+ * @var MetadataTypes\DataType
*
* @phpcsSuppress SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingNativeTypeHint
*
- * @Enum(class=MetadataTypes\DataTypeType::class)
+ * @Enum(class=MetadataTypes\DataType::class)
* @IPubDoctrine\Crud(is="writable")
* @ORM\Column(type="string_enum", name="property_data_type", length=100, nullable=true, options={"default": "unknown"})
*/
@@ -141,16 +141,16 @@ public function __construct(
$this->identifier = $identifier;
- $this->dataType = MetadataTypes\DataTypeType::get(MetadataTypes\DataTypeType::DATA_TYPE_UNKNOWN);
+ $this->dataType = MetadataTypes\DataType::get(MetadataTypes\DataType::DATA_TYPE_UNKNOWN);
// Static property can not be set or read from device/channel property
- if ($this->getType()->equalsValue(MetadataTypes\PropertyTypeType::TYPE_STATIC)) {
+ if ($this->getType()->equalsValue(MetadataTypes\PropertyType::TYPE_VARIABLE)) {
$this->settable = false;
$this->queryable = false;
}
}
- abstract public function getType(): MetadataTypes\PropertyTypeType;
+ abstract public function getType(): MetadataTypes\PropertyType;
public function getIdentifier(): string
{
@@ -174,8 +174,8 @@ public function isSettable(): bool
public function setSettable(bool $settable): void
{
- if ($settable && $this->getType()->equalsValue(MetadataTypes\PropertyTypeType::TYPE_STATIC)) {
- throw new Exceptions\InvalidArgument('Static type property can not be settable');
+ if ($settable && $this->getType()->equalsValue(MetadataTypes\PropertyType::TYPE_VARIABLE)) {
+ throw new Exceptions\InvalidArgument('Variable type property can not be settable');
}
$this->settable = $settable;
@@ -188,19 +188,19 @@ public function isQueryable(): bool
public function setQueryable(bool $queryable): void
{
- if ($queryable && $this->getType()->equalsValue(MetadataTypes\PropertyTypeType::TYPE_STATIC)) {
- throw new Exceptions\InvalidArgument('Static type property can not be queryable');
+ if ($queryable && $this->getType()->equalsValue(MetadataTypes\PropertyType::TYPE_VARIABLE)) {
+ throw new Exceptions\InvalidArgument('Variable type property can not be queryable');
}
$this->queryable = $queryable;
}
- public function getDataType(): MetadataTypes\DataTypeType
+ public function getDataType(): MetadataTypes\DataType
{
return $this->dataType;
}
- public function setDataType(MetadataTypes\DataTypeType $dataType): void
+ public function setDataType(MetadataTypes\DataType $dataType): void
{
$this->dataType = $dataType;
}
@@ -236,13 +236,13 @@ public function setFormat(array|string|null $format): void
} elseif (is_array($format)) {
if (
in_array($this->dataType->getValue(), [
- MetadataTypes\DataTypeType::DATA_TYPE_CHAR,
- MetadataTypes\DataTypeType::DATA_TYPE_UCHAR,
- MetadataTypes\DataTypeType::DATA_TYPE_SHORT,
- MetadataTypes\DataTypeType::DATA_TYPE_USHORT,
- MetadataTypes\DataTypeType::DATA_TYPE_INT,
- MetadataTypes\DataTypeType::DATA_TYPE_UINT,
- MetadataTypes\DataTypeType::DATA_TYPE_FLOAT,
+ MetadataTypes\DataType::DATA_TYPE_CHAR,
+ MetadataTypes\DataType::DATA_TYPE_UCHAR,
+ MetadataTypes\DataType::DATA_TYPE_SHORT,
+ MetadataTypes\DataType::DATA_TYPE_USHORT,
+ MetadataTypes\DataType::DATA_TYPE_INT,
+ MetadataTypes\DataType::DATA_TYPE_UINT,
+ MetadataTypes\DataType::DATA_TYPE_FLOAT,
], true)
) {
$plainFormat = implode(':', array_map(static function ($item): string {
@@ -268,9 +268,9 @@ public function setFormat(array|string|null $format): void
throw new Exceptions\InvalidArgument('Provided property format is not valid');
} elseif (
in_array($this->dataType->getValue(), [
- MetadataTypes\DataTypeType::DATA_TYPE_ENUM,
- MetadataTypes\DataTypeType::DATA_TYPE_BUTTON,
- MetadataTypes\DataTypeType::DATA_TYPE_SWITCH,
+ MetadataTypes\DataType::DATA_TYPE_ENUM,
+ MetadataTypes\DataType::DATA_TYPE_BUTTON,
+ MetadataTypes\DataType::DATA_TYPE_SWITCH,
], true)
) {
$plainFormat = implode(',', array_map(static function ($item): string {
@@ -316,19 +316,19 @@ public function getInvalid(): float|int|string|null
}
if (
- $this->dataType->equalsValue(MetadataTypes\DataTypeType::DATA_TYPE_CHAR)
- || $this->dataType->equalsValue(MetadataTypes\DataTypeType::DATA_TYPE_UCHAR)
- || $this->dataType->equalsValue(MetadataTypes\DataTypeType::DATA_TYPE_SHORT)
- || $this->dataType->equalsValue(MetadataTypes\DataTypeType::DATA_TYPE_USHORT)
- || $this->dataType->equalsValue(MetadataTypes\DataTypeType::DATA_TYPE_INT)
- || $this->dataType->equalsValue(MetadataTypes\DataTypeType::DATA_TYPE_UINT)
+ $this->dataType->equalsValue(MetadataTypes\DataType::DATA_TYPE_CHAR)
+ || $this->dataType->equalsValue(MetadataTypes\DataType::DATA_TYPE_UCHAR)
+ || $this->dataType->equalsValue(MetadataTypes\DataType::DATA_TYPE_SHORT)
+ || $this->dataType->equalsValue(MetadataTypes\DataType::DATA_TYPE_USHORT)
+ || $this->dataType->equalsValue(MetadataTypes\DataType::DATA_TYPE_INT)
+ || $this->dataType->equalsValue(MetadataTypes\DataType::DATA_TYPE_UINT)
) {
if (is_numeric($this->invalid)) {
return intval($this->invalid);
}
return null;
- } elseif ($this->dataType->equalsValue(MetadataTypes\DataTypeType::DATA_TYPE_FLOAT)) {
+ } elseif ($this->dataType->equalsValue(MetadataTypes\DataType::DATA_TYPE_FLOAT)) {
if (is_numeric($this->invalid)) {
return floatval($this->invalid);
}
@@ -354,9 +354,9 @@ public function setNumberOfDecimals(int|null $numberOfDecimals): void
$this->numberOfDecimals = $numberOfDecimals;
}
- public function getValue(): bool|float|int|string|DateTimeInterface|MetadataTypes\ButtonPayloadType|MetadataTypes\SwitchPayloadType|null
+ public function getValue(): bool|float|int|string|DateTimeInterface|MetadataTypes\ButtonPayload|MetadataTypes\SwitchPayload|null
{
- if (!$this->getType()->equalsValue(MetadataTypes\PropertyTypeType::TYPE_STATIC)) {
+ if (!$this->getType()->equalsValue(MetadataTypes\PropertyType::TYPE_VARIABLE)) {
throw new Exceptions\InvalidState(
sprintf('Value is not allowed for property type: %s', strval($this->getType()->getValue())),
);
@@ -376,7 +376,7 @@ public function getValue(): bool|float|int|string|DateTimeInterface|MetadataType
public function setValue(string|null $value): void
{
- if (!$this->getType()->equalsValue(MetadataTypes\PropertyTypeType::TYPE_STATIC)) {
+ if (!$this->getType()->equalsValue(MetadataTypes\PropertyType::TYPE_VARIABLE)) {
throw new Exceptions\InvalidState(
sprintf('Value is not allowed for property type: %s', strval($this->getType()->getValue())),
);
@@ -385,9 +385,9 @@ public function setValue(string|null $value): void
$this->value = $value;
}
- public function getDefault(): bool|float|int|string|DateTimeInterface|MetadataTypes\ButtonPayloadType|MetadataTypes\SwitchPayloadType|null
+ public function getDefault(): bool|float|int|string|DateTimeInterface|MetadataTypes\ButtonPayload|MetadataTypes\SwitchPayload|null
{
- if (!$this->getType()->equalsValue(MetadataTypes\PropertyTypeType::TYPE_STATIC)) {
+ if (!$this->getType()->equalsValue(MetadataTypes\PropertyType::TYPE_VARIABLE)) {
throw new Exceptions\InvalidState(
sprintf('Value is not allowed for property type: %s', strval($this->getType()->getValue())),
);
@@ -407,7 +407,7 @@ public function getDefault(): bool|float|int|string|DateTimeInterface|MetadataTy
public function setDefault(string|null $default): void
{
- if (!$this->getType()->equalsValue(MetadataTypes\PropertyTypeType::TYPE_STATIC)) {
+ if (!$this->getType()->equalsValue(MetadataTypes\PropertyType::TYPE_VARIABLE)) {
throw new Exceptions\InvalidState(
sprintf('Default value is not allowed for property type: %s', strval($this->getType()->getValue())),
);
@@ -435,7 +435,7 @@ public function toArray(): array
'number_of_decimals' => $this->getNumberOfDecimals(),
];
- if ($this->getType()->equalsValue(MetadataTypes\PropertyTypeType::TYPE_STATIC)) {
+ if ($this->getType()->equalsValue(MetadataTypes\PropertyType::TYPE_VARIABLE)) {
return array_merge($data, [
'default' => Utilities\ValueHelper::flattenValue($this->getDefault()),
'value' => Utilities\ValueHelper::flattenValue($this->getValue()),
@@ -455,13 +455,13 @@ private function buildFormat(
if (
in_array($this->dataType->getValue(), [
- MetadataTypes\DataTypeType::DATA_TYPE_CHAR,
- MetadataTypes\DataTypeType::DATA_TYPE_UCHAR,
- MetadataTypes\DataTypeType::DATA_TYPE_SHORT,
- MetadataTypes\DataTypeType::DATA_TYPE_USHORT,
- MetadataTypes\DataTypeType::DATA_TYPE_INT,
- MetadataTypes\DataTypeType::DATA_TYPE_UINT,
- MetadataTypes\DataTypeType::DATA_TYPE_FLOAT,
+ MetadataTypes\DataType::DATA_TYPE_CHAR,
+ MetadataTypes\DataType::DATA_TYPE_UCHAR,
+ MetadataTypes\DataType::DATA_TYPE_SHORT,
+ MetadataTypes\DataType::DATA_TYPE_USHORT,
+ MetadataTypes\DataType::DATA_TYPE_INT,
+ MetadataTypes\DataType::DATA_TYPE_UINT,
+ MetadataTypes\DataType::DATA_TYPE_FLOAT,
], true)
) {
if (preg_match(Metadata\Constants::VALUE_FORMAT_NUMBER_RANGE, $format) === 1) {
@@ -469,9 +469,9 @@ private function buildFormat(
}
} elseif (
in_array($this->dataType->getValue(), [
- MetadataTypes\DataTypeType::DATA_TYPE_ENUM,
- MetadataTypes\DataTypeType::DATA_TYPE_BUTTON,
- MetadataTypes\DataTypeType::DATA_TYPE_SWITCH,
+ MetadataTypes\DataType::DATA_TYPE_ENUM,
+ MetadataTypes\DataType::DATA_TYPE_BUTTON,
+ MetadataTypes\DataType::DATA_TYPE_SWITCH,
], true)
) {
if (preg_match(Metadata\Constants::VALUE_FORMAT_STRING_ENUM, $format) === 1) {
diff --git a/src/Entities/TEntity.php b/src/Entities/TEntity.php
index 72209b58..f3f88a79 100644
--- a/src/Entities/TEntity.php
+++ b/src/Entities/TEntity.php
@@ -41,9 +41,9 @@ public function getPlainId(): string
return $this->id->toString();
}
- public function getSource(): MetadataTypes\ModuleSourceType|MetadataTypes\PluginSourceType|MetadataTypes\ConnectorSourceType
+ public function getSource(): MetadataTypes\ModuleSource|MetadataTypes\PluginSource|MetadataTypes\ConnectorSource
{
- return MetadataTypes\ModuleSourceType::get(MetadataTypes\ModuleSourceType::SOURCE_MODULE_DEVICES);
+ return MetadataTypes\ModuleSource::get(MetadataTypes\ModuleSource::SOURCE_MODULE_DEVICES);
}
}
diff --git a/src/Events/AfterConnectorStart.php b/src/Events/AfterConnectorStart.php
index 4a2bf367..bd643cf5 100644
--- a/src/Events/AfterConnectorStart.php
+++ b/src/Events/AfterConnectorStart.php
@@ -30,12 +30,12 @@ class AfterConnectorStart extends EventDispatcher\Event
{
public function __construct(
- private MetadataEntities\Modules\DevicesModule\IConnectorEntity $connector,
+ private readonly MetadataEntities\DevicesModule\Connector $connector,
)
{
}
- public function getConnector(): MetadataEntities\Modules\DevicesModule\IConnectorEntity
+ public function getConnector(): MetadataEntities\DevicesModule\Connector
{
return $this->connector;
}
diff --git a/src/Events/AfterConnectorTerminate.php b/src/Events/AfterConnectorTerminate.php
index ec5b20fb..9bf92b17 100644
--- a/src/Events/AfterConnectorTerminate.php
+++ b/src/Events/AfterConnectorTerminate.php
@@ -29,7 +29,7 @@
class AfterConnectorTerminate extends EventDispatcher\Event
{
- public function __construct(private Connectors\Connector $connector)
+ public function __construct(private readonly Connectors\Connector $connector)
{
}
diff --git a/src/Events/BeforeConnectorStart.php b/src/Events/BeforeConnectorStart.php
index 2935b11f..08a8e26a 100644
--- a/src/Events/BeforeConnectorStart.php
+++ b/src/Events/BeforeConnectorStart.php
@@ -30,12 +30,12 @@ class BeforeConnectorStart extends EventDispatcher\Event
{
public function __construct(
- private MetadataEntities\Modules\DevicesModule\IConnectorEntity $connector,
+ private readonly MetadataEntities\DevicesModule\Connector $connector,
)
{
}
- public function getConnector(): MetadataEntities\Modules\DevicesModule\IConnectorEntity
+ public function getConnector(): MetadataEntities\DevicesModule\Connector
{
return $this->connector;
}
diff --git a/src/Events/BeforeConnectorTerminate.php b/src/Events/BeforeConnectorTerminate.php
index 6b583a8a..d6fbe462 100644
--- a/src/Events/BeforeConnectorTerminate.php
+++ b/src/Events/BeforeConnectorTerminate.php
@@ -29,7 +29,7 @@
class BeforeConnectorTerminate extends EventDispatcher\Event
{
- public function __construct(private Connectors\Connector $connector)
+ public function __construct(private readonly Connectors\Connector $connector)
{
}
diff --git a/src/Events/StateEntityCreated.php b/src/Events/StateEntityCreated.php
index 8b303639..061516eb 100644
--- a/src/Events/StateEntityCreated.php
+++ b/src/Events/StateEntityCreated.php
@@ -34,14 +34,14 @@ class StateEntityCreated extends EventDispatcher\Event
private States\DeviceProperty|States\ChannelProperty|States\ConnectorProperty $state;
public function __construct(
- private MetadataEntities\Modules\DevicesModule\IDynamicPropertyEntity|MetadataEntities\Modules\DevicesModule\IStaticPropertyEntity|MetadataEntities\Modules\DevicesModule\IMappedPropertyEntity|Entities\Property $property,
+ private readonly MetadataEntities\DevicesModule\DynamicProperty|MetadataEntities\DevicesModule\VariableProperty|MetadataEntities\DevicesModule\MappedProperty|Entities\Property $property,
States\ConnectorProperty|States\ChannelProperty|States\DeviceProperty $state,
)
{
$this->state = $state;
}
- public function getProperty(): MetadataEntities\Modules\DevicesModule\IDynamicPropertyEntity|MetadataEntities\Modules\DevicesModule\IStaticPropertyEntity|MetadataEntities\Modules\DevicesModule\IMappedPropertyEntity|Entities\Property
+ public function getProperty(): MetadataEntities\DevicesModule\DynamicProperty|MetadataEntities\DevicesModule\VariableProperty|MetadataEntities\DevicesModule\MappedProperty|Entities\Property
{
return $this->property;
}
diff --git a/src/Events/StateEntityDeleted.php b/src/Events/StateEntityDeleted.php
index f9a8481b..a38464e8 100644
--- a/src/Events/StateEntityDeleted.php
+++ b/src/Events/StateEntityDeleted.php
@@ -31,12 +31,12 @@ class StateEntityDeleted extends EventDispatcher\Event
{
public function __construct(
- private MetadataEntities\Modules\DevicesModule\IDynamicPropertyEntity|MetadataEntities\Modules\DevicesModule\IStaticPropertyEntity|MetadataEntities\Modules\DevicesModule\IMappedPropertyEntity|Entities\Property $property,
+ private readonly MetadataEntities\DevicesModule\DynamicProperty|MetadataEntities\DevicesModule\VariableProperty|MetadataEntities\DevicesModule\MappedProperty|Entities\Property $property,
)
{
}
- public function getProperty(): MetadataEntities\Modules\DevicesModule\IDynamicPropertyEntity|MetadataEntities\Modules\DevicesModule\IStaticPropertyEntity|MetadataEntities\Modules\DevicesModule\IMappedPropertyEntity|Entities\Property
+ public function getProperty(): MetadataEntities\DevicesModule\DynamicProperty|MetadataEntities\DevicesModule\VariableProperty|MetadataEntities\DevicesModule\MappedProperty|Entities\Property
{
return $this->property;
}
diff --git a/src/Events/StateEntityUpdated.php b/src/Events/StateEntityUpdated.php
index 74c0f842..250a9f71 100644
--- a/src/Events/StateEntityUpdated.php
+++ b/src/Events/StateEntityUpdated.php
@@ -36,7 +36,7 @@ class StateEntityUpdated extends EventDispatcher\Event
private States\DeviceProperty|States\ChannelProperty|States\ConnectorProperty $state;
public function __construct(
- private MetadataEntities\Modules\DevicesModule\IDynamicPropertyEntity|MetadataEntities\Modules\DevicesModule\IStaticPropertyEntity|MetadataEntities\Modules\DevicesModule\IMappedPropertyEntity|Entities\Property $property,
+ private readonly MetadataEntities\DevicesModule\DynamicProperty|MetadataEntities\DevicesModule\VariableProperty|MetadataEntities\DevicesModule\MappedProperty|Entities\Property $property,
States\ConnectorProperty|States\ChannelProperty|States\DeviceProperty $previousState,
States\ConnectorProperty|States\ChannelProperty|States\DeviceProperty $state,
)
@@ -45,7 +45,7 @@ public function __construct(
$this->state = $state;
}
- public function getProperty(): MetadataEntities\Modules\DevicesModule\IDynamicPropertyEntity|MetadataEntities\Modules\DevicesModule\IStaticPropertyEntity|MetadataEntities\Modules\DevicesModule\IMappedPropertyEntity|Entities\Property
+ public function getProperty(): MetadataEntities\DevicesModule\DynamicProperty|MetadataEntities\DevicesModule\VariableProperty|MetadataEntities\DevicesModule\MappedProperty|Entities\Property
{
return $this->property;
}
diff --git a/src/Hydrators/Properties/Property.php b/src/Hydrators/Properties/Property.php
index 3691a98f..a74eea87 100644
--- a/src/Hydrators/Properties/Property.php
+++ b/src/Hydrators/Properties/Property.php
@@ -80,17 +80,17 @@ protected function hydrateQueryableAttribute(JsonAPIDocument\Objects\IStandardOb
protected function hydrateDataTypeAttribute(
JsonAPIDocument\Objects\IStandardObject $attributes,
- ): MetadataTypes\DataTypeType|null
+ ): MetadataTypes\DataType|null
{
if (
!is_scalar($attributes->get('data_type'))
|| (string) $attributes->get('data_type') === ''
- || !MetadataTypes\DataTypeType::isValidValue((string) $attributes->get('data_type'))
+ || !MetadataTypes\DataType::isValidValue((string) $attributes->get('data_type'))
) {
return null;
}
- return MetadataTypes\DataTypeType::get((string) $attributes->get('data_type'));
+ return MetadataTypes\DataType::get((string) $attributes->get('data_type'));
}
protected function hydrateUnitAttribute(JsonAPIDocument\Objects\IStandardObject $attributes): string|null
@@ -113,14 +113,14 @@ protected function hydrateFormatAttribute(JsonAPIDocument\Objects\IStandardObjec
if (is_array($rawFormat)) {
if (
is_scalar($rawDataType)
- && MetadataTypes\DataTypeType::isValidValue((string) $rawDataType)
+ && MetadataTypes\DataType::isValidValue((string) $rawDataType)
) {
- $dataType = MetadataTypes\DataTypeType::get((string) $rawDataType);
+ $dataType = MetadataTypes\DataType::get((string) $rawDataType);
if (
- $dataType->equalsValue(MetadataTypes\DataTypeType::DATA_TYPE_ENUM)
- || $dataType->equalsValue(MetadataTypes\DataTypeType::DATA_TYPE_BUTTON)
- || $dataType->equalsValue(MetadataTypes\DataTypeType::DATA_TYPE_SWITCH)
+ $dataType->equalsValue(MetadataTypes\DataType::DATA_TYPE_ENUM)
+ || $dataType->equalsValue(MetadataTypes\DataType::DATA_TYPE_BUTTON)
+ || $dataType->equalsValue(MetadataTypes\DataType::DATA_TYPE_SWITCH)
) {
return implode(
',',
diff --git a/src/Middleware/Access.php b/src/Middleware/Access.php
index f6e42b68..9ccaacd7 100644
--- a/src/Middleware/Access.php
+++ b/src/Middleware/Access.php
@@ -35,25 +35,25 @@
final class Access implements MiddlewareInterface
{
- public function __construct(private Localization\Translator $translator)
+ public function __construct(private readonly Localization\Translator $translator)
{
}
/**
- * @throws JsonApiExceptions\JsonApiErrorException
+ * @throws JsonApiExceptions\JsonApiError
*/
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
try {
return $handler->handle($request);
- } catch (SimpleAuthExceptions\UnauthorizedAccessException) {
- throw new JsonApiExceptions\JsonApiErrorException(
+ } catch (SimpleAuthExceptions\UnauthorizedAccess) {
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_UNAUTHORIZED,
$this->translator->translate('//devices-module.base.messages.unauthorized.heading'),
$this->translator->translate('//devices-module.base.messages.unauthorized.message'),
);
- } catch (SimpleAuthExceptions\ForbiddenAccessException) {
- throw new JsonApiExceptions\JsonApiErrorException(
+ } catch (SimpleAuthExceptions\ForbiddenAccess) {
+ throw new JsonApiExceptions\JsonApiError(
StatusCodeInterface::STATUS_FORBIDDEN,
$this->translator->translate('//devices-module.base.messages.forbidden.heading'),
$this->translator->translate('//devices-module.base.messages.forbidden.message'),
diff --git a/src/Models/Channels/ChannelsManager.php b/src/Models/Channels/ChannelsManager.php
index db61fe11..e51e88c3 100644
--- a/src/Models/Channels/ChannelsManager.php
+++ b/src/Models/Channels/ChannelsManager.php
@@ -38,7 +38,7 @@ final class ChannelsManager
/**
* @phpstan-param Crud\IEntityCrud $entityCrud
*/
- public function __construct(private Crud\IEntityCrud $entityCrud)
+ public function __construct(private readonly Crud\IEntityCrud $entityCrud)
{
// Entity CRUD for handling entities
}
diff --git a/src/Models/Channels/ChannelsRepository.php b/src/Models/Channels/ChannelsRepository.php
index 58654366..217bad93 100644
--- a/src/Models/Channels/ChannelsRepository.php
+++ b/src/Models/Channels/ChannelsRepository.php
@@ -42,7 +42,7 @@ final class ChannelsRepository
/** @var ORM\EntityRepository|null */
private ORM\EntityRepository|null $repository = null;
- public function __construct(private Persistence\ManagerRegistry $managerRegistry)
+ public function __construct(private readonly Persistence\ManagerRegistry $managerRegistry)
{
}
diff --git a/src/Models/Channels/Controls/ControlsManager.php b/src/Models/Channels/Controls/ControlsManager.php
index 186d600e..11cbb9b8 100644
--- a/src/Models/Channels/Controls/ControlsManager.php
+++ b/src/Models/Channels/Controls/ControlsManager.php
@@ -38,7 +38,7 @@ final class ControlsManager
/**
* @param Crud\IEntityCrud $entityCrud
*/
- public function __construct(private Crud\IEntityCrud $entityCrud)
+ public function __construct(private readonly Crud\IEntityCrud $entityCrud)
{
// Entity CRUD for handling entities
}
diff --git a/src/Models/Channels/Controls/ControlsRepository.php b/src/Models/Channels/Controls/ControlsRepository.php
index acc5bdf8..8af255a4 100644
--- a/src/Models/Channels/Controls/ControlsRepository.php
+++ b/src/Models/Channels/Controls/ControlsRepository.php
@@ -41,7 +41,7 @@ final class ControlsRepository
/** @var ORM\EntityRepository|null */
private ORM\EntityRepository|null $repository = null;
- public function __construct(private Persistence\ManagerRegistry $managerRegistry)
+ public function __construct(private readonly Persistence\ManagerRegistry $managerRegistry)
{
}
diff --git a/src/Models/Channels/Properties/PropertiesManager.php b/src/Models/Channels/Properties/PropertiesManager.php
index 724adb45..d191b7d1 100644
--- a/src/Models/Channels/Properties/PropertiesManager.php
+++ b/src/Models/Channels/Properties/PropertiesManager.php
@@ -38,7 +38,7 @@ final class PropertiesManager
/**
* @param Crud\IEntityCrud $entityCrud
*/
- public function __construct(private Crud\IEntityCrud $entityCrud)
+ public function __construct(private readonly Crud\IEntityCrud $entityCrud)
{
// Entity CRUD for handling entities
}
diff --git a/src/Models/Channels/Properties/PropertiesRepository.php b/src/Models/Channels/Properties/PropertiesRepository.php
index 42a8cdf6..48ee1c00 100644
--- a/src/Models/Channels/Properties/PropertiesRepository.php
+++ b/src/Models/Channels/Properties/PropertiesRepository.php
@@ -41,7 +41,7 @@ final class PropertiesRepository
/** @var Array> */
private array $repository = [];
- public function __construct(private Persistence\ManagerRegistry $managerRegistry)
+ public function __construct(private readonly Persistence\ManagerRegistry $managerRegistry)
{
}
diff --git a/src/Models/Connectors/ConnectorsManager.php b/src/Models/Connectors/ConnectorsManager.php
index a7ca5f1b..4e8c4762 100644
--- a/src/Models/Connectors/ConnectorsManager.php
+++ b/src/Models/Connectors/ConnectorsManager.php
@@ -38,7 +38,7 @@ final class ConnectorsManager
/**
* @param Crud\IEntityCrud $entityCrud
*/
- public function __construct(private Crud\IEntityCrud $entityCrud)
+ public function __construct(private readonly Crud\IEntityCrud $entityCrud)
{
// Entity CRUD for handling entities
}
diff --git a/src/Models/Connectors/ConnectorsRepository.php b/src/Models/Connectors/ConnectorsRepository.php
index d1774f7e..702a5df7 100644
--- a/src/Models/Connectors/ConnectorsRepository.php
+++ b/src/Models/Connectors/ConnectorsRepository.php
@@ -42,7 +42,7 @@ final class ConnectorsRepository
/** @var Array> */
private array $repository = [];
- public function __construct(private Persistence\ManagerRegistry $managerRegistry)
+ public function __construct(private readonly Persistence\ManagerRegistry $managerRegistry)
{
}
diff --git a/src/Models/Connectors/Controls/ControlsManager.php b/src/Models/Connectors/Controls/ControlsManager.php
index f76bc23b..d0bd661c 100644
--- a/src/Models/Connectors/Controls/ControlsManager.php
+++ b/src/Models/Connectors/Controls/ControlsManager.php
@@ -38,7 +38,7 @@ final class ControlsManager
/**
* @param Crud\IEntityCrud $entityCrud
*/
- public function __construct(private Crud\IEntityCrud $entityCrud)
+ public function __construct(private readonly Crud\IEntityCrud $entityCrud)
{
// Entity CRUD for handling entities
}
diff --git a/src/Models/Connectors/Controls/ControlsRepository.php b/src/Models/Connectors/Controls/ControlsRepository.php
index 40cbeca0..9d7b3ec7 100644
--- a/src/Models/Connectors/Controls/ControlsRepository.php
+++ b/src/Models/Connectors/Controls/ControlsRepository.php
@@ -41,7 +41,7 @@ final class ControlsRepository
/** @var ORM\EntityRepository|null */
private ORM\EntityRepository|null $repository = null;
- public function __construct(private Persistence\ManagerRegistry $managerRegistry)
+ public function __construct(private readonly Persistence\ManagerRegistry $managerRegistry)
{
}
diff --git a/src/Models/Connectors/Properties/PropertiesManager.php b/src/Models/Connectors/Properties/PropertiesManager.php
index 3d6a6cd1..491d881b 100644
--- a/src/Models/Connectors/Properties/PropertiesManager.php
+++ b/src/Models/Connectors/Properties/PropertiesManager.php
@@ -38,7 +38,7 @@ final class PropertiesManager
/**
* @param Crud\IEntityCrud $entityCrud
*/
- public function __construct(private Crud\IEntityCrud $entityCrud)
+ public function __construct(private readonly Crud\IEntityCrud $entityCrud)
{
// Entity CRUD for handling entities
}
diff --git a/src/Models/Connectors/Properties/PropertiesRepository.php b/src/Models/Connectors/Properties/PropertiesRepository.php
index 5133d196..19efd445 100644
--- a/src/Models/Connectors/Properties/PropertiesRepository.php
+++ b/src/Models/Connectors/Properties/PropertiesRepository.php
@@ -41,7 +41,7 @@ final class PropertiesRepository
/** @var Array> */
private array $repository = [];
- public function __construct(private Persistence\ManagerRegistry $managerRegistry)
+ public function __construct(private readonly Persistence\ManagerRegistry $managerRegistry)
{
}
diff --git a/src/Models/DataStorage/ChannelControlsRepository.php b/src/Models/DataStorage/ChannelControlsRepository.php
index 1e1f8970..9db339a5 100644
--- a/src/Models/DataStorage/ChannelControlsRepository.php
+++ b/src/Models/DataStorage/ChannelControlsRepository.php
@@ -28,7 +28,7 @@
/**
* Data storage channel controls repository
*
- * @implements IteratorAggregate
+ * @implements IteratorAggregate
*
* @package FastyBird:DevicesModule!
* @subpackage Models
@@ -42,11 +42,11 @@ final class ChannelControlsRepository implements Countable, IteratorAggregate
/** @var Array> */
private array $rawData;
- /** @var Array */
+ /** @var Array */
private array $entities;
public function __construct(
- private MetadataEntities\Modules\DevicesModule\ChannelControlEntityFactory $entityFactory,
+ private readonly MetadataEntities\DevicesModule\ChannelControlEntityFactory $entityFactory,
)
{
$this->rawData = [];
@@ -54,9 +54,9 @@ public function __construct(
}
/**
- * @throws MetadataExceptions\FileNotFoundException
+ * @throws MetadataExceptions\FileNotFound
*/
- public function findById(Uuid\UuidInterface $id): MetadataEntities\Modules\DevicesModule\IChannelControlEntity|null
+ public function findById(Uuid\UuidInterface $id): MetadataEntities\DevicesModule\ChannelControl|null
{
if (array_key_exists($id->toString(), $this->rawData)) {
return $this->getEntity($id, $this->rawData[$id->toString()]);
@@ -66,9 +66,9 @@ public function findById(Uuid\UuidInterface $id): MetadataEntities\Modules\Devic
}
/**
- * @return Array
+ * @return Array
*
- * @throws MetadataExceptions\FileNotFoundException
+ * @throws MetadataExceptions\FileNotFound
*/
public function findAllByChannel(Uuid\UuidInterface $channel): array
{
@@ -127,9 +127,9 @@ public function count(): int
}
/**
- * @return RecursiveArrayIterator
+ * @return RecursiveArrayIterator
*
- * @throws MetadataExceptions\FileNotFoundException
+ * @throws MetadataExceptions\FileNotFound
*/
public function getIterator(): RecursiveArrayIterator
{
@@ -139,7 +139,7 @@ public function getIterator(): RecursiveArrayIterator
$entities[] = $this->getEntity(Uuid\Uuid::fromString($id), $rawDataRow);
}
- /** @var RecursiveArrayIterator $result */
+ /** @var RecursiveArrayIterator $result */
$result = new RecursiveArrayIterator($entities);
return $result;
@@ -148,12 +148,12 @@ public function getIterator(): RecursiveArrayIterator
/**
* @param Array $data
*
- * @throws MetadataExceptions\FileNotFoundException
+ * @throws MetadataExceptions\FileNotFound
*/
private function getEntity(
Uuid\UuidInterface $id,
array $data,
- ): MetadataEntities\Modules\DevicesModule\IChannelControlEntity
+ ): MetadataEntities\DevicesModule\ChannelControl
{
if (!array_key_exists($id->toString(), $this->entities)) {
$this->entities[$id->toString()] = $this->entityFactory->create($data);
diff --git a/src/Models/DataStorage/ChannelPropertiesRepository.php b/src/Models/DataStorage/ChannelPropertiesRepository.php
index 3f606dc5..a34c2bf6 100644
--- a/src/Models/DataStorage/ChannelPropertiesRepository.php
+++ b/src/Models/DataStorage/ChannelPropertiesRepository.php
@@ -36,7 +36,7 @@
/**
* Data storage channel properties repository
*
- * @implements IteratorAggregate
+ * @implements IteratorAggregate
*
* @package FastyBird:DevicesModule!
* @subpackage Models
@@ -50,12 +50,12 @@ final class ChannelPropertiesRepository implements Countable, IteratorAggregate
/** @var Array> */
private array $rawData;
- /** @var Array */
+ /** @var Array */
private array $entities;
public function __construct(
- private Models\States\ChannelPropertiesRepository $statesRepository,
- private MetadataEntities\Modules\DevicesModule\ChannelPropertyEntityFactory $entityFactory,
+ private readonly Models\States\ChannelPropertiesRepository $statesRepository,
+ private readonly MetadataEntities\DevicesModule\ChannelPropertyEntityFactory $entityFactory,
)
{
$this->rawData = [];
@@ -63,11 +63,11 @@ public function __construct(
}
/**
- * @throws MetadataExceptions\FileNotFoundException
+ * @throws MetadataExceptions\FileNotFound
*/
public function findById(
Uuid\UuidInterface $id,
- ): MetadataEntities\Modules\DevicesModule\IChannelStaticPropertyEntity|MetadataEntities\Modules\DevicesModule\IChannelDynamicPropertyEntity|MetadataEntities\Modules\DevicesModule\IChannelMappedPropertyEntity|null
+ ): MetadataEntities\DevicesModule\ChannelVariableProperty|MetadataEntities\DevicesModule\ChannelDynamicProperty|MetadataEntities\DevicesModule\ChannelMappedProperty|null
{
if (array_key_exists($id->toString(), $this->rawData)) {
return $this->getEntity($id, $this->rawData[$id->toString()]);
@@ -77,12 +77,12 @@ public function findById(
}
/**
- * @throws MetadataExceptions\FileNotFoundException
+ * @throws MetadataExceptions\FileNotFound
*/
public function findByIdentifier(
Uuid\UuidInterface $channel,
string $identifier,
- ): MetadataEntities\Modules\DevicesModule\IChannelStaticPropertyEntity|MetadataEntities\Modules\DevicesModule\IChannelDynamicPropertyEntity|MetadataEntities\Modules\DevicesModule\IChannelMappedPropertyEntity|null
+ ): MetadataEntities\DevicesModule\ChannelVariableProperty|MetadataEntities\DevicesModule\ChannelDynamicProperty|MetadataEntities\DevicesModule\ChannelMappedProperty|null
{
foreach ($this->rawData as $id => $rawDataRow) {
if (
@@ -101,13 +101,13 @@ public function findByIdentifier(
/**
* @param class-string|null $type
*
- * @return Array
+ * @return Array
*
* @template T
*
- * @phpstan-return ($type is null ? Array : Array)
+ * @phpstan-return ($type is null ? Array : Array)
*
- * @throws MetadataExceptions\FileNotFoundException
+ * @throws MetadataExceptions\FileNotFound
*/
public function findAllByChannel(
Uuid\UuidInterface $channel,
@@ -173,9 +173,9 @@ public function count(): int
}
/**
- * @return RecursiveArrayIterator
+ * @return RecursiveArrayIterator
*
- * @throws MetadataExceptions\FileNotFoundException
+ * @throws MetadataExceptions\FileNotFound
*/
public function getIterator(): RecursiveArrayIterator
{
@@ -185,7 +185,7 @@ public function getIterator(): RecursiveArrayIterator
$entities[] = $this->getEntity(Uuid\Uuid::fromString($id), $rawDataRow);
}
- /** @var RecursiveArrayIterator $result */
+ /** @var RecursiveArrayIterator $result */
$result = new RecursiveArrayIterator($entities);
return $result;
@@ -194,12 +194,12 @@ public function getIterator(): RecursiveArrayIterator
/**
* @param Array $data
*
- * @throws MetadataExceptions\FileNotFoundException
+ * @throws MetadataExceptions\FileNotFound
*/
private function getEntity(
Uuid\UuidInterface $id,
array $data,
- ): MetadataEntities\Modules\DevicesModule\IChannelStaticPropertyEntity|MetadataEntities\Modules\DevicesModule\IChannelDynamicPropertyEntity|MetadataEntities\Modules\DevicesModule\IChannelMappedPropertyEntity
+ ): MetadataEntities\DevicesModule\ChannelVariableProperty|MetadataEntities\DevicesModule\ChannelDynamicProperty|MetadataEntities\DevicesModule\ChannelMappedProperty
{
if (!array_key_exists($id->toString(), $this->entities)) {
$state = [];
@@ -207,8 +207,8 @@ private function getEntity(
if (
array_key_exists('type', $data)
&& (
- $data['type'] === MetadataTypes\PropertyTypeType::TYPE_DYNAMIC
- || $data['type'] === MetadataTypes\PropertyTypeType::TYPE_MAPPED
+ $data['type'] === MetadataTypes\PropertyType::TYPE_DYNAMIC
+ || $data['type'] === MetadataTypes\PropertyType::TYPE_MAPPED
)
) {
$state = $this->loadPropertyState($id);
@@ -217,9 +217,9 @@ private function getEntity(
$entity = $this->entityFactory->create(array_merge($state, $data));
if (
- $entity instanceof MetadataEntities\Modules\DevicesModule\IChannelStaticPropertyEntity
- || $entity instanceof MetadataEntities\Modules\DevicesModule\IChannelDynamicPropertyEntity
- || $entity instanceof MetadataEntities\Modules\DevicesModule\IChannelMappedPropertyEntity
+ $entity instanceof MetadataEntities\DevicesModule\ChannelVariableProperty
+ || $entity instanceof MetadataEntities\DevicesModule\ChannelDynamicProperty
+ || $entity instanceof MetadataEntities\DevicesModule\ChannelMappedProperty
) {
$this->entities[$id->toString()] = $entity;
} else {
diff --git a/src/Models/DataStorage/ChannelsRepository.php b/src/Models/DataStorage/ChannelsRepository.php
index dc0421dd..76b56966 100644
--- a/src/Models/DataStorage/ChannelsRepository.php
+++ b/src/Models/DataStorage/ChannelsRepository.php
@@ -30,7 +30,7 @@
/**
* Data storage channels repository
*
- * @implements IteratorAggregate
+ * @implements IteratorAggregate
*
* @package FastyBird:DevicesModule!
* @subpackage Models
@@ -44,11 +44,11 @@ final class ChannelsRepository implements Countable, IteratorAggregate
/** @var Array> */
private array $rawData;
- /** @var Array */
+ /** @var Array */
private array $entities;
public function __construct(
- private MetadataEntities\Modules\DevicesModule\ChannelEntityFactory $entityFactory,
+ private readonly MetadataEntities\DevicesModule\ChannelEntityFactory $entityFactory,
)
{
$this->rawData = [];
@@ -56,9 +56,9 @@ public function __construct(
}
/**
- * @throws MetadataExceptions\FileNotFoundException
+ * @throws MetadataExceptions\FileNotFound
*/
- public function findById(Uuid\UuidInterface $id): MetadataEntities\Modules\DevicesModule\IChannelEntity|null
+ public function findById(Uuid\UuidInterface $id): MetadataEntities\DevicesModule\Channel|null
{
if (array_key_exists($id->toString(), $this->rawData)) {
return $this->getEntity($id, $this->rawData[$id->toString()]);
@@ -68,12 +68,12 @@ public function findById(Uuid\UuidInterface $id): MetadataEntities\Modules\Devic
}
/**
- * @throws MetadataExceptions\FileNotFoundException
+ * @throws MetadataExceptions\FileNotFound
*/
public function findByIdentifier(
Uuid\UuidInterface $device,
string $identifier,
- ): MetadataEntities\Modules\DevicesModule\IChannelEntity|null
+ ): MetadataEntities\DevicesModule\Channel|null
{
foreach ($this->rawData as $id => $rawDataRow) {
if (
@@ -90,9 +90,9 @@ public function findByIdentifier(
}
/**
- * @return Array
+ * @return Array
*
- * @throws MetadataExceptions\FileNotFoundException
+ * @throws MetadataExceptions\FileNotFound
*/
public function findAllByDevice(Uuid\UuidInterface $device): array
{
@@ -151,9 +151,9 @@ public function count(): int
}
/**
- * @return RecursiveArrayIterator
+ * @return RecursiveArrayIterator
*
- * @throws MetadataExceptions\FileNotFoundException
+ * @throws MetadataExceptions\FileNotFound
*/
public function getIterator(): RecursiveArrayIterator
{
@@ -163,7 +163,7 @@ public function getIterator(): RecursiveArrayIterator
$entities[] = $this->getEntity(Uuid\Uuid::fromString($id), $rawDataRow);
}
- /** @var RecursiveArrayIterator $result */
+ /** @var RecursiveArrayIterator $result */
$result = new RecursiveArrayIterator($entities);
return $result;
@@ -172,12 +172,12 @@ public function getIterator(): RecursiveArrayIterator
/**
* @param Array $data
*
- * @throws MetadataExceptions\FileNotFoundException
+ * @throws MetadataExceptions\FileNotFound
*/
private function getEntity(
Uuid\UuidInterface $id,
array $data,
- ): MetadataEntities\Modules\DevicesModule\IChannelEntity
+ ): MetadataEntities\DevicesModule\Channel
{
if (!array_key_exists($id->toString(), $this->entities)) {
$this->entities[$id->toString()] = $this->entityFactory->create($data);
diff --git a/src/Models/DataStorage/ConnectorControlsRepository.php b/src/Models/DataStorage/ConnectorControlsRepository.php
index 473f5162..8aa43dc6 100644
--- a/src/Models/DataStorage/ConnectorControlsRepository.php
+++ b/src/Models/DataStorage/ConnectorControlsRepository.php
@@ -28,7 +28,7 @@
/**
* Data storage connector controls repository
*
- * @implements IteratorAggregate
+ * @implements IteratorAggregate
*
* @package FastyBird:DevicesModule!
* @subpackage Models
@@ -42,11 +42,11 @@ final class ConnectorControlsRepository implements Countable, IteratorAggregate
/** @var Array> */
private array $rawData;
- /** @var Array */
+ /** @var Array */
private array $entities;
public function __construct(
- private MetadataEntities\Modules\DevicesModule\ConnectorControlEntityFactory $entityFactory,
+ private readonly MetadataEntities\DevicesModule\ConnectorControlEntityFactory $entityFactory,
)
{
$this->rawData = [];
@@ -54,11 +54,11 @@ public function __construct(
}
/**
- * @throws MetadataExceptions\FileNotFoundException
+ * @throws MetadataExceptions\FileNotFound
*/
public function findById(
Uuid\UuidInterface $id,
- ): MetadataEntities\Modules\DevicesModule\IConnectorControlEntity|null
+ ): MetadataEntities\DevicesModule\ConnectorControl|null
{
if (array_key_exists($id->toString(), $this->rawData)) {
return $this->getEntity($id, $this->rawData[$id->toString()]);
@@ -68,9 +68,9 @@ public function findById(
}
/**
- * @return Array
+ * @return Array
*
- * @throws MetadataExceptions\FileNotFoundException
+ * @throws MetadataExceptions\FileNotFound
*/
public function findAllByConnector(Uuid\UuidInterface $connector): array
{
@@ -129,9 +129,9 @@ public function count(): int
}
/**
- * @return RecursiveArrayIterator
+ * @return RecursiveArrayIterator
*
- * @throws MetadataExceptions\FileNotFoundException
+ * @throws MetadataExceptions\FileNotFound
*/
public function getIterator(): RecursiveArrayIterator
{
@@ -141,7 +141,7 @@ public function getIterator(): RecursiveArrayIterator
$entities[] = $this->getEntity(Uuid\Uuid::fromString($id), $rawDataRow);
}
- /** @var RecursiveArrayIterator $result */
+ /** @var RecursiveArrayIterator $result */
$result = new RecursiveArrayIterator($entities);
return $result;
@@ -150,12 +150,12 @@ public function getIterator(): RecursiveArrayIterator
/**
* @param Array $data
*
- * @throws MetadataExceptions\FileNotFoundException
+ * @throws MetadataExceptions\FileNotFound
*/
private function getEntity(
Uuid\UuidInterface $id,
array $data,
- ): MetadataEntities\Modules\DevicesModule\IConnectorControlEntity
+ ): MetadataEntities\DevicesModule\ConnectorControl
{
if (!array_key_exists($id->toString(), $this->entities)) {
$this->entities[$id->toString()] = $this->entityFactory->create($data);
diff --git a/src/Models/DataStorage/ConnectorPropertiesRepository.php b/src/Models/DataStorage/ConnectorPropertiesRepository.php
index a7467bf5..046b0c6b 100644
--- a/src/Models/DataStorage/ConnectorPropertiesRepository.php
+++ b/src/Models/DataStorage/ConnectorPropertiesRepository.php
@@ -36,7 +36,7 @@
/**
* Data storage connector properties repository
*
- * @implements IteratorAggregate
+ * @implements IteratorAggregate
*
* @package FastyBird:DevicesModule!
* @subpackage Models
@@ -50,12 +50,12 @@ final class ConnectorPropertiesRepository implements Countable, IteratorAggregat
/** @var Array> */
private array $rawData;
- /** @var Array */
+ /** @var Array */
private array $entities;
public function __construct(
- private Models\States\ConnectorPropertiesRepository $statesRepository,
- private MetadataEntities\Modules\DevicesModule\ConnectorPropertyEntityFactory $entityFactory,
+ private readonly Models\States\ConnectorPropertiesRepository $statesRepository,
+ private readonly MetadataEntities\DevicesModule\ConnectorPropertyEntityFactory $entityFactory,
)
{
$this->rawData = [];
@@ -63,11 +63,11 @@ public function __construct(
}
/**
- * @throws MetadataExceptions\FileNotFoundException
+ * @throws MetadataExceptions\FileNotFound
*/
public function findById(
Uuid\UuidInterface $id,
- ): MetadataEntities\Modules\DevicesModule\IConnectorStaticPropertyEntity|MetadataEntities\Modules\DevicesModule\IConnectorDynamicPropertyEntity|MetadataEntities\Modules\DevicesModule\IConnectorMappedPropertyEntity|null
+ ): MetadataEntities\DevicesModule\ConnectorVariableProperty|MetadataEntities\DevicesModule\ConnectorDynamicProperty|MetadataEntities\DevicesModule\ConnectorMappedProperty|null
{
if (array_key_exists($id->toString(), $this->rawData)) {
return $this->getEntity($id, $this->rawData[$id->toString()]);
@@ -77,12 +77,12 @@ public function findById(
}
/**
- * @throws MetadataExceptions\FileNotFoundException
+ * @throws MetadataExceptions\FileNotFound
*/
public function findByIdentifier(
Uuid\UuidInterface $connector,
string $identifier,
- ): MetadataEntities\Modules\DevicesModule\IConnectorStaticPropertyEntity|MetadataEntities\Modules\DevicesModule\IConnectorDynamicPropertyEntity|MetadataEntities\Modules\DevicesModule\IConnectorMappedPropertyEntity|null
+ ): MetadataEntities\DevicesModule\ConnectorVariableProperty|MetadataEntities\DevicesModule\ConnectorDynamicProperty|MetadataEntities\DevicesModule\ConnectorMappedProperty|null
{
foreach ($this->rawData as $id => $rawDataRow) {
if (
@@ -101,13 +101,13 @@ public function findByIdentifier(
/**
* @param class-string|null $type
*
- * @return Array
+ * @return Array
*
* @template T
*
- * @phpstan-return ($type is null ? Array : Array)
+ * @phpstan-return ($type is null ? Array : Array)
*
- * @throws MetadataExceptions\FileNotFoundException
+ * @throws MetadataExceptions\FileNotFound
*/
public function findAllByConnector(
Uuid\UuidInterface $connector,
@@ -173,9 +173,9 @@ public function count(): int
}
/**
- * @return RecursiveArrayIterator
+ * @return RecursiveArrayIterator
*
- * @throws MetadataExceptions\FileNotFoundException
+ * @throws MetadataExceptions\FileNotFound
*/
public function getIterator(): RecursiveArrayIterator
{
@@ -185,7 +185,7 @@ public function getIterator(): RecursiveArrayIterator
$entities[] = $this->getEntity(Uuid\Uuid::fromString($id), $rawDataRow);
}
- /** @var RecursiveArrayIterator $result */
+ /** @var RecursiveArrayIterator $result */
$result = new RecursiveArrayIterator($entities);
return $result;
@@ -194,12 +194,12 @@ public function getIterator(): RecursiveArrayIterator
/**
* @param Array $data
*
- * @throws MetadataExceptions\FileNotFoundException
+ * @throws MetadataExceptions\FileNotFound
*/
private function getEntity(
Uuid\UuidInterface $id,
array $data,
- ): MetadataEntities\Modules\DevicesModule\IConnectorStaticPropertyEntity|MetadataEntities\Modules\DevicesModule\IConnectorDynamicPropertyEntity|MetadataEntities\Modules\DevicesModule\IConnectorMappedPropertyEntity
+ ): MetadataEntities\DevicesModule\ConnectorVariableProperty|MetadataEntities\DevicesModule\ConnectorDynamicProperty|MetadataEntities\DevicesModule\ConnectorMappedProperty
{
if (!array_key_exists($id->toString(), $this->entities)) {
$state = [];
@@ -207,8 +207,8 @@ private function getEntity(
if (
array_key_exists('type', $data)
&& (
- $data['type'] === MetadataTypes\PropertyTypeType::TYPE_DYNAMIC
- || $data['type'] === MetadataTypes\PropertyTypeType::TYPE_MAPPED
+ $data['type'] === MetadataTypes\PropertyType::TYPE_DYNAMIC
+ || $data['type'] === MetadataTypes\PropertyType::TYPE_MAPPED
)
) {
$state = $this->loadPropertyState($id);
@@ -217,9 +217,9 @@ private function getEntity(
$entity = $this->entityFactory->create(array_merge($state, $data));
if (
- $entity instanceof MetadataEntities\Modules\DevicesModule\IConnectorStaticPropertyEntity
- || $entity instanceof MetadataEntities\Modules\DevicesModule\IConnectorDynamicPropertyEntity
- || $entity instanceof MetadataEntities\Modules\DevicesModule\IConnectorMappedPropertyEntity
+ $entity instanceof MetadataEntities\DevicesModule\ConnectorVariableProperty
+ || $entity instanceof MetadataEntities\DevicesModule\ConnectorDynamicProperty
+ || $entity instanceof MetadataEntities\DevicesModule\ConnectorMappedProperty
) {
$this->entities[$id->toString()] = $entity;
} else {
diff --git a/src/Models/DataStorage/ConnectorsRepository.php b/src/Models/DataStorage/ConnectorsRepository.php
index dc47e576..be5f020a 100644
--- a/src/Models/DataStorage/ConnectorsRepository.php
+++ b/src/Models/DataStorage/ConnectorsRepository.php
@@ -30,7 +30,7 @@
/**
* Data storage connectors repository
*
- * @implements IteratorAggregate
+ * @implements IteratorAggregate
*
* @package FastyBird:DevicesModule!
* @subpackage Models
@@ -44,11 +44,11 @@ final class ConnectorsRepository implements Countable, IteratorAggregate
/** @var Array> */
private array $rawData;
- /** @var Array */
+ /** @var Array */
private array $entities;
public function __construct(
- private MetadataEntities\Modules\DevicesModule\ConnectorEntityFactory $entityFactory,
+ private readonly MetadataEntities\DevicesModule\ConnectorEntityFactory $entityFactory,
)
{
$this->rawData = [];
@@ -56,9 +56,9 @@ public function __construct(
}
/**
- * @throws MetadataExceptions\FileNotFoundException
+ * @throws MetadataExceptions\FileNotFound
*/
- public function findById(Uuid\UuidInterface $id): MetadataEntities\Modules\DevicesModule\IConnectorEntity|null
+ public function findById(Uuid\UuidInterface $id): MetadataEntities\DevicesModule\Connector|null
{
if (array_key_exists($id->toString(), $this->rawData)) {
return $this->getEntity($id, $this->rawData[$id->toString()]);
@@ -68,9 +68,9 @@ public function findById(Uuid\UuidInterface $id): MetadataEntities\Modules\Devic
}
/**
- * @throws MetadataExceptions\FileNotFoundException
+ * @throws MetadataExceptions\FileNotFound
*/
- public function findByIdentifier(string $identifier): MetadataEntities\Modules\DevicesModule\IConnectorEntity|null
+ public function findByIdentifier(string $identifier): MetadataEntities\DevicesModule\Connector|null
{
foreach ($this->rawData as $id => $rawDataRow) {
if (
@@ -128,9 +128,9 @@ public function count(): int
}
/**
- * @return RecursiveArrayIterator
+ * @return RecursiveArrayIterator
*
- * @throws MetadataExceptions\FileNotFoundException
+ * @throws MetadataExceptions\FileNotFound
*/
public function getIterator(): RecursiveArrayIterator
{
@@ -140,7 +140,7 @@ public function getIterator(): RecursiveArrayIterator
$entities[] = $this->getEntity(Uuid\Uuid::fromString($id), $rawDataRow);
}
- /** @var RecursiveArrayIterator $result */
+ /** @var RecursiveArrayIterator $result */
$result = new RecursiveArrayIterator($entities);
return $result;
@@ -149,12 +149,12 @@ public function getIterator(): RecursiveArrayIterator
/**
* @param Array $data
*
- * @throws MetadataExceptions\FileNotFoundException
+ * @throws MetadataExceptions\FileNotFound
*/
private function getEntity(
Uuid\UuidInterface $id,
array $data,
- ): MetadataEntities\Modules\DevicesModule\IConnectorEntity
+ ): MetadataEntities\DevicesModule\Connector
{
if (!array_key_exists($id->toString(), $this->entities)) {
$this->entities[$id->toString()] = $this->entityFactory->create($data);
diff --git a/src/Models/DataStorage/DeviceAttributesRepository.php b/src/Models/DataStorage/DeviceAttributesRepository.php
index cc3c10b7..c795354a 100644
--- a/src/Models/DataStorage/DeviceAttributesRepository.php
+++ b/src/Models/DataStorage/DeviceAttributesRepository.php
@@ -30,7 +30,7 @@
/**
* Data storage device attributes repository
*
- * @implements IteratorAggregate
+ * @implements IteratorAggregate
*
* @package FastyBird:DevicesModule!
* @subpackage Models
@@ -44,11 +44,11 @@ final class DeviceAttributesRepository implements Countable, IteratorAggregate
/** @var Array> */
private array $rawData;
- /** @var Array */
+ /** @var Array */
private array $entities;
public function __construct(
- private MetadataEntities\Modules\DevicesModule\DeviceAttributeEntityFactory $entityFactory,
+ private readonly MetadataEntities\DevicesModule\DeviceAttributeEntityFactory $entityFactory,
)
{
$this->rawData = [];
@@ -56,9 +56,9 @@ public function __construct(
}
/**
- * @throws MetadataExceptions\FileNotFoundException
+ * @throws MetadataExceptions\FileNotFound
*/
- public function findById(Uuid\UuidInterface $id): MetadataEntities\Modules\DevicesModule\IDeviceAttributeEntity|null
+ public function findById(Uuid\UuidInterface $id): MetadataEntities\DevicesModule\DeviceAttribute|null
{
if (array_key_exists($id->toString(), $this->rawData)) {
return $this->getEntity($id, $this->rawData[$id->toString()]);
@@ -68,12 +68,12 @@ public function findById(Uuid\UuidInterface $id): MetadataEntities\Modules\Devic
}
/**
- * @throws MetadataExceptions\FileNotFoundException
+ * @throws MetadataExceptions\FileNotFound
*/
public function findByIdentifier(
Uuid\UuidInterface $device,
string $identifier,
- ): MetadataEntities\Modules\DevicesModule\IDeviceAttributeEntity|null
+ ): MetadataEntities\DevicesModule\DeviceAttribute|null
{
foreach ($this->rawData as $id => $rawDataRow) {
if (
@@ -90,9 +90,9 @@ public function findByIdentifier(
}
/**
- * @return Array
+ * @return Array
*
- * @throws MetadataExceptions\FileNotFoundException
+ * @throws MetadataExceptions\FileNotFound
*/
public function findAllByDevice(Uuid\UuidInterface $device): array
{
@@ -151,9 +151,9 @@ public function count(): int
}
/**
- * @return RecursiveArrayIterator
+ * @return RecursiveArrayIterator
*
- * @throws MetadataExceptions\FileNotFoundException
+ * @throws MetadataExceptions\FileNotFound
*/
public function getIterator(): RecursiveArrayIterator
{
@@ -163,7 +163,7 @@ public function getIterator(): RecursiveArrayIterator
$entities[] = $this->getEntity(Uuid\Uuid::fromString($id), $rawDataRow);
}
- /** @var RecursiveArrayIterator $result */
+ /** @var RecursiveArrayIterator $result */
$result = new RecursiveArrayIterator($entities);
return $result;
@@ -172,12 +172,12 @@ public function getIterator(): RecursiveArrayIterator
/**
* @param Array $data
*
- * @throws MetadataExceptions\FileNotFoundException
+ * @throws MetadataExceptions\FileNotFound
*/
private function getEntity(
Uuid\UuidInterface $id,
array $data,
- ): MetadataEntities\Modules\DevicesModule\IDeviceAttributeEntity
+ ): MetadataEntities\DevicesModule\DeviceAttribute
{
if (!array_key_exists($id->toString(), $this->entities)) {
$this->entities[$id->toString()] = $this->entityFactory->create($data);
diff --git a/src/Models/DataStorage/DeviceControlsRepository.php b/src/Models/DataStorage/DeviceControlsRepository.php
index 9e9697f7..e9a34523 100644
--- a/src/Models/DataStorage/DeviceControlsRepository.php
+++ b/src/Models/DataStorage/DeviceControlsRepository.php
@@ -28,7 +28,7 @@
/**
* Data storage device controls repository
*
- * @implements IteratorAggregate
+ * @implements IteratorAggregate
*
* @package FastyBird:DevicesModule!
* @subpackage Models
@@ -42,11 +42,11 @@ final class DeviceControlsRepository implements Countable, IteratorAggregate
/** @var Array> */
private array $rawData;
- /** @var Array */
+ /** @var Array */
private array $entities;
public function __construct(
- private MetadataEntities\Modules\DevicesModule\DeviceControlEntityFactory $entityFactory,
+ private readonly MetadataEntities\DevicesModule\DeviceControlEntityFactory $entityFactory,
)
{
$this->rawData = [];
@@ -54,9 +54,9 @@ public function __construct(
}
/**
- * @throws MetadataExceptions\FileNotFoundException
+ * @throws MetadataExceptions\FileNotFound
*/
- public function findById(Uuid\UuidInterface $id): MetadataEntities\Modules\DevicesModule\IDeviceControlEntity|null
+ public function findById(Uuid\UuidInterface $id): MetadataEntities\DevicesModule\DeviceControl|null
{
if (array_key_exists($id->toString(), $this->rawData)) {
return $this->getEntity($id, $this->rawData[$id->toString()]);
@@ -66,9 +66,9 @@ public function findById(Uuid\UuidInterface $id): MetadataEntities\Modules\Devic
}
/**
- * @return Array
+ * @return Array
*
- * @throws MetadataExceptions\FileNotFoundException
+ * @throws MetadataExceptions\FileNotFound
*/
public function findAllByDevice(Uuid\UuidInterface $device): array
{
@@ -127,9 +127,9 @@ public function count(): int
}
/**
- * @return RecursiveArrayIterator
+ * @return RecursiveArrayIterator
*
- * @throws MetadataExceptions\FileNotFoundException
+ * @throws MetadataExceptions\FileNotFound
*/
public function getIterator(): RecursiveArrayIterator
{
@@ -139,7 +139,7 @@ public function getIterator(): RecursiveArrayIterator
$entities[] = $this->getEntity(Uuid\Uuid::fromString($id), $rawDataRow);
}
- /** @var RecursiveArrayIterator $result */
+ /** @var RecursiveArrayIterator $result */
$result = new RecursiveArrayIterator($entities);
return $result;
@@ -148,12 +148,12 @@ public function getIterator(): RecursiveArrayIterator
/**
* @param Array $data
*
- * @throws MetadataExceptions\FileNotFoundException
+ * @throws MetadataExceptions\FileNotFound
*/
private function getEntity(
Uuid\UuidInterface $id,
array $data,
- ): MetadataEntities\Modules\DevicesModule\IDeviceControlEntity
+ ): MetadataEntities\DevicesModule\DeviceControl
{
if (!array_key_exists($id->toString(), $this->entities)) {
$this->entities[$id->toString()] = $this->entityFactory->create($data);
diff --git a/src/Models/DataStorage/DevicePropertiesRepository.php b/src/Models/DataStorage/DevicePropertiesRepository.php
index 77d5534b..5f220d9a 100644
--- a/src/Models/DataStorage/DevicePropertiesRepository.php
+++ b/src/Models/DataStorage/DevicePropertiesRepository.php
@@ -36,7 +36,7 @@
/**
* Data storage device properties repository
*
- * @implements IteratorAggregate
+ * @implements IteratorAggregate
*
* @package FastyBird:DevicesModule!
* @subpackage Models
@@ -50,12 +50,12 @@ final class DevicePropertiesRepository implements Countable, IteratorAggregate
/** @var Array> */
private array $rawData;
- /** @var Array */
+ /** @var Array */
private array $entities;
public function __construct(
- private Models\States\DevicePropertiesRepository $statesRepository,
- private MetadataEntities\Modules\DevicesModule\DevicePropertyEntityFactory $entityFactory,
+ private readonly Models\States\DevicePropertiesRepository $statesRepository,
+ private readonly MetadataEntities\DevicesModule\DevicePropertyEntityFactory $entityFactory,
)
{
$this->rawData = [];
@@ -63,11 +63,11 @@ public function __construct(
}
/**
- * @throws MetadataExceptions\FileNotFoundException
+ * @throws MetadataExceptions\FileNotFound
*/
public function findById(
Uuid\UuidInterface $id,
- ): MetadataEntities\Modules\DevicesModule\IDeviceStaticPropertyEntity|MetadataEntities\Modules\DevicesModule\IDeviceDynamicPropertyEntity|MetadataEntities\Modules\DevicesModule\IDeviceMappedPropertyEntity|null
+ ): MetadataEntities\DevicesModule\DeviceVariableProperty|MetadataEntities\DevicesModule\DeviceDynamicProperty|MetadataEntities\DevicesModule\DeviceMappedProperty|null
{
if (array_key_exists($id->toString(), $this->rawData)) {
return $this->getEntity($id, $this->rawData[$id->toString()]);
@@ -77,12 +77,12 @@ public function findById(
}
/**
- * @throws MetadataExceptions\FileNotFoundException
+ * @throws MetadataExceptions\FileNotFound
*/
public function findByIdentifier(
Uuid\UuidInterface $device,
string $identifier,
- ): MetadataEntities\Modules\DevicesModule\IDeviceStaticPropertyEntity|MetadataEntities\Modules\DevicesModule\IDeviceDynamicPropertyEntity|MetadataEntities\Modules\DevicesModule\IDeviceMappedPropertyEntity|null
+ ): MetadataEntities\DevicesModule\DeviceVariableProperty|MetadataEntities\DevicesModule\DeviceDynamicProperty|MetadataEntities\DevicesModule\DeviceMappedProperty|null
{
foreach ($this->rawData as $id => $rawDataRow) {
if (
@@ -101,13 +101,13 @@ public function findByIdentifier(
/**
* @param class-string|null $type
*
- * @return Array
+ * @return Array
*
* @template T
*
- * @phpstan-return ($type is null ? Array : Array)
+ * @phpstan-return ($type is null ? Array : Array)
*
- * @throws MetadataExceptions\FileNotFoundException
+ * @throws MetadataExceptions\FileNotFound
*/
public function findAllByDevice(
Uuid\UuidInterface $device,
@@ -173,9 +173,9 @@ public function count(): int
}
/**
- * @return RecursiveArrayIterator
+ * @return RecursiveArrayIterator
*
- * @throws MetadataExceptions\FileNotFoundException
+ * @throws MetadataExceptions\FileNotFound
*/
public function getIterator(): RecursiveArrayIterator
{
@@ -185,7 +185,7 @@ public function getIterator(): RecursiveArrayIterator
$entities[] = $this->getEntity(Uuid\Uuid::fromString($id), $rawDataRow);
}
- /** @var RecursiveArrayIterator $result */
+ /** @var RecursiveArrayIterator $result */
$result = new RecursiveArrayIterator($entities);
return $result;
@@ -194,12 +194,12 @@ public function getIterator(): RecursiveArrayIterator
/**
* @param Array $data
*
- * @throws MetadataExceptions\FileNotFoundException
+ * @throws MetadataExceptions\FileNotFound
*/
private function getEntity(
Uuid\UuidInterface $id,
array $data,
- ): MetadataEntities\Modules\DevicesModule\IDeviceStaticPropertyEntity|MetadataEntities\Modules\DevicesModule\IDeviceDynamicPropertyEntity|MetadataEntities\Modules\DevicesModule\IDeviceMappedPropertyEntity
+ ): MetadataEntities\DevicesModule\DeviceVariableProperty|MetadataEntities\DevicesModule\DeviceDynamicProperty|MetadataEntities\DevicesModule\DeviceMappedProperty
{
if (!array_key_exists($id->toString(), $this->entities)) {
$state = [];
@@ -207,8 +207,8 @@ private function getEntity(
if (
array_key_exists('type', $data)
&& (
- $data['type'] === MetadataTypes\PropertyTypeType::TYPE_DYNAMIC
- || $data['type'] === MetadataTypes\PropertyTypeType::TYPE_MAPPED
+ $data['type'] === MetadataTypes\PropertyType::TYPE_DYNAMIC
+ || $data['type'] === MetadataTypes\PropertyType::TYPE_MAPPED
)
) {
$state = $this->loadPropertyState($id);
@@ -217,9 +217,9 @@ private function getEntity(
$entity = $this->entityFactory->create(array_merge($state, $data));
if (
- $entity instanceof MetadataEntities\Modules\DevicesModule\IDeviceStaticPropertyEntity
- || $entity instanceof MetadataEntities\Modules\DevicesModule\IDeviceDynamicPropertyEntity
- || $entity instanceof MetadataEntities\Modules\DevicesModule\IDeviceMappedPropertyEntity
+ $entity instanceof MetadataEntities\DevicesModule\DeviceVariableProperty
+ || $entity instanceof MetadataEntities\DevicesModule\DeviceDynamicProperty
+ || $entity instanceof MetadataEntities\DevicesModule\DeviceMappedProperty
) {
$this->entities[$id->toString()] = $entity;
} else {
diff --git a/src/Models/DataStorage/DevicesRepository.php b/src/Models/DataStorage/DevicesRepository.php
index 50178f74..4fb4aadd 100644
--- a/src/Models/DataStorage/DevicesRepository.php
+++ b/src/Models/DataStorage/DevicesRepository.php
@@ -30,7 +30,7 @@
/**
* Data storage devices repository
*
- * @implements IteratorAggregate
+ * @implements IteratorAggregate
*
* @package FastyBird:DevicesModule!
* @subpackage Models
@@ -44,11 +44,11 @@ final class DevicesRepository implements Countable, IteratorAggregate
/** @var Array> */
private array $rawData;
- /** @var Array */
+ /** @var Array */
private array $entities;
public function __construct(
- private MetadataEntities\Modules\DevicesModule\DeviceEntityFactory $entityFactory,
+ private readonly MetadataEntities\DevicesModule\DeviceEntityFactory $entityFactory,
)
{
$this->rawData = [];
@@ -56,9 +56,9 @@ public function __construct(
}
/**
- * @throws MetadataExceptions\FileNotFoundException
+ * @throws MetadataExceptions\FileNotFound
*/
- public function findById(Uuid\UuidInterface $id): MetadataEntities\Modules\DevicesModule\IDeviceEntity|null
+ public function findById(Uuid\UuidInterface $id): MetadataEntities\DevicesModule\Device|null
{
if (array_key_exists($id->toString(), $this->rawData)) {
return $this->getEntity($id, $this->rawData[$id->toString()]);
@@ -68,12 +68,12 @@ public function findById(Uuid\UuidInterface $id): MetadataEntities\Modules\Devic
}
/**
- * @throws MetadataExceptions\FileNotFoundException
+ * @throws MetadataExceptions\FileNotFound
*/
public function findByIdentifier(
Uuid\UuidInterface $connector,
string $identifier,
- ): MetadataEntities\Modules\DevicesModule\IDeviceEntity|null
+ ): MetadataEntities\DevicesModule\Device|null
{
foreach ($this->rawData as $id => $rawDataRow) {
if (
@@ -90,9 +90,9 @@ public function findByIdentifier(
}
/**
- * @return Array
+ * @return Array
*
- * @throws MetadataExceptions\FileNotFoundException
+ * @throws MetadataExceptions\FileNotFound
*/
public function findAllByConnector(Uuid\UuidInterface $connector): array
{
@@ -151,9 +151,9 @@ public function count(): int
}
/**
- * @return RecursiveArrayIterator
+ * @return RecursiveArrayIterator
*
- * @throws MetadataExceptions\FileNotFoundException
+ * @throws MetadataExceptions\FileNotFound
*/
public function getIterator(): RecursiveArrayIterator
{
@@ -163,7 +163,7 @@ public function getIterator(): RecursiveArrayIterator
$entities[] = $this->getEntity(Uuid\Uuid::fromString($id), $rawDataRow);
}
- /** @var RecursiveArrayIterator $result */
+ /** @var RecursiveArrayIterator $result */
$result = new RecursiveArrayIterator($entities);
return $result;
@@ -172,12 +172,12 @@ public function getIterator(): RecursiveArrayIterator
/**
* @param Array $data
*
- * @throws MetadataExceptions\FileNotFoundException
+ * @throws MetadataExceptions\FileNotFound
*/
private function getEntity(
Uuid\UuidInterface $id,
array $data,
- ): MetadataEntities\Modules\DevicesModule\IDeviceEntity
+ ): MetadataEntities\DevicesModule\Device
{
if (!array_key_exists($id->toString(), $this->entities)) {
$this->entities[$id->toString()] = $this->entityFactory->create($data);
diff --git a/src/Models/Devices/Attributes/AttributesManager.php b/src/Models/Devices/Attributes/AttributesManager.php
index 37a8732b..1d514b7b 100644
--- a/src/Models/Devices/Attributes/AttributesManager.php
+++ b/src/Models/Devices/Attributes/AttributesManager.php
@@ -38,7 +38,7 @@ final class AttributesManager
/**
* @param Crud\IEntityCrud $entityCrud
*/
- public function __construct(private Crud\IEntityCrud $entityCrud)
+ public function __construct(private readonly Crud\IEntityCrud $entityCrud)
{
// Entity CRUD for handling entities
}
diff --git a/src/Models/Devices/Attributes/AttributesRepository.php b/src/Models/Devices/Attributes/AttributesRepository.php
index fb9c1d27..1effe489 100644
--- a/src/Models/Devices/Attributes/AttributesRepository.php
+++ b/src/Models/Devices/Attributes/AttributesRepository.php
@@ -41,7 +41,7 @@ final class AttributesRepository
/** @var ORM\EntityRepository|null */
private ORM\EntityRepository|null $repository = null;
- public function __construct(private Persistence\ManagerRegistry $managerRegistry)
+ public function __construct(private readonly Persistence\ManagerRegistry $managerRegistry)
{
}
diff --git a/src/Models/Devices/Controls/ControlsManager.php b/src/Models/Devices/Controls/ControlsManager.php
index 935987df..163aee59 100644
--- a/src/Models/Devices/Controls/ControlsManager.php
+++ b/src/Models/Devices/Controls/ControlsManager.php
@@ -38,7 +38,7 @@ final class ControlsManager
/**
* @param Crud\IEntityCrud $entityCrud
*/
- public function __construct(private Crud\IEntityCrud $entityCrud)
+ public function __construct(private readonly Crud\IEntityCrud $entityCrud)
{
// Entity CRUD for handling entities
}
diff --git a/src/Models/Devices/Controls/ControlsRepository.php b/src/Models/Devices/Controls/ControlsRepository.php
index 44d4c589..17ce7abd 100644
--- a/src/Models/Devices/Controls/ControlsRepository.php
+++ b/src/Models/Devices/Controls/ControlsRepository.php
@@ -41,7 +41,7 @@ final class ControlsRepository
/** @var ORM\EntityRepository|null */
private ORM\EntityRepository|null $repository = null;
- public function __construct(private Persistence\ManagerRegistry $managerRegistry)
+ public function __construct(private readonly Persistence\ManagerRegistry $managerRegistry)
{
}
diff --git a/src/Models/Devices/DevicesManager.php b/src/Models/Devices/DevicesManager.php
index 60632a46..37bc1903 100644
--- a/src/Models/Devices/DevicesManager.php
+++ b/src/Models/Devices/DevicesManager.php
@@ -38,7 +38,7 @@ final class DevicesManager
/**
* @param Crud\IEntityCrud $entityCrud
*/
- public function __construct(private Crud\IEntityCrud $entityCrud)
+ public function __construct(private readonly Crud\IEntityCrud $entityCrud)
{
// Entity CRUD for handling entities
}
diff --git a/src/Models/Devices/DevicesRepository.php b/src/Models/Devices/DevicesRepository.php
index 7a007e0e..d6a8cce9 100644
--- a/src/Models/Devices/DevicesRepository.php
+++ b/src/Models/Devices/DevicesRepository.php
@@ -42,7 +42,7 @@ final class DevicesRepository
/** @var Array> */
private array $repository = [];
- public function __construct(private Persistence\ManagerRegistry $managerRegistry)
+ public function __construct(private readonly Persistence\ManagerRegistry $managerRegistry)
{
}
diff --git a/src/Models/Devices/Properties/PropertiesManager.php b/src/Models/Devices/Properties/PropertiesManager.php
index 471923b3..221df488 100644
--- a/src/Models/Devices/Properties/PropertiesManager.php
+++ b/src/Models/Devices/Properties/PropertiesManager.php
@@ -38,7 +38,7 @@ final class PropertiesManager
/**
* @param Crud\IEntityCrud $entityCrud
*/
- public function __construct(private Crud\IEntityCrud $entityCrud)
+ public function __construct(private readonly Crud\IEntityCrud $entityCrud)
{
// Entity CRUD for handling entities
}
diff --git a/src/Models/Devices/Properties/PropertiesRepository.php b/src/Models/Devices/Properties/PropertiesRepository.php
index 00795d62..c10e1c53 100644
--- a/src/Models/Devices/Properties/PropertiesRepository.php
+++ b/src/Models/Devices/Properties/PropertiesRepository.php
@@ -41,7 +41,7 @@ final class PropertiesRepository
/** @var Array> */
private array $repository = [];
- public function __construct(private Persistence\ManagerRegistry $managerRegistry)
+ public function __construct(private readonly Persistence\ManagerRegistry $managerRegistry)
{
}
diff --git a/src/Models/States/ChannelPropertiesManager.php b/src/Models/States/ChannelPropertiesManager.php
index 276efc81..975947f9 100644
--- a/src/Models/States/ChannelPropertiesManager.php
+++ b/src/Models/States/ChannelPropertiesManager.php
@@ -42,15 +42,15 @@ final class ChannelPropertiesManager
use Nette\SmartObject;
public function __construct(
- protected ExchangeEntities\EntityFactory $entityFactory,
- protected IChannelPropertiesManager|null $manager,
- private PsrEventDispatcher\EventDispatcherInterface|null $dispatcher,
+ protected readonly ExchangeEntities\EntityFactory $entityFactory,
+ protected readonly IChannelPropertiesManager|null $manager,
+ private readonly PsrEventDispatcher\EventDispatcherInterface|null $dispatcher,
)
{
}
public function create(
- MetadataEntities\Modules\DevicesModule\IChannelDynamicPropertyEntity|MetadataEntities\Modules\DevicesModule\IChannelMappedPropertyEntity|Entities\Channels\Properties\Dynamic|Entities\Channels\Properties\Mapped $property,
+ MetadataEntities\DevicesModule\ChannelDynamicProperty|MetadataEntities\DevicesModule\ChannelMappedProperty|Entities\Channels\Properties\Dynamic|Entities\Channels\Properties\Mapped $property,
Utils\ArrayHash $values,
): States\ChannelProperty
{
@@ -94,7 +94,7 @@ public function create(
}
public function update(
- MetadataEntities\Modules\DevicesModule\IChannelDynamicPropertyEntity|MetadataEntities\Modules\DevicesModule\IChannelMappedPropertyEntity|Entities\Channels\Properties\Dynamic|Entities\Channels\Properties\Mapped $property,
+ MetadataEntities\DevicesModule\ChannelDynamicProperty|MetadataEntities\DevicesModule\ChannelMappedProperty|Entities\Channels\Properties\Dynamic|Entities\Channels\Properties\Mapped $property,
States\ChannelProperty $state,
Utils\ArrayHash $values,
): States\ChannelProperty
@@ -140,7 +140,7 @@ public function update(
}
public function delete(
- MetadataEntities\Modules\DevicesModule\IChannelDynamicPropertyEntity|MetadataEntities\Modules\DevicesModule\IChannelMappedPropertyEntity|Entities\Channels\Properties\Dynamic|Entities\Channels\Properties\Mapped $property,
+ MetadataEntities\DevicesModule\ChannelDynamicProperty|MetadataEntities\DevicesModule\ChannelMappedProperty|Entities\Channels\Properties\Dynamic|Entities\Channels\Properties\Mapped $property,
States\ChannelProperty $state,
): bool
{
diff --git a/src/Models/States/ChannelPropertiesRepository.php b/src/Models/States/ChannelPropertiesRepository.php
index 3bac5fd8..6429317b 100644
--- a/src/Models/States/ChannelPropertiesRepository.php
+++ b/src/Models/States/ChannelPropertiesRepository.php
@@ -35,12 +35,12 @@ final class ChannelPropertiesRepository
use Nette\SmartObject;
- public function __construct(private IChannelPropertiesRepository|null $repository)
+ public function __construct(private readonly IChannelPropertiesRepository|null $repository)
{
}
public function findOne(
- MetadataEntities\Modules\DevicesModule\IChannelDynamicPropertyEntity|MetadataEntities\Modules\DevicesModule\IChannelMappedPropertyEntity|Entities\Channels\Properties\Dynamic|Entities\Channels\Properties\Mapped $property,
+ MetadataEntities\DevicesModule\ChannelDynamicProperty|MetadataEntities\DevicesModule\ChannelMappedProperty|Entities\Channels\Properties\Dynamic|Entities\Channels\Properties\Mapped $property,
): States\ChannelProperty|null
{
if ($this->repository === null) {
diff --git a/src/Models/States/ChannelPropertyStateManager.php b/src/Models/States/ChannelPropertyStateManager.php
index 23a22782..627a67d6 100644
--- a/src/Models/States/ChannelPropertyStateManager.php
+++ b/src/Models/States/ChannelPropertyStateManager.php
@@ -39,17 +39,20 @@ final class ChannelPropertyStateManager
private Log\LoggerInterface $logger;
public function __construct(
- private DevicesModuleModels\DataStorage\ChannelsRepository $channelsRepository,
- private DevicesModuleModels\States\ChannelPropertiesRepository $channelPropertyStateRepository,
- private DevicesModuleModels\States\ChannelPropertiesManager $channelPropertiesStatesManager,
+ private readonly DevicesModuleModels\DataStorage\ChannelsRepository $channelsRepository,
+ private readonly DevicesModuleModels\States\ChannelPropertiesRepository $channelPropertyStateRepository,
+ private readonly DevicesModuleModels\States\ChannelPropertiesManager $channelPropertiesStatesManager,
Log\LoggerInterface|null $logger,
)
{
$this->logger = $logger ?? new Log\NullLogger();
}
+ /**
+ * @throws Metadata\Exceptions\FileNotFound
+ */
public function setValue(
- Metadata\Entities\Modules\DevicesModule\IChannelDynamicPropertyEntity $property,
+ Metadata\Entities\DevicesModule\ChannelDynamicProperty $property,
Utils\ArrayHash $data,
): void
{
@@ -134,10 +137,12 @@ public function setValue(
}
/**
- * @param Metadata\Entities\Modules\DevicesModule\IChannelDynamicPropertyEntity|Array $property
+ * @param Metadata\Entities\DevicesModule\ChannelDynamicProperty|Array $property
+ *
+ * @throws Metadata\Exceptions\FileNotFound
*/
public function setValidState(
- Metadata\Entities\Modules\DevicesModule\IChannelDynamicPropertyEntity|array $property,
+ Metadata\Entities\DevicesModule\ChannelDynamicProperty|array $property,
bool $state,
): void
{
diff --git a/src/Models/States/ConnectorConnectionStateManager.php b/src/Models/States/ConnectorConnectionStateManager.php
index 319b5825..fdbbda67 100644
--- a/src/Models/States/ConnectorConnectionStateManager.php
+++ b/src/Models/States/ConnectorConnectionStateManager.php
@@ -39,32 +39,31 @@ final class ConnectorConnectionStateManager
use Nette\SmartObject;
- private Models\DataStorage\ConnectorPropertiesRepository $dataStorageRepository;
-
private Log\LoggerInterface $logger;
public function __construct(
- private Models\Connectors\ConnectorsRepository $connectorsRepository,
- Models\DataStorage\ConnectorPropertiesRepository $repository,
- private Models\Connectors\Properties\PropertiesManager $manager,
- private Models\States\ConnectorPropertiesRepository $statesRepository,
- private Models\States\ConnectorPropertiesManager $statesManager,
+ private readonly Models\Connectors\ConnectorsRepository $connectorsRepository,
+ private readonly Models\DataStorage\ConnectorPropertiesRepository $repository,
+ private readonly Models\Connectors\Properties\PropertiesManager $manager,
+ private readonly Models\States\ConnectorPropertiesRepository $statesRepository,
+ private readonly Models\States\ConnectorPropertiesManager $statesManager,
Log\LoggerInterface|null $logger = null,
)
{
- $this->dataStorageRepository = $repository;
-
$this->logger = $logger ?? new Log\NullLogger();
}
+ /**
+ * @throws Metadata\Exceptions\FileNotFound
+ */
public function setState(
- Entities\Connectors\Connector|MetadataEntities\Modules\DevicesModule\IConnectorEntity $connector,
- MetadataTypes\ConnectionStateType $state,
+ Entities\Connectors\Connector|MetadataEntities\DevicesModule\Connector $connector,
+ MetadataTypes\ConnectionState $state,
): bool
{
- $stateProperty = $this->dataStorageRepository->findByIdentifier(
+ $stateProperty = $this->repository->findByIdentifier(
$connector->getId(),
- MetadataTypes\ConnectorPropertyIdentifierType::IDENTIFIER_STATE,
+ MetadataTypes\ConnectorPropertyIdentifier::IDENTIFIER_STATE,
);
if ($stateProperty === null) {
@@ -82,15 +81,15 @@ public function setState(
$stateProperty = $this->manager->create(Utils\ArrayHash::from([
'connector' => $connector,
'entity' => Entities\Connectors\Properties\Dynamic::class,
- 'identifier' => MetadataTypes\ConnectorPropertyIdentifierType::IDENTIFIER_STATE,
- 'dataType' => MetadataTypes\DataTypeType::get(MetadataTypes\DataTypeType::DATA_TYPE_ENUM),
+ 'identifier' => MetadataTypes\ConnectorPropertyIdentifier::IDENTIFIER_STATE,
+ 'dataType' => MetadataTypes\DataType::get(MetadataTypes\DataType::DATA_TYPE_ENUM),
'unit' => null,
'format' => [
- MetadataTypes\ConnectionStateType::STATE_RUNNING,
- MetadataTypes\ConnectionStateType::STATE_STOPPED,
- MetadataTypes\ConnectionStateType::STATE_UNKNOWN,
- MetadataTypes\ConnectionStateType::STATE_SLEEPING,
- MetadataTypes\ConnectionStateType::STATE_ALERT,
+ MetadataTypes\ConnectionState::STATE_RUNNING,
+ MetadataTypes\ConnectionState::STATE_STOPPED,
+ MetadataTypes\ConnectionState::STATE_UNKNOWN,
+ MetadataTypes\ConnectionState::STATE_SLEEPING,
+ MetadataTypes\ConnectionState::STATE_ALERT,
],
'settable' => false,
'queryable' => false,
@@ -98,7 +97,7 @@ public function setState(
}
if (
- $stateProperty instanceof MetadataEntities\Modules\DevicesModule\IConnectorDynamicPropertyEntity
+ $stateProperty instanceof MetadataEntities\DevicesModule\ConnectorDynamicProperty
|| $stateProperty instanceof Entities\Connectors\Properties\Dynamic
) {
try {
@@ -113,7 +112,7 @@ public function setState(
],
);
- MetadataTypes\ConnectionStateType::get(MetadataTypes\ConnectionStateType::STATE_UNKNOWN);
+ MetadataTypes\ConnectionState::get(MetadataTypes\ConnectionState::STATE_UNKNOWN);
return false;
}
@@ -166,24 +165,27 @@ public function setState(
return false;
}
+ /**
+ * @throws Metadata\Exceptions\FileNotFound
+ */
public function getState(
- Entities\Connectors\Connector|MetadataEntities\Modules\DevicesModule\IConnectorEntity $connector,
- ): MetadataTypes\ConnectionStateType
+ Entities\Connectors\Connector|MetadataEntities\DevicesModule\Connector $connector,
+ ): MetadataTypes\ConnectionState
{
- $stateProperty = $this->dataStorageRepository->findByIdentifier(
+ $stateProperty = $this->repository->findByIdentifier(
$connector->getId(),
- MetadataTypes\ConnectorPropertyIdentifierType::IDENTIFIER_STATE,
+ MetadataTypes\ConnectorPropertyIdentifier::IDENTIFIER_STATE,
);
if (
- $stateProperty instanceof MetadataEntities\Modules\DevicesModule\IConnectorDynamicPropertyEntity
+ $stateProperty instanceof MetadataEntities\DevicesModule\ConnectorDynamicProperty
&& $stateProperty->getActualValue() !== null
- && MetadataTypes\ConnectionStateType::isValidValue($stateProperty->getActualValue())
+ && MetadataTypes\ConnectionState::isValidValue($stateProperty->getActualValue())
) {
- return MetadataTypes\ConnectionStateType::get($stateProperty->getActualValue());
+ return MetadataTypes\ConnectionState::get($stateProperty->getActualValue());
}
- return MetadataTypes\ConnectionStateType::get(MetadataTypes\ConnectionStateType::STATE_UNKNOWN);
+ return MetadataTypes\ConnectionState::get(MetadataTypes\ConnectionState::STATE_UNKNOWN);
}
}
diff --git a/src/Models/States/ConnectorPropertiesManager.php b/src/Models/States/ConnectorPropertiesManager.php
index 6fbe770d..0189dca0 100644
--- a/src/Models/States/ConnectorPropertiesManager.php
+++ b/src/Models/States/ConnectorPropertiesManager.php
@@ -41,14 +41,14 @@ final class ConnectorPropertiesManager
use Nette\SmartObject;
public function __construct(
- protected IConnectorPropertiesManager|null $manager,
- private PsrEventDispatcher\EventDispatcherInterface|null $dispatcher,
+ protected readonly IConnectorPropertiesManager|null $manager,
+ private readonly PsrEventDispatcher\EventDispatcherInterface|null $dispatcher,
)
{
}
public function create(
- MetadataEntities\Modules\DevicesModule\IConnectorDynamicPropertyEntity|MetadataEntities\Modules\DevicesModule\IConnectorMappedPropertyEntity|Entities\Connectors\Properties\Dynamic $property,
+ MetadataEntities\DevicesModule\ConnectorDynamicProperty|MetadataEntities\DevicesModule\ConnectorMappedProperty|Entities\Connectors\Properties\Dynamic $property,
Utils\ArrayHash $values,
): States\ConnectorProperty
{
@@ -88,7 +88,7 @@ public function create(
}
public function update(
- MetadataEntities\Modules\DevicesModule\IConnectorDynamicPropertyEntity|MetadataEntities\Modules\DevicesModule\IConnectorMappedPropertyEntity|Entities\Connectors\Properties\Dynamic $property,
+ MetadataEntities\DevicesModule\ConnectorDynamicProperty|MetadataEntities\DevicesModule\ConnectorMappedProperty|Entities\Connectors\Properties\Dynamic $property,
States\ConnectorProperty $state,
Utils\ArrayHash $values,
): States\ConnectorProperty
@@ -130,7 +130,7 @@ public function update(
}
public function delete(
- MetadataEntities\Modules\DevicesModule\IConnectorDynamicPropertyEntity|MetadataEntities\Modules\DevicesModule\IConnectorMappedPropertyEntity|Entities\Connectors\Properties\Dynamic $property,
+ MetadataEntities\DevicesModule\ConnectorDynamicProperty|MetadataEntities\DevicesModule\ConnectorMappedProperty|Entities\Connectors\Properties\Dynamic $property,
States\ConnectorProperty $state,
): bool
{
diff --git a/src/Models/States/ConnectorPropertiesRepository.php b/src/Models/States/ConnectorPropertiesRepository.php
index f612591c..713c0a55 100644
--- a/src/Models/States/ConnectorPropertiesRepository.php
+++ b/src/Models/States/ConnectorPropertiesRepository.php
@@ -35,12 +35,12 @@ final class ConnectorPropertiesRepository
use Nette\SmartObject;
- public function __construct(protected IConnectorPropertiesRepository|null $repository)
+ public function __construct(protected readonly IConnectorPropertiesRepository|null $repository)
{
}
public function findOne(
- MetadataEntities\Modules\DevicesModule\IConnectorDynamicPropertyEntity|MetadataEntities\Modules\DevicesModule\IConnectorMappedPropertyEntity|Entities\Connectors\Properties\Dynamic $property,
+ MetadataEntities\DevicesModule\ConnectorDynamicProperty|MetadataEntities\DevicesModule\ConnectorMappedProperty|Entities\Connectors\Properties\Dynamic $property,
): States\ConnectorProperty|null
{
if ($this->repository === null) {
diff --git a/src/Models/States/DeviceConnectionStateManager.php b/src/Models/States/DeviceConnectionStateManager.php
index b19e8bfe..c24a7426 100644
--- a/src/Models/States/DeviceConnectionStateManager.php
+++ b/src/Models/States/DeviceConnectionStateManager.php
@@ -42,25 +42,28 @@ final class DeviceConnectionStateManager
private Log\LoggerInterface $logger;
public function __construct(
- private Models\Devices\DevicesRepository $devicesRepository,
- private Models\DataStorage\DevicePropertiesRepository $repository,
- private Models\Devices\Properties\PropertiesManager $manager,
- private Models\States\DevicePropertiesRepository $statesRepository,
- private Models\States\DevicePropertiesManager $statesManager,
+ private readonly Models\Devices\DevicesRepository $devicesRepository,
+ private readonly Models\DataStorage\DevicePropertiesRepository $repository,
+ private readonly Models\Devices\Properties\PropertiesManager $manager,
+ private readonly Models\States\DevicePropertiesRepository $statesRepository,
+ private readonly Models\States\DevicePropertiesManager $statesManager,
Log\LoggerInterface|null $logger = null,
)
{
$this->logger = $logger ?? new Log\NullLogger();
}
+ /**
+ * @throws Metadata\Exceptions\FileNotFound
+ */
public function setState(
- Entities\Devices\Device|MetadataEntities\Modules\DevicesModule\IDeviceEntity $device,
- MetadataTypes\ConnectionStateType $state,
+ Entities\Devices\Device|MetadataEntities\DevicesModule\Device $device,
+ MetadataTypes\ConnectionState $state,
): bool
{
$stateProperty = $this->repository->findByIdentifier(
$device->getId(),
- MetadataTypes\DevicePropertyIdentifierType::IDENTIFIER_STATE,
+ MetadataTypes\DevicePropertyIdentifier::IDENTIFIER_STATE,
);
if ($stateProperty === null) {
@@ -78,20 +81,20 @@ public function setState(
$stateProperty = $this->manager->create(Utils\ArrayHash::from([
'device' => $device,
'entity' => Entities\Devices\Properties\Dynamic::class,
- 'identifier' => MetadataTypes\ConnectorPropertyIdentifierType::IDENTIFIER_STATE,
- 'dataType' => MetadataTypes\DataTypeType::get(MetadataTypes\DataTypeType::DATA_TYPE_ENUM),
+ 'identifier' => MetadataTypes\ConnectorPropertyIdentifier::IDENTIFIER_STATE,
+ 'dataType' => MetadataTypes\DataType::get(MetadataTypes\DataType::DATA_TYPE_ENUM),
'unit' => null,
'format' => [
- MetadataTypes\ConnectionStateType::STATE_CONNECTED,
- MetadataTypes\ConnectionStateType::STATE_DISCONNECTED,
- MetadataTypes\ConnectionStateType::STATE_INIT,
- MetadataTypes\ConnectionStateType::STATE_READY,
- MetadataTypes\ConnectionStateType::STATE_RUNNING,
- MetadataTypes\ConnectionStateType::STATE_SLEEPING,
- MetadataTypes\ConnectionStateType::STATE_STOPPED,
- MetadataTypes\ConnectionStateType::STATE_LOST,
- MetadataTypes\ConnectionStateType::STATE_ALERT,
- MetadataTypes\ConnectionStateType::STATE_UNKNOWN,
+ MetadataTypes\ConnectionState::STATE_CONNECTED,
+ MetadataTypes\ConnectionState::STATE_DISCONNECTED,
+ MetadataTypes\ConnectionState::STATE_INIT,
+ MetadataTypes\ConnectionState::STATE_READY,
+ MetadataTypes\ConnectionState::STATE_RUNNING,
+ MetadataTypes\ConnectionState::STATE_SLEEPING,
+ MetadataTypes\ConnectionState::STATE_STOPPED,
+ MetadataTypes\ConnectionState::STATE_LOST,
+ MetadataTypes\ConnectionState::STATE_ALERT,
+ MetadataTypes\ConnectionState::STATE_UNKNOWN,
],
'settable' => false,
'queryable' => false,
@@ -99,7 +102,7 @@ public function setState(
}
if (
- $stateProperty instanceof MetadataEntities\Modules\DevicesModule\IDeviceDynamicPropertyEntity
+ $stateProperty instanceof MetadataEntities\DevicesModule\DeviceDynamicProperty
|| $stateProperty instanceof Entities\Devices\Properties\Dynamic
) {
try {
@@ -114,7 +117,7 @@ public function setState(
],
);
- MetadataTypes\ConnectionStateType::get(MetadataTypes\ConnectionStateType::STATE_UNKNOWN);
+ MetadataTypes\ConnectionState::get(MetadataTypes\ConnectionState::STATE_UNKNOWN);
return false;
}
@@ -167,24 +170,27 @@ public function setState(
return false;
}
+ /**
+ * @throws Metadata\Exceptions\FileNotFound
+ */
public function getState(
- Entities\Devices\Device|MetadataEntities\Modules\DevicesModule\IDeviceEntity $device,
- ): MetadataTypes\ConnectionStateType
+ Entities\Devices\Device|MetadataEntities\DevicesModule\Device $device,
+ ): MetadataTypes\ConnectionState
{
$stateProperty = $this->repository->findByIdentifier(
$device->getId(),
- MetadataTypes\DevicePropertyIdentifierType::IDENTIFIER_STATE,
+ MetadataTypes\DevicePropertyIdentifier::IDENTIFIER_STATE,
);
if (
- $stateProperty instanceof MetadataEntities\Modules\DevicesModule\IDeviceDynamicPropertyEntity
+ $stateProperty instanceof MetadataEntities\DevicesModule\DeviceDynamicProperty
&& $stateProperty->getActualValue() !== null
- && MetadataTypes\ConnectionStateType::isValidValue($stateProperty->getActualValue())
+ && MetadataTypes\ConnectionState::isValidValue($stateProperty->getActualValue())
) {
- return MetadataTypes\ConnectionStateType::get($stateProperty->getActualValue());
+ return MetadataTypes\ConnectionState::get($stateProperty->getActualValue());
}
- return MetadataTypes\ConnectionStateType::get(MetadataTypes\ConnectionStateType::STATE_UNKNOWN);
+ return MetadataTypes\ConnectionState::get(MetadataTypes\ConnectionState::STATE_UNKNOWN);
}
}
diff --git a/src/Models/States/DevicePropertiesManager.php b/src/Models/States/DevicePropertiesManager.php
index b2d1407b..f522ee49 100644
--- a/src/Models/States/DevicePropertiesManager.php
+++ b/src/Models/States/DevicePropertiesManager.php
@@ -41,14 +41,14 @@ final class DevicePropertiesManager
use Nette\SmartObject;
public function __construct(
- protected IDevicePropertiesManager|null $manager,
- private PsrEventDispatcher\EventDispatcherInterface|null $dispatcher,
+ protected readonly IDevicePropertiesManager|null $manager,
+ private readonly PsrEventDispatcher\EventDispatcherInterface|null $dispatcher,
)
{
}
public function create(
- MetadataEntities\Modules\DevicesModule\IDeviceDynamicPropertyEntity|MetadataEntities\Modules\DevicesModule\IDeviceMappedPropertyEntity|Entities\Devices\Properties\Dynamic|Entities\Devices\Properties\Mapped $property,
+ MetadataEntities\DevicesModule\DeviceDynamicProperty|MetadataEntities\DevicesModule\DeviceMappedProperty|Entities\Devices\Properties\Dynamic|Entities\Devices\Properties\Mapped $property,
Utils\ArrayHash $values,
): States\DeviceProperty
{
@@ -92,7 +92,7 @@ public function create(
}
public function update(
- MetadataEntities\Modules\DevicesModule\IDeviceDynamicPropertyEntity|MetadataEntities\Modules\DevicesModule\IDeviceMappedPropertyEntity|Entities\Devices\Properties\Dynamic|Entities\Devices\Properties\Mapped $property,
+ MetadataEntities\DevicesModule\DeviceDynamicProperty|MetadataEntities\DevicesModule\DeviceMappedProperty|Entities\Devices\Properties\Dynamic|Entities\Devices\Properties\Mapped $property,
States\DeviceProperty $state,
Utils\ArrayHash $values,
): States\DeviceProperty
@@ -138,7 +138,7 @@ public function update(
}
public function delete(
- MetadataEntities\Modules\DevicesModule\IDeviceDynamicPropertyEntity|MetadataEntities\Modules\DevicesModule\IDeviceMappedPropertyEntity|Entities\Devices\Properties\Dynamic|Entities\Devices\Properties\Mapped $property,
+ MetadataEntities\DevicesModule\DeviceDynamicProperty|MetadataEntities\DevicesModule\DeviceMappedProperty|Entities\Devices\Properties\Dynamic|Entities\Devices\Properties\Mapped $property,
States\DeviceProperty $state,
): bool
{
diff --git a/src/Models/States/DevicePropertiesRepository.php b/src/Models/States/DevicePropertiesRepository.php
index 6111c49e..f0751881 100644
--- a/src/Models/States/DevicePropertiesRepository.php
+++ b/src/Models/States/DevicePropertiesRepository.php
@@ -35,12 +35,12 @@ final class DevicePropertiesRepository
use Nette\SmartObject;
- public function __construct(protected IDevicePropertiesRepository|null $repository)
+ public function __construct(protected readonly IDevicePropertiesRepository|null $repository)
{
}
public function findOne(
- MetadataEntities\Modules\DevicesModule\IDeviceDynamicPropertyEntity|MetadataEntities\Modules\DevicesModule\IDeviceMappedPropertyEntity|Entities\Devices\Properties\Dynamic|Entities\Devices\Properties\Mapped $property,
+ MetadataEntities\DevicesModule\DeviceDynamicProperty|MetadataEntities\DevicesModule\DeviceMappedProperty|Entities\Devices\Properties\Dynamic|Entities\Devices\Properties\Mapped $property,
): States\DeviceProperty|null
{
if ($this->repository === null) {
diff --git a/src/Models/States/DevicePropertyStateManager.php b/src/Models/States/DevicePropertyStateManager.php
index f412242d..6af1fd79 100644
--- a/src/Models/States/DevicePropertyStateManager.php
+++ b/src/Models/States/DevicePropertyStateManager.php
@@ -39,8 +39,8 @@ final class DevicePropertyStateManager
private Log\LoggerInterface $logger;
public function __construct(
- private DevicesModuleModels\States\DevicePropertiesRepository $devicePropertyStateRepository,
- private DevicesModuleModels\States\DevicePropertiesManager $devicePropertiesStatesManager,
+ private readonly DevicesModuleModels\States\DevicePropertiesRepository $devicePropertyStateRepository,
+ private readonly DevicesModuleModels\States\DevicePropertiesManager $devicePropertiesStatesManager,
Log\LoggerInterface|null $logger,
)
{
@@ -48,7 +48,7 @@ public function __construct(
}
public function setValue(
- Metadata\Entities\Modules\DevicesModule\IDeviceDynamicPropertyEntity $property,
+ Metadata\Entities\DevicesModule\DeviceDynamicProperty $property,
Utils\ArrayHash $data,
): void
{
@@ -123,10 +123,10 @@ public function setValue(
}
/**
- * @param Metadata\Entities\Modules\DevicesModule\IDeviceDynamicPropertyEntity|Array $property
+ * @param Metadata\Entities\DevicesModule\DeviceDynamicProperty|Array $property
*/
public function setValidState(
- Metadata\Entities\Modules\DevicesModule\IDeviceDynamicPropertyEntity|array $property,
+ Metadata\Entities\DevicesModule\DeviceDynamicProperty|array $property,
bool $state,
): void
{
diff --git a/src/Models/States/IChannelPropertiesManager.php b/src/Models/States/IChannelPropertiesManager.php
index b98e9bd3..1894da73 100644
--- a/src/Models/States/IChannelPropertiesManager.php
+++ b/src/Models/States/IChannelPropertiesManager.php
@@ -32,18 +32,18 @@ interface IChannelPropertiesManager
{
public function create(
- MetadataEntities\Modules\DevicesModule\IChannelDynamicPropertyEntity|MetadataEntities\Modules\DevicesModule\IChannelMappedPropertyEntity|Entities\Channels\Properties\Dynamic|Entities\Channels\Properties\Mapped $property,
+ MetadataEntities\DevicesModule\ChannelDynamicProperty|MetadataEntities\DevicesModule\ChannelMappedProperty|Entities\Channels\Properties\Dynamic|Entities\Channels\Properties\Mapped $property,
Utils\ArrayHash $values,
): States\ChannelProperty;
public function update(
- MetadataEntities\Modules\DevicesModule\IChannelDynamicPropertyEntity|MetadataEntities\Modules\DevicesModule\IChannelMappedPropertyEntity|Entities\Channels\Properties\Dynamic|Entities\Channels\Properties\Mapped $property,
+ MetadataEntities\DevicesModule\ChannelDynamicProperty|MetadataEntities\DevicesModule\ChannelMappedProperty|Entities\Channels\Properties\Dynamic|Entities\Channels\Properties\Mapped $property,
States\ChannelProperty $state,
Utils\ArrayHash $values,
): States\ChannelProperty;
public function delete(
- MetadataEntities\Modules\DevicesModule\IChannelDynamicPropertyEntity|MetadataEntities\Modules\DevicesModule\IChannelMappedPropertyEntity|Entities\Channels\Properties\Dynamic|Entities\Channels\Properties\Mapped $property,
+ MetadataEntities\DevicesModule\ChannelDynamicProperty|MetadataEntities\DevicesModule\ChannelMappedProperty|Entities\Channels\Properties\Dynamic|Entities\Channels\Properties\Mapped $property,
States\ChannelProperty $state,
): bool;
diff --git a/src/Models/States/IChannelPropertiesRepository.php b/src/Models/States/IChannelPropertiesRepository.php
index 8f85b6f5..1a731c07 100644
--- a/src/Models/States/IChannelPropertiesRepository.php
+++ b/src/Models/States/IChannelPropertiesRepository.php
@@ -32,7 +32,7 @@ interface IChannelPropertiesRepository
{
public function findOne(
- MetadataEntities\Modules\DevicesModule\IChannelDynamicPropertyEntity|MetadataEntities\Modules\DevicesModule\IChannelMappedPropertyEntity|Entities\Channels\Properties\Dynamic|Entities\Channels\Properties\Mapped $property,
+ MetadataEntities\DevicesModule\ChannelDynamicProperty|MetadataEntities\DevicesModule\ChannelMappedProperty|Entities\Channels\Properties\Dynamic|Entities\Channels\Properties\Mapped $property,
): States\ChannelProperty|null;
public function findOneById(
diff --git a/src/Models/States/IConnectorPropertiesManager.php b/src/Models/States/IConnectorPropertiesManager.php
index 173b71ed..d6cd2d3c 100644
--- a/src/Models/States/IConnectorPropertiesManager.php
+++ b/src/Models/States/IConnectorPropertiesManager.php
@@ -32,18 +32,18 @@ interface IConnectorPropertiesManager
{
public function create(
- MetadataEntities\Modules\DevicesModule\IConnectorDynamicPropertyEntity|MetadataEntities\Modules\DevicesModule\IConnectorMappedPropertyEntity|Entities\Connectors\Properties\Dynamic $property,
+ MetadataEntities\DevicesModule\ConnectorDynamicProperty|MetadataEntities\DevicesModule\ConnectorMappedProperty|Entities\Connectors\Properties\Dynamic $property,
Utils\ArrayHash $values,
): States\ConnectorProperty;
public function update(
- MetadataEntities\Modules\DevicesModule\IConnectorDynamicPropertyEntity|MetadataEntities\Modules\DevicesModule\IConnectorMappedPropertyEntity|Entities\Connectors\Properties\Dynamic $property,
+ MetadataEntities\DevicesModule\ConnectorDynamicProperty|MetadataEntities\DevicesModule\ConnectorMappedProperty|Entities\Connectors\Properties\Dynamic $property,
States\ConnectorProperty $state,
Utils\ArrayHash $values,
): States\ConnectorProperty;
public function delete(
- MetadataEntities\Modules\DevicesModule\IConnectorDynamicPropertyEntity|MetadataEntities\Modules\DevicesModule\IConnectorMappedPropertyEntity|Entities\Connectors\Properties\Dynamic $property,
+ MetadataEntities\DevicesModule\ConnectorDynamicProperty|MetadataEntities\DevicesModule\ConnectorMappedProperty|Entities\Connectors\Properties\Dynamic $property,
States\ConnectorProperty $state,
): bool;
diff --git a/src/Models/States/IConnectorPropertiesRepository.php b/src/Models/States/IConnectorPropertiesRepository.php
index 8c0bff63..d17e4fe5 100644
--- a/src/Models/States/IConnectorPropertiesRepository.php
+++ b/src/Models/States/IConnectorPropertiesRepository.php
@@ -32,7 +32,7 @@ interface IConnectorPropertiesRepository
{
public function findOne(
- MetadataEntities\Modules\DevicesModule\IConnectorDynamicPropertyEntity|MetadataEntities\Modules\DevicesModule\IConnectorMappedPropertyEntity|Entities\Connectors\Properties\Dynamic $property,
+ MetadataEntities\DevicesModule\ConnectorDynamicProperty|MetadataEntities\DevicesModule\ConnectorMappedProperty|Entities\Connectors\Properties\Dynamic $property,
): States\ConnectorProperty|null;
public function findOneById(
diff --git a/src/Models/States/IDevicePropertiesManager.php b/src/Models/States/IDevicePropertiesManager.php
index 6296aef0..54796e2f 100644
--- a/src/Models/States/IDevicePropertiesManager.php
+++ b/src/Models/States/IDevicePropertiesManager.php
@@ -32,18 +32,18 @@ interface IDevicePropertiesManager
{
public function create(
- MetadataEntities\Modules\DevicesModule\IDeviceDynamicPropertyEntity|MetadataEntities\Modules\DevicesModule\IDeviceMappedPropertyEntity|Entities\Devices\Properties\Dynamic|Entities\Devices\Properties\Mapped $property,
+ MetadataEntities\DevicesModule\DeviceDynamicProperty|MetadataEntities\DevicesModule\DeviceMappedProperty|Entities\Devices\Properties\Dynamic|Entities\Devices\Properties\Mapped $property,
Utils\ArrayHash $values,
): States\DeviceProperty;
public function update(
- MetadataEntities\Modules\DevicesModule\IDeviceDynamicPropertyEntity|MetadataEntities\Modules\DevicesModule\IDeviceMappedPropertyEntity|Entities\Devices\Properties\Dynamic|Entities\Devices\Properties\Mapped $property,
+ MetadataEntities\DevicesModule\DeviceDynamicProperty|MetadataEntities\DevicesModule\DeviceMappedProperty|Entities\Devices\Properties\Dynamic|Entities\Devices\Properties\Mapped $property,
States\DeviceProperty $state,
Utils\ArrayHash $values,
): States\DeviceProperty;
public function delete(
- MetadataEntities\Modules\DevicesModule\IDeviceDynamicPropertyEntity|MetadataEntities\Modules\DevicesModule\IDeviceMappedPropertyEntity|Entities\Devices\Properties\Dynamic|Entities\Devices\Properties\Mapped $property,
+ MetadataEntities\DevicesModule\DeviceDynamicProperty|MetadataEntities\DevicesModule\DeviceMappedProperty|Entities\Devices\Properties\Dynamic|Entities\Devices\Properties\Mapped $property,
States\DeviceProperty $state,
): bool;
diff --git a/src/Models/States/IDevicePropertiesRepository.php b/src/Models/States/IDevicePropertiesRepository.php
index 165657ed..06656e11 100644
--- a/src/Models/States/IDevicePropertiesRepository.php
+++ b/src/Models/States/IDevicePropertiesRepository.php
@@ -32,7 +32,7 @@ interface IDevicePropertiesRepository
{
public function findOne(
- MetadataEntities\Modules\DevicesModule\IDeviceDynamicPropertyEntity|MetadataEntities\Modules\DevicesModule\IDeviceMappedPropertyEntity|Entities\Devices\Properties\Dynamic|Entities\Devices\Properties\Mapped $property,
+ MetadataEntities\DevicesModule\DeviceDynamicProperty|MetadataEntities\DevicesModule\DeviceMappedProperty|Entities\Devices\Properties\Dynamic|Entities\Devices\Properties\Mapped $property,
): States\DeviceProperty|null;
public function findOneById(Uuid\UuidInterface $id): States\DeviceProperty|null;
diff --git a/src/Router/Routes.php b/src/Router/Routes.php
index 6bae554e..f95235c9 100644
--- a/src/Router/Routes.php
+++ b/src/Router/Routes.php
@@ -46,24 +46,24 @@ class Routes
public const RELATION_ENTITY = 'relationEntity';
public function __construct(
- private bool $usePrefix,
- private Controllers\DevicesV1 $devicesV1Controller,
- private Controllers\DeviceParentsV1 $deviceParentsV1Controller,
- private Controllers\DeviceChildrenV1 $deviceChildrenV1Controller,
- private Controllers\DevicePropertiesV1 $devicePropertiesV1Controller,
- private Controllers\DevicePropertyChildrenV1 $devicePropertyChildrenV1Controller,
- private Controllers\DeviceControlsV1 $deviceControlsV1Controller,
- private Controllers\DeviceAttributesV1 $deviceAttributesV1Controller,
- private Controllers\ChannelsV1 $channelsV1Controller,
- private Controllers\ChannelPropertiesV1 $channelPropertiesV1Controller,
- private Controllers\ChannelPropertyChildrenV1 $channelPropertyChildrenV1Controller,
- private Controllers\ChannelControlsV1 $channelControlsV1Controller,
- private Controllers\ConnectorsV1 $connectorsV1Controller,
- private Controllers\ConnectorPropertiesV1 $connectorPropertiesV1Controller,
- private Controllers\ConnectorControlsV1 $connectorControlsV1Controller,
- private Middleware\Access $devicesAccessControlMiddleware,
- private SimpleAuthMiddleware\AccessMiddleware $accessControlMiddleware,
- private SimpleAuthMiddleware\UserMiddleware $userMiddleware,
+ private readonly bool $usePrefix,
+ private readonly Controllers\DevicesV1 $devicesV1Controller,
+ private readonly Controllers\DeviceParentsV1 $deviceParentsV1Controller,
+ private readonly Controllers\DeviceChildrenV1 $deviceChildrenV1Controller,
+ private readonly Controllers\DevicePropertiesV1 $devicePropertiesV1Controller,
+ private readonly Controllers\DevicePropertyChildrenV1 $devicePropertyChildrenV1Controller,
+ private readonly Controllers\DeviceControlsV1 $deviceControlsV1Controller,
+ private readonly Controllers\DeviceAttributesV1 $deviceAttributesV1Controller,
+ private readonly Controllers\ChannelsV1 $channelsV1Controller,
+ private readonly Controllers\ChannelPropertiesV1 $channelPropertiesV1Controller,
+ private readonly Controllers\ChannelPropertyChildrenV1 $channelPropertyChildrenV1Controller,
+ private readonly Controllers\ChannelControlsV1 $channelControlsV1Controller,
+ private readonly Controllers\ConnectorsV1 $connectorsV1Controller,
+ private readonly Controllers\ConnectorPropertiesV1 $connectorPropertiesV1Controller,
+ private readonly Controllers\ConnectorControlsV1 $connectorControlsV1Controller,
+ private readonly Middleware\Access $devicesAccessControlMiddleware,
+ private readonly SimpleAuthMiddleware\Access $accessControlMiddleware,
+ private readonly SimpleAuthMiddleware\User $userMiddleware,
)
{
}
diff --git a/src/Router/Validator.php b/src/Router/Validator.php
index 6a53831a..f0dae408 100644
--- a/src/Router/Validator.php
+++ b/src/Router/Validator.php
@@ -37,7 +37,7 @@ class Validator
private SlimRouterRouting\FastRouteDispatcher|null $routerDispatcher = null;
- public function __construct(private DI\Container $container)
+ public function __construct(private readonly DI\Container $container)
{
}
diff --git a/src/Schemas/Channels/Channel.php b/src/Schemas/Channels/Channel.php
index 7a8eedbc..f56a35de 100644
--- a/src/Schemas/Channels/Channel.php
+++ b/src/Schemas/Channels/Channel.php
@@ -29,19 +29,19 @@
/**
* Channel entity schema
*
- * @phpstan-extends JsonApiSchemas\JsonApiSchema
+ * @phpstan-extends JsonApiSchemas\JsonApi
*
* @package FastyBird:DevicesModule!
* @subpackage Schemas
* @author Adam Kadlec
*/
-final class Channel extends JsonApiSchemas\JsonApiSchema
+final class Channel extends JsonApiSchemas\JsonApi
{
/**
* Define entity schema type string
*/
- public const SCHEMA_TYPE = MetadataTypes\ModuleSourceType::SOURCE_MODULE_DEVICES . '/channel';
+ public const SCHEMA_TYPE = MetadataTypes\ModuleSource::SOURCE_MODULE_DEVICES . '/channel';
/**
* Define relationships names
@@ -52,7 +52,7 @@ final class Channel extends JsonApiSchemas\JsonApiSchema
public const RELATIONSHIPS_CONTROLS = 'controls';
- public function __construct(private Routing\IRouter $router)
+ public function __construct(private readonly Routing\IRouter $router)
{
}
diff --git a/src/Schemas/Channels/Controls/Control.php b/src/Schemas/Channels/Controls/Control.php
index ac497d65..526260ce 100644
--- a/src/Schemas/Channels/Controls/Control.php
+++ b/src/Schemas/Channels/Controls/Control.php
@@ -28,26 +28,26 @@
/**
* Channel control entity schema
*
- * @phpstan-extends JsonApiSchemas\JsonApiSchema
+ * @phpstan-extends JsonApiSchemas\JsonApi
*
* @package FastyBird:DevicesModule!
* @subpackage Schemas
* @author Adam Kadlec
*/
-final class Control extends JsonApiSchemas\JsonApiSchema
+final class Control extends JsonApiSchemas\JsonApi
{
/**
* Define entity schema type string
*/
- public const SCHEMA_TYPE = MetadataTypes\ModuleSourceType::SOURCE_MODULE_DEVICES . '/control/channel';
+ public const SCHEMA_TYPE = MetadataTypes\ModuleSource::SOURCE_MODULE_DEVICES . '/control/channel';
/**
* Define relationships names
*/
public const RELATIONSHIPS_CHANNEL = 'channel';
- public function __construct(private Routing\IRouter $router)
+ public function __construct(private readonly Routing\IRouter $router)
{
}
diff --git a/src/Schemas/Channels/Properties/Dynamic.php b/src/Schemas/Channels/Properties/Dynamic.php
index 2dfc843d..3375c249 100644
--- a/src/Schemas/Channels/Properties/Dynamic.php
+++ b/src/Schemas/Channels/Properties/Dynamic.php
@@ -40,12 +40,12 @@ final class Dynamic extends Property
/**
* Define entity schema type string
*/
- public const SCHEMA_TYPE = MetadataTypes\ModuleSourceType::SOURCE_MODULE_DEVICES . '/property/channel/' . MetadataTypes\PropertyTypeType::TYPE_DYNAMIC;
+ public const SCHEMA_TYPE = MetadataTypes\ModuleSource::SOURCE_MODULE_DEVICES . '/property/channel/' . MetadataTypes\PropertyType::TYPE_DYNAMIC;
public function __construct(
Routing\IRouter $router,
Models\Channels\Properties\PropertiesRepository $propertiesRepository,
- private Models\States\ChannelPropertiesRepository $propertiesStatesRepository,
+ private readonly Models\States\ChannelPropertiesRepository $propertiesStatesRepository,
)
{
parent::__construct($router, $propertiesRepository);
diff --git a/src/Schemas/Channels/Properties/Mapped.php b/src/Schemas/Channels/Properties/Mapped.php
index e82a0491..7bc66388 100644
--- a/src/Schemas/Channels/Properties/Mapped.php
+++ b/src/Schemas/Channels/Properties/Mapped.php
@@ -40,12 +40,12 @@ final class Mapped extends Property
/**
* Define entity schema type string
*/
- public const SCHEMA_TYPE = MetadataTypes\ModuleSourceType::SOURCE_MODULE_DEVICES . '/property/channel/' . MetadataTypes\PropertyTypeType::TYPE_MAPPED;
+ public const SCHEMA_TYPE = MetadataTypes\ModuleSource::SOURCE_MODULE_DEVICES . '/property/channel/' . MetadataTypes\PropertyType::TYPE_MAPPED;
public function __construct(
Routing\IRouter $router,
Models\Channels\Properties\PropertiesRepository $propertiesRepository,
- private Models\States\ChannelPropertiesRepository $propertiesStatesRepository,
+ private readonly Models\States\ChannelPropertiesRepository $propertiesStatesRepository,
)
{
parent::__construct($router, $propertiesRepository);
diff --git a/src/Schemas/Channels/Properties/Property.php b/src/Schemas/Channels/Properties/Property.php
index 60369d1d..ee89baa8 100644
--- a/src/Schemas/Channels/Properties/Property.php
+++ b/src/Schemas/Channels/Properties/Property.php
@@ -24,6 +24,7 @@
use FastyBird\JsonApi\Schemas as JsonApiSchemas;
use IPub\SlimRouter\Routing;
use Neomerx\JsonApi;
+use Throwable;
use function count;
use function strval;
@@ -31,13 +32,13 @@
* Channel property entity schema
*
* @phpstan-template T of Entities\Channels\Properties\Property
- * @phpstan-extends JsonApiSchemas\JsonApiSchema
+ * @phpstan-extends JsonApiSchemas\JsonApi
*
* @package FastyBird:DevicesModule!
* @subpackage Schemas
* @author Adam Kadlec
*/
-abstract class Property extends JsonApiSchemas\JsonApiSchema
+abstract class Property extends JsonApiSchemas\JsonApi
{
/**
@@ -50,8 +51,8 @@ abstract class Property extends JsonApiSchemas\JsonApiSchema
public const RELATIONSHIPS_CHILDREN = 'children';
public function __construct(
- private Routing\IRouter $router,
- private Models\Channels\Properties\PropertiesRepository $propertiesRepository,
+ private readonly Routing\IRouter $router,
+ private readonly Models\Channels\Properties\PropertiesRepository $propertiesRepository,
)
{
}
@@ -107,6 +108,8 @@ public function getSelfLink($property): JsonApi\Contracts\Schema\LinkInterface
*
* @phpstan-param T $property
*
+ * @throws Throwable
+ *
* @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
*/
public function getRelationships(
@@ -224,6 +227,8 @@ public function getRelationshipSelfLink(
/**
* @return Array
+ *
+ * @throws Throwable
*/
private function getChildren(Entities\Channels\Properties\Property $property): array
{
diff --git a/src/Schemas/Channels/Properties/Variable.php b/src/Schemas/Channels/Properties/Variable.php
index 106d0fe7..07eca8dd 100644
--- a/src/Schemas/Channels/Properties/Variable.php
+++ b/src/Schemas/Channels/Properties/Variable.php
@@ -37,7 +37,7 @@ final class Variable extends Property
/**
* Define entity schema type string
*/
- public const SCHEMA_TYPE = MetadataTypes\ModuleSourceType::SOURCE_MODULE_DEVICES . '/property/channel/' . MetadataTypes\PropertyTypeType::TYPE_STATIC;
+ public const SCHEMA_TYPE = MetadataTypes\ModuleSource::SOURCE_MODULE_DEVICES . '/property/channel/' . MetadataTypes\PropertyType::TYPE_VARIABLE;
public function getEntityClass(): string
{
diff --git a/src/Schemas/Connectors/Blank.php b/src/Schemas/Connectors/Blank.php
index 7f632309..f80764b7 100644
--- a/src/Schemas/Connectors/Blank.php
+++ b/src/Schemas/Connectors/Blank.php
@@ -34,7 +34,7 @@ final class Blank extends Connector
/**
* Define entity schema type string
*/
- public const SCHEMA_TYPE = MetadataTypes\ModuleSourceType::SOURCE_MODULE_DEVICES . '/connector/' . Entities\Connectors\Blank::CONNECTOR_TYPE;
+ public const SCHEMA_TYPE = MetadataTypes\ModuleSource::SOURCE_MODULE_DEVICES . '/connector/' . Entities\Connectors\Blank::CONNECTOR_TYPE;
public function getEntityClass(): string
{
diff --git a/src/Schemas/Connectors/Connector.php b/src/Schemas/Connectors/Connector.php
index 11627273..e38abe80 100644
--- a/src/Schemas/Connectors/Connector.php
+++ b/src/Schemas/Connectors/Connector.php
@@ -28,13 +28,13 @@
* Connector entity schema
*
* @phpstan-template T of Entities\Connectors\Connector
- * @phpstan-extends JsonApiSchemas\JsonApiSchema
+ * @phpstan-extends JsonApiSchemas\JsonApi
*
* @package FastyBird:DevicesModule!
* @subpackage Schemas
* @author Adam Kadlec
*/
-abstract class Connector extends JsonApiSchemas\JsonApiSchema
+abstract class Connector extends JsonApiSchemas\JsonApi
{
/**
@@ -46,7 +46,7 @@ abstract class Connector extends JsonApiSchemas\JsonApiSchema
public const RELATIONSHIPS_CONTROLS = 'controls';
- public function __construct(private Routing\IRouter $router)
+ public function __construct(private readonly Routing\IRouter $router)
{
}
diff --git a/src/Schemas/Connectors/Controls/Control.php b/src/Schemas/Connectors/Controls/Control.php
index 5d97d0ca..3be937df 100644
--- a/src/Schemas/Connectors/Controls/Control.php
+++ b/src/Schemas/Connectors/Controls/Control.php
@@ -28,26 +28,26 @@
/**
* Connector control entity schema
*
- * @phpstan-extends JsonApiSchemas\JsonApiSchema
+ * @phpstan-extends JsonApiSchemas\JsonApi
*
* @package FastyBird:DevicesModule!
* @subpackage Schemas
* @author Adam Kadlec
*/
-final class Control extends JsonApiSchemas\JsonApiSchema
+final class Control extends JsonApiSchemas\JsonApi
{
/**
* Define entity schema type string
*/
- public const SCHEMA_TYPE = MetadataTypes\ModuleSourceType::SOURCE_MODULE_DEVICES . '/control/connector';
+ public const SCHEMA_TYPE = MetadataTypes\ModuleSource::SOURCE_MODULE_DEVICES . '/control/connector';
/**
* Define relationships names
*/
public const RELATIONSHIPS_CONNECTOR = 'connector';
- public function __construct(private Routing\IRouter $router)
+ public function __construct(private readonly Routing\IRouter $router)
{
}
diff --git a/src/Schemas/Connectors/Properties/Dynamic.php b/src/Schemas/Connectors/Properties/Dynamic.php
index a202f80e..11be0dfd 100644
--- a/src/Schemas/Connectors/Properties/Dynamic.php
+++ b/src/Schemas/Connectors/Properties/Dynamic.php
@@ -40,11 +40,11 @@ final class Dynamic extends Property
/**
* Define entity schema type string
*/
- public const SCHEMA_TYPE = MetadataTypes\ModuleSourceType::SOURCE_MODULE_DEVICES . '/property/connector/' . MetadataTypes\PropertyTypeType::TYPE_DYNAMIC;
+ public const SCHEMA_TYPE = MetadataTypes\ModuleSource::SOURCE_MODULE_DEVICES . '/property/connector/' . MetadataTypes\PropertyType::TYPE_DYNAMIC;
public function __construct(
Routing\IRouter $router,
- private Models\States\ConnectorPropertiesRepository $propertiesStatesRepository,
+ private readonly Models\States\ConnectorPropertiesRepository $propertiesStatesRepository,
)
{
parent::__construct($router);
diff --git a/src/Schemas/Connectors/Properties/Property.php b/src/Schemas/Connectors/Properties/Property.php
index 16420a5e..8ad616cf 100644
--- a/src/Schemas/Connectors/Properties/Property.php
+++ b/src/Schemas/Connectors/Properties/Property.php
@@ -28,13 +28,13 @@
* Connector property entity schema
*
* @phpstan-template T of Entities\Connectors\Properties\Property
- * @phpstan-extends JsonApiSchemas\JsonApiSchema
+ * @phpstan-extends JsonApiSchemas\JsonApi
*
* @package FastyBird:DevicesModule!
* @subpackage Schemas
* @author Adam Kadlec
*/
-abstract class Property extends JsonApiSchemas\JsonApiSchema
+abstract class Property extends JsonApiSchemas\JsonApi
{
/**
@@ -42,7 +42,7 @@ abstract class Property extends JsonApiSchemas\JsonApiSchema
*/
public const RELATIONSHIPS_CONNECTOR = 'connector';
- public function __construct(private Routing\IRouter $router)
+ public function __construct(private readonly Routing\IRouter $router)
{
}
diff --git a/src/Schemas/Connectors/Properties/Variable.php b/src/Schemas/Connectors/Properties/Variable.php
index 4eb7d37b..f375adb4 100644
--- a/src/Schemas/Connectors/Properties/Variable.php
+++ b/src/Schemas/Connectors/Properties/Variable.php
@@ -37,7 +37,7 @@ final class Variable extends Property
/**
* Define entity schema type string
*/
- public const SCHEMA_TYPE = MetadataTypes\ModuleSourceType::SOURCE_MODULE_DEVICES . '/property/connector/' . MetadataTypes\PropertyTypeType::TYPE_STATIC;
+ public const SCHEMA_TYPE = MetadataTypes\ModuleSource::SOURCE_MODULE_DEVICES . '/property/connector/' . MetadataTypes\PropertyType::TYPE_VARIABLE;
public function getEntityClass(): string
{
diff --git a/src/Schemas/Devices/Attributes/Attribute.php b/src/Schemas/Devices/Attributes/Attribute.php
index 75a25c2a..59c081e1 100644
--- a/src/Schemas/Devices/Attributes/Attribute.php
+++ b/src/Schemas/Devices/Attributes/Attribute.php
@@ -29,26 +29,26 @@
/**
* Device attribute entity schema
*
- * @phpstan-extends JsonApiSchemas\JsonApiSchema
+ * @phpstan-extends JsonApiSchemas\JsonApi
*
* @package FastyBird:DevicesModule!
* @subpackage Schemas
* @author Adam Kadlec
*/
-final class Attribute extends JsonApiSchemas\JsonApiSchema
+final class Attribute extends JsonApiSchemas\JsonApi
{
/**
* Define entity schema type string
*/
- public const SCHEMA_TYPE = MetadataTypes\ModuleSourceType::SOURCE_MODULE_DEVICES . '/attribute/device';
+ public const SCHEMA_TYPE = MetadataTypes\ModuleSource::SOURCE_MODULE_DEVICES . '/attribute/device';
/**
* Define relationships names
*/
public const RELATIONSHIPS_DEVICE = 'device';
- public function __construct(private Routing\IRouter $router)
+ public function __construct(private readonly Routing\IRouter $router)
{
}
diff --git a/src/Schemas/Devices/Blank.php b/src/Schemas/Devices/Blank.php
index c379cbb4..fa7c3270 100644
--- a/src/Schemas/Devices/Blank.php
+++ b/src/Schemas/Devices/Blank.php
@@ -34,7 +34,7 @@ final class Blank extends Device
/**
* Define entity schema type string
*/
- public const SCHEMA_TYPE = MetadataTypes\ModuleSourceType::SOURCE_MODULE_DEVICES . '/device/' . Entities\Devices\Blank::DEVICE_TYPE;
+ public const SCHEMA_TYPE = MetadataTypes\ModuleSource::SOURCE_MODULE_DEVICES . '/device/' . Entities\Devices\Blank::DEVICE_TYPE;
public function getEntityClass(): string
{
diff --git a/src/Schemas/Devices/Controls/Control.php b/src/Schemas/Devices/Controls/Control.php
index 107a15b1..582c9144 100644
--- a/src/Schemas/Devices/Controls/Control.php
+++ b/src/Schemas/Devices/Controls/Control.php
@@ -28,26 +28,26 @@
/**
* Device control entity schema
*
- * @phpstan-extends JsonApiSchemas\JsonApiSchema
+ * @phpstan-extends JsonApiSchemas\JsonApi
*
* @package FastyBird:DevicesModule!
* @subpackage Schemas
* @author Adam Kadlec
*/
-final class Control extends JsonApiSchemas\JsonApiSchema
+final class Control extends JsonApiSchemas\JsonApi
{
/**
* Define entity schema type string
*/
- public const SCHEMA_TYPE = MetadataTypes\ModuleSourceType::SOURCE_MODULE_DEVICES . '/control/device';
+ public const SCHEMA_TYPE = MetadataTypes\ModuleSource::SOURCE_MODULE_DEVICES . '/control/device';
/**
* Define relationships names
*/
public const RELATIONSHIPS_DEVICE = 'device';
- public function __construct(private Routing\IRouter $router)
+ public function __construct(private readonly Routing\IRouter $router)
{
}
diff --git a/src/Schemas/Devices/Device.php b/src/Schemas/Devices/Device.php
index 2313bc15..a85252d5 100644
--- a/src/Schemas/Devices/Device.php
+++ b/src/Schemas/Devices/Device.php
@@ -24,19 +24,20 @@
use FastyBird\JsonApi\Schemas as JsonApiSchemas;
use IPub\SlimRouter\Routing;
use Neomerx\JsonApi;
+use Throwable;
use function count;
/**
* Device entity schema
*
* @phpstan-template T of Entities\Devices\Device
- * @phpstan-extends JsonApiSchemas\JsonApiSchema
+ * @phpstan-extends JsonApiSchemas\JsonApi
*
* @package FastyBird:DevicesModule!
* @subpackage Schemas
* @author Adam Kadlec
*/
-abstract class Device extends JsonApiSchemas\JsonApiSchema
+abstract class Device extends JsonApiSchemas\JsonApi
{
/**
@@ -57,9 +58,9 @@ abstract class Device extends JsonApiSchemas\JsonApiSchema
public const RELATIONSHIPS_CHILDREN = 'children';
public function __construct(
- protected Models\Devices\DevicesRepository $devicesRepository,
- protected Models\Channels\ChannelsRepository $channelsRepository,
- protected Routing\IRouter $router,
+ protected readonly Models\Devices\DevicesRepository $devicesRepository,
+ protected readonly Models\Channels\ChannelsRepository $channelsRepository,
+ protected readonly Routing\IRouter $router,
)
{
}
@@ -109,6 +110,8 @@ public function getSelfLink($device): JsonApi\Contracts\Schema\LinkInterface
*
* @phpstan-param T $device
*
+ * @throws Throwable
+ *
* @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
*/
public function getRelationships(
@@ -158,6 +161,8 @@ public function getRelationships(
/**
* @phpstan-param T $device
*
+ * @throws Throwable
+ *
* @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
*/
public function getRelationshipRelatedLink(
@@ -303,6 +308,8 @@ public function getRelationshipSelfLink(
/**
* @return Array
+ *
+ * @throws Throwable
*/
private function getChannels(Entities\Devices\Device $device): array
{
@@ -314,6 +321,8 @@ private function getChannels(Entities\Devices\Device $device): array
/**
* @return Array
+ *
+ * @throws Throwable
*/
private function getParents(Entities\Devices\Device $device): array
{
@@ -325,6 +334,8 @@ private function getParents(Entities\Devices\Device $device): array
/**
* @return Array
+ *
+ * @throws Throwable
*/
private function getChildren(Entities\Devices\Device $device): array
{
diff --git a/src/Schemas/Devices/Properties/Dynamic.php b/src/Schemas/Devices/Properties/Dynamic.php
index b242e01a..18d000f6 100644
--- a/src/Schemas/Devices/Properties/Dynamic.php
+++ b/src/Schemas/Devices/Properties/Dynamic.php
@@ -40,12 +40,12 @@ final class Dynamic extends Property
/**
* Define entity schema type string
*/
- public const SCHEMA_TYPE = MetadataTypes\ModuleSourceType::SOURCE_MODULE_DEVICES . '/property/device/' . MetadataTypes\PropertyTypeType::TYPE_DYNAMIC;
+ public const SCHEMA_TYPE = MetadataTypes\ModuleSource::SOURCE_MODULE_DEVICES . '/property/device/' . MetadataTypes\PropertyType::TYPE_DYNAMIC;
public function __construct(
Routing\IRouter $router,
Models\Devices\Properties\PropertiesRepository $propertiesRepository,
- private Models\States\DevicePropertiesRepository $propertiesStatesRepository,
+ private readonly Models\States\DevicePropertiesRepository $propertiesStatesRepository,
)
{
parent::__construct($router, $propertiesRepository);
diff --git a/src/Schemas/Devices/Properties/Mapped.php b/src/Schemas/Devices/Properties/Mapped.php
index 665ce1b5..aa88f3c2 100644
--- a/src/Schemas/Devices/Properties/Mapped.php
+++ b/src/Schemas/Devices/Properties/Mapped.php
@@ -40,12 +40,12 @@ final class Mapped extends Property
/**
* Define entity schema type string
*/
- public const SCHEMA_TYPE = MetadataTypes\ModuleSourceType::SOURCE_MODULE_DEVICES . '/property/device/' . MetadataTypes\PropertyTypeType::TYPE_MAPPED;
+ public const SCHEMA_TYPE = MetadataTypes\ModuleSource::SOURCE_MODULE_DEVICES . '/property/device/' . MetadataTypes\PropertyType::TYPE_MAPPED;
public function __construct(
Routing\IRouter $router,
Models\Devices\Properties\PropertiesRepository $propertiesRepository,
- private Models\States\DevicePropertiesRepository $propertiesStatesRepository,
+ private readonly Models\States\DevicePropertiesRepository $propertiesStatesRepository,
)
{
parent::__construct($router, $propertiesRepository);
diff --git a/src/Schemas/Devices/Properties/Property.php b/src/Schemas/Devices/Properties/Property.php
index 0762346b..3f5efb30 100644
--- a/src/Schemas/Devices/Properties/Property.php
+++ b/src/Schemas/Devices/Properties/Property.php
@@ -24,6 +24,7 @@
use FastyBird\JsonApi\Schemas as JsonApiSchemas;
use IPub\SlimRouter\Routing;
use Neomerx\JsonApi;
+use Throwable;
use function count;
use function strval;
@@ -31,13 +32,13 @@
* Device property entity schema
*
* @phpstan-template T of Entities\Devices\Properties\Property
- * @phpstan-extends JsonApiSchemas\JsonApiSchema
+ * @phpstan-extends JsonApiSchemas\JsonApi
*
* @package FastyBird:DevicesModule!
* @subpackage Schemas
* @author Adam Kadlec
*/
-abstract class Property extends JsonApiSchemas\JsonApiSchema
+abstract class Property extends JsonApiSchemas\JsonApi
{
/**
@@ -50,8 +51,8 @@ abstract class Property extends JsonApiSchemas\JsonApiSchema
public const RELATIONSHIPS_CHILDREN = 'children';
public function __construct(
- private Routing\IRouter $router,
- private Models\Devices\Properties\PropertiesRepository $propertiesRepository,
+ private readonly Routing\IRouter $router,
+ private readonly Models\Devices\Properties\PropertiesRepository $propertiesRepository,
)
{
}
@@ -104,6 +105,8 @@ public function getSelfLink($property): JsonApi\Contracts\Schema\LinkInterface
/**
* @return iterable
*
+ * @throws Throwable
+ *
* @phpstan-param T $property
*
* @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
@@ -219,6 +222,8 @@ public function getRelationshipSelfLink(
/**
* @return Array
+ *
+ * @throws Throwable
*/
private function getChildren(Entities\Devices\Properties\Property $property): array
{
diff --git a/src/Schemas/Devices/Properties/Variable.php b/src/Schemas/Devices/Properties/Variable.php
index e6170e4b..7ce6d4ff 100644
--- a/src/Schemas/Devices/Properties/Variable.php
+++ b/src/Schemas/Devices/Properties/Variable.php
@@ -37,7 +37,7 @@ final class Variable extends Property
/**
* Define entity schema type string
*/
- public const SCHEMA_TYPE = MetadataTypes\ModuleSourceType::SOURCE_MODULE_DEVICES . '/property/device/' . MetadataTypes\PropertyTypeType::TYPE_STATIC;
+ public const SCHEMA_TYPE = MetadataTypes\ModuleSource::SOURCE_MODULE_DEVICES . '/property/device/' . MetadataTypes\PropertyType::TYPE_VARIABLE;
public function getEntityClass(): string
{
diff --git a/src/Subscribers/DynamicProperties.php b/src/Subscribers/DynamicProperties.php
index 0ecd673c..376ee09f 100644
--- a/src/Subscribers/DynamicProperties.php
+++ b/src/Subscribers/DynamicProperties.php
@@ -27,6 +27,7 @@
use Nette;
use Nette\Utils;
use Symfony\Component\EventDispatcher;
+use Throwable;
use function array_merge;
/**
@@ -43,11 +44,11 @@ final class DynamicProperties implements EventDispatcher\EventSubscriberInterfac
use Nette\SmartObject;
public function __construct(
- private Models\DataStorage\ConnectorPropertiesRepository $connectorPropertiesRepository,
- private Models\DataStorage\DevicePropertiesRepository $devicePropertiesRepository,
- private Models\DataStorage\ChannelPropertiesRepository $channelPropertiesRepository,
- private ExchangeEntities\EntityFactory $entityFactory,
- private ExchangePublisher\IPublisher|null $publisher = null,
+ private readonly Models\DataStorage\ConnectorPropertiesRepository $connectorPropertiesRepository,
+ private readonly Models\DataStorage\DevicePropertiesRepository $devicePropertiesRepository,
+ private readonly Models\DataStorage\ChannelPropertiesRepository $channelPropertiesRepository,
+ private readonly ExchangeEntities\EntityFactory $entityFactory,
+ private readonly ExchangePublisher\Container|null $publisher = null,
)
{
}
@@ -65,8 +66,9 @@ public static function getSubscribedEvents(): array
}
/**
- * @throws MetadataExceptions\FileNotFoundException
+ * @throws MetadataExceptions\FileNotFound
* @throws Utils\JsonException
+ * @throws Throwable
*/
public function stateCreated(Events\StateEntityCreated $event): void
{
@@ -84,8 +86,9 @@ public function stateCreated(Events\StateEntityCreated $event): void
}
/**
- * @throws MetadataExceptions\FileNotFoundException
+ * @throws MetadataExceptions\FileNotFound
* @throws Utils\JsonException
+ * @throws Throwable
*/
public function stateUpdated(Events\StateEntityUpdated $event): void
{
@@ -107,8 +110,9 @@ public function stateUpdated(Events\StateEntityUpdated $event): void
}
/**
- * @throws MetadataExceptions\FileNotFoundException
+ * @throws MetadataExceptions\FileNotFound
* @throws Utils\JsonException
+ * @throws Throwable
*/
public function stateDeleted(Events\StateEntityDeleted $event): void
{
@@ -126,11 +130,12 @@ public function stateDeleted(Events\StateEntityDeleted $event): void
}
/**
- * @throws MetadataExceptions\FileNotFoundException
+ * @throws MetadataExceptions\FileNotFound
* @throws Utils\JsonException
+ * @throws Throwable
*/
private function publishEntity(
- MetadataEntities\Modules\DevicesModule\IDynamicPropertyEntity|MetadataEntities\Modules\DevicesModule\IStaticPropertyEntity|MetadataEntities\Modules\DevicesModule\IMappedPropertyEntity|Entities\Property $property,
+ MetadataEntities\DevicesModule\DynamicProperty|MetadataEntities\DevicesModule\VariableProperty|MetadataEntities\DevicesModule\MappedProperty|Entities\Property $property,
States\ConnectorProperty|States\ChannelProperty|States\DeviceProperty|null $state = null,
): void
{
@@ -139,30 +144,30 @@ private function publishEntity(
}
if (
- $property instanceof MetadataEntities\Modules\DevicesModule\IConnectorDynamicPropertyEntity
- || $property instanceof MetadataEntities\Modules\DevicesModule\IConnectorMappedPropertyEntity
+ $property instanceof MetadataEntities\DevicesModule\ConnectorDynamicProperty
+ || $property instanceof MetadataEntities\DevicesModule\ConnectorMappedProperty
|| $property instanceof Entities\Connectors\Properties\Property
) {
- $routingKey = MetadataTypes\RoutingKeyType::get(
- MetadataTypes\RoutingKeyType::ROUTE_CONNECTOR_PROPERTY_ENTITY_REPORTED,
+ $routingKey = MetadataTypes\RoutingKey::get(
+ MetadataTypes\RoutingKey::ROUTE_CONNECTOR_PROPERTY_ENTITY_REPORTED,
);
} elseif (
- $property instanceof MetadataEntities\Modules\DevicesModule\IDeviceDynamicPropertyEntity
- || $property instanceof MetadataEntities\Modules\DevicesModule\IDeviceMappedPropertyEntity
+ $property instanceof MetadataEntities\DevicesModule\DeviceDynamicProperty
+ || $property instanceof MetadataEntities\DevicesModule\DeviceMappedProperty
|| $property instanceof Entities\Devices\Properties\Property
) {
- $routingKey = MetadataTypes\RoutingKeyType::get(
- MetadataTypes\RoutingKeyType::ROUTE_DEVICE_PROPERTY_ENTITY_REPORTED,
+ $routingKey = MetadataTypes\RoutingKey::get(
+ MetadataTypes\RoutingKey::ROUTE_DEVICE_PROPERTY_ENTITY_REPORTED,
);
} elseif (
- $property instanceof MetadataEntities\Modules\DevicesModule\IChannelDynamicPropertyEntity
- || $property instanceof MetadataEntities\Modules\DevicesModule\IChannelMappedPropertyEntity
+ $property instanceof MetadataEntities\DevicesModule\ChannelDynamicProperty
+ || $property instanceof MetadataEntities\DevicesModule\ChannelMappedProperty
|| $property instanceof Entities\Channels\Properties\Property
) {
- $routingKey = MetadataTypes\RoutingKeyType::get(
- MetadataTypes\RoutingKeyType::ROUTE_CHANNEL_PROPERTY_ENTITY_REPORTED,
+ $routingKey = MetadataTypes\RoutingKey::get(
+ MetadataTypes\RoutingKey::ROUTE_CHANNEL_PROPERTY_ENTITY_REPORTED,
);
} else {
@@ -170,7 +175,7 @@ private function publishEntity(
}
$this->publisher->publish(
- MetadataTypes\ModuleSourceType::get(MetadataTypes\ModuleSourceType::SOURCE_MODULE_DEVICES),
+ MetadataTypes\ModuleSource::get(MetadataTypes\ModuleSource::SOURCE_MODULE_DEVICES),
$routingKey,
$this->entityFactory->create(
Utils\Json::encode(
@@ -184,26 +189,29 @@ private function publishEntity(
);
}
+ /**
+ * @throws MetadataExceptions\FileNotFound
+ */
private function findParent(
- MetadataEntities\Modules\DevicesModule\IDynamicPropertyEntity|MetadataEntities\Modules\DevicesModule\IStaticPropertyEntity|MetadataEntities\Modules\DevicesModule\IMappedPropertyEntity|Entities\Property $property,
- ): MetadataEntities\Modules\DevicesModule\IDynamicPropertyEntity|MetadataEntities\Modules\DevicesModule\IStaticPropertyEntity|MetadataEntities\Modules\DevicesModule\IMappedPropertyEntity|Entities\Property|null
+ MetadataEntities\DevicesModule\DynamicProperty|MetadataEntities\DevicesModule\VariableProperty|MetadataEntities\DevicesModule\MappedProperty|Entities\Property $property,
+ ): MetadataEntities\DevicesModule\DynamicProperty|MetadataEntities\DevicesModule\VariableProperty|MetadataEntities\DevicesModule\MappedProperty|Entities\Property|null
{
if (
- $property instanceof MetadataEntities\Modules\DevicesModule\IConnectorDynamicPropertyEntity
- || $property instanceof MetadataEntities\Modules\DevicesModule\IConnectorMappedPropertyEntity
+ $property instanceof MetadataEntities\DevicesModule\ConnectorDynamicProperty
+ || $property instanceof MetadataEntities\DevicesModule\ConnectorMappedProperty
|| $property instanceof Entities\Connectors\Properties\Dynamic
) {
return null;
} elseif (
- $property instanceof MetadataEntities\Modules\DevicesModule\IDeviceDynamicPropertyEntity
- || $property instanceof MetadataEntities\Modules\DevicesModule\IDeviceMappedPropertyEntity
+ $property instanceof MetadataEntities\DevicesModule\DeviceDynamicProperty
+ || $property instanceof MetadataEntities\DevicesModule\DeviceMappedProperty
) {
if ($property->getParent() !== null) {
return $this->devicePropertiesRepository->findById($property->getParent());
}
} elseif (
- $property instanceof MetadataEntities\Modules\DevicesModule\IChannelDynamicPropertyEntity
- || $property instanceof MetadataEntities\Modules\DevicesModule\IChannelMappedPropertyEntity
+ $property instanceof MetadataEntities\DevicesModule\ChannelDynamicProperty
+ || $property instanceof MetadataEntities\DevicesModule\ChannelMappedProperty
) {
if ($property->getParent() !== null) {
return $this->channelPropertiesRepository->findById($property->getParent());
@@ -224,25 +232,25 @@ private function findParent(
}
private function refreshRepository(
- MetadataEntities\Modules\DevicesModule\IDynamicPropertyEntity|MetadataEntities\Modules\DevicesModule\IStaticPropertyEntity|MetadataEntities\Modules\DevicesModule\IMappedPropertyEntity|Entities\Property $property,
+ MetadataEntities\DevicesModule\DynamicProperty|MetadataEntities\DevicesModule\VariableProperty|MetadataEntities\DevicesModule\MappedProperty|Entities\Property $property,
): void
{
if (
- $property instanceof MetadataEntities\Modules\DevicesModule\IConnectorDynamicPropertyEntity
- || $property instanceof MetadataEntities\Modules\DevicesModule\IConnectorMappedPropertyEntity
+ $property instanceof MetadataEntities\DevicesModule\ConnectorDynamicProperty
+ || $property instanceof MetadataEntities\DevicesModule\ConnectorMappedProperty
|| $property instanceof Entities\Connectors\Properties\Dynamic
) {
$this->connectorPropertiesRepository->reset($property->getId());
} elseif (
- $property instanceof MetadataEntities\Modules\DevicesModule\IDeviceDynamicPropertyEntity
- || $property instanceof MetadataEntities\Modules\DevicesModule\IDeviceMappedPropertyEntity
+ $property instanceof MetadataEntities\DevicesModule\DeviceDynamicProperty
+ || $property instanceof MetadataEntities\DevicesModule\DeviceMappedProperty
|| $property instanceof Entities\Devices\Properties\Dynamic
|| $property instanceof Entities\Devices\Properties\Mapped
) {
$this->devicePropertiesRepository->reset($property->getId());
} elseif (
- $property instanceof MetadataEntities\Modules\DevicesModule\IChannelDynamicPropertyEntity
- || $property instanceof MetadataEntities\Modules\DevicesModule\IChannelMappedPropertyEntity
+ $property instanceof MetadataEntities\DevicesModule\ChannelDynamicProperty
+ || $property instanceof MetadataEntities\DevicesModule\ChannelMappedProperty
|| $property instanceof Entities\Channels\Properties\Dynamic
|| $property instanceof Entities\Channels\Properties\Mapped
) {
diff --git a/src/Subscribers/ModuleEntities.php b/src/Subscribers/ModuleEntities.php
index 90db7e1d..c4c24794 100644
--- a/src/Subscribers/ModuleEntities.php
+++ b/src/Subscribers/ModuleEntities.php
@@ -30,6 +30,7 @@
use Nette;
use Nette\Utils;
use ReflectionClass;
+use Throwable;
use function array_merge;
use function count;
use function is_a;
@@ -55,16 +56,16 @@ final class ModuleEntities implements Common\EventSubscriber
private const ACTION_DELETED = 'deleted';
public function __construct(
- private ORM\EntityManagerInterface $entityManager,
- private Models\States\DevicePropertiesRepository $devicePropertiesStatesRepository,
- private Models\States\DevicePropertiesManager $devicePropertiesStatesManager,
- private Models\States\ChannelPropertiesRepository $channelPropertiesStatesRepository,
- private Models\States\ChannelPropertiesManager $channelPropertiesStatesManager,
- private Models\States\ConnectorPropertiesRepository $connectorPropertiesStatesRepository,
- private Models\States\ConnectorPropertiesManager $connectorPropertiesStatesManager,
- private DataStorage\Writer $configurationDataWriter,
- private ExchangeEntities\EntityFactory $entityFactory,
- private ExchangePublisher\Publisher|null $publisher = null,
+ private readonly ORM\EntityManagerInterface $entityManager,
+ private readonly Models\States\DevicePropertiesRepository $devicePropertiesStatesRepository,
+ private readonly Models\States\DevicePropertiesManager $devicePropertiesStatesManager,
+ private readonly Models\States\ChannelPropertiesRepository $channelPropertiesStatesRepository,
+ private readonly Models\States\ChannelPropertiesManager $channelPropertiesStatesManager,
+ private readonly Models\States\ConnectorPropertiesRepository $connectorPropertiesStatesRepository,
+ private readonly Models\States\ConnectorPropertiesManager $connectorPropertiesStatesManager,
+ private readonly DataStorage\Writer $configurationDataWriter,
+ private readonly ExchangeEntities\EntityFactory $entityFactory,
+ private readonly ExchangePublisher\Publisher|null $publisher = null,
)
{
}
@@ -82,9 +83,10 @@ public function getSubscribedEvents(): array
}
/**
- * @throws MetadataExceptions\FileNotFoundException
+ * @throws MetadataExceptions\FileNotFound
* @throws Utils\JsonException
* @throws Flysystem\FilesystemException
+ * @throws Throwable
*/
public function postPersist(ORM\Event\LifecycleEventArgs $eventArgs): void
{
@@ -102,9 +104,10 @@ public function postPersist(ORM\Event\LifecycleEventArgs $eventArgs): void
}
/**
- * @throws MetadataExceptions\FileNotFoundException
- * @throws Utils\JsonException
* @throws Flysystem\FilesystemException
+ * @throws MetadataExceptions\FileNotFound
+ * @throws Throwable
+ * @throws Utils\JsonException
*/
public function postUpdate(ORM\Event\LifecycleEventArgs $eventArgs): void
{
@@ -137,7 +140,8 @@ public function postUpdate(ORM\Event\LifecycleEventArgs $eventArgs): void
/**
* @throws Flysystem\FilesystemException
- * @throws MetadataExceptions\FileNotFoundException
+ * @throws MetadataExceptions\FileNotFound
+ * @throws Throwable
* @throws Utils\JsonException
*/
public function postRemove(ORM\Event\LifecycleEventArgs $eventArgs): void
@@ -190,7 +194,7 @@ public function postRemove(ORM\Event\LifecycleEventArgs $eventArgs): void
/**
* @throws Utils\JsonException
- * @throws MetadataExceptions\FileNotFoundException
+ * @throws MetadataExceptions\FileNotFound
*/
private function publishEntity(Entities\Entity $entity, string $action): void
{
@@ -204,7 +208,7 @@ private function publishEntity(Entities\Entity $entity, string $action): void
case self::ACTION_CREATED:
foreach (DevicesModule\Constants::MESSAGE_BUS_CREATED_ENTITIES_ROUTING_KEYS_MAPPING as $class => $routingKey) {
if (is_a($entity, $class)) {
- $publishRoutingKey = MetadataTypes\RoutingKeyType::get($routingKey);
+ $publishRoutingKey = MetadataTypes\RoutingKey::get($routingKey);
}
}
@@ -212,7 +216,7 @@ private function publishEntity(Entities\Entity $entity, string $action): void
case self::ACTION_UPDATED:
foreach (DevicesModule\Constants::MESSAGE_BUS_UPDATED_ENTITIES_ROUTING_KEYS_MAPPING as $class => $routingKey) {
if (is_a($entity, $class)) {
- $publishRoutingKey = MetadataTypes\RoutingKeyType::get($routingKey);
+ $publishRoutingKey = MetadataTypes\RoutingKey::get($routingKey);
}
}
@@ -220,7 +224,7 @@ private function publishEntity(Entities\Entity $entity, string $action): void
case self::ACTION_DELETED:
foreach (DevicesModule\Constants::MESSAGE_BUS_DELETED_ENTITIES_ROUTING_KEYS_MAPPING as $class => $routingKey) {
if (is_a($entity, $class)) {
- $publishRoutingKey = MetadataTypes\RoutingKeyType::get($routingKey);
+ $publishRoutingKey = MetadataTypes\RoutingKey::get($routingKey);
}
}
@@ -233,7 +237,7 @@ private function publishEntity(Entities\Entity $entity, string $action): void
$state = $this->devicePropertiesStatesRepository->findOne($entity);
$this->publisher->publish(
- MetadataTypes\ModuleSourceType::get(MetadataTypes\ModuleSourceType::SOURCE_MODULE_DEVICES),
+ MetadataTypes\ModuleSource::get(MetadataTypes\ModuleSource::SOURCE_MODULE_DEVICES),
$publishRoutingKey,
$this->entityFactory->create(
Utils\Json::encode(
@@ -248,7 +252,7 @@ private function publishEntity(Entities\Entity $entity, string $action): void
} catch (Exceptions\NotImplemented) {
$this->publisher->publish(
- MetadataTypes\ModuleSourceType::get(MetadataTypes\ModuleSourceType::SOURCE_MODULE_DEVICES),
+ MetadataTypes\ModuleSource::get(MetadataTypes\ModuleSource::SOURCE_MODULE_DEVICES),
$publishRoutingKey,
$this->entityFactory->create(Utils\Json::encode($entity->toArray()), $publishRoutingKey),
);
@@ -258,7 +262,7 @@ private function publishEntity(Entities\Entity $entity, string $action): void
$state = $this->channelPropertiesStatesRepository->findOne($entity);
$this->publisher->publish(
- MetadataTypes\ModuleSourceType::get(MetadataTypes\ModuleSourceType::SOURCE_MODULE_DEVICES),
+ MetadataTypes\ModuleSource::get(MetadataTypes\ModuleSource::SOURCE_MODULE_DEVICES),
$publishRoutingKey,
$this->entityFactory->create(
Utils\Json::encode(
@@ -273,7 +277,7 @@ private function publishEntity(Entities\Entity $entity, string $action): void
} catch (Exceptions\NotImplemented) {
$this->publisher->publish(
- MetadataTypes\ModuleSourceType::get(MetadataTypes\ModuleSourceType::SOURCE_MODULE_DEVICES),
+ MetadataTypes\ModuleSource::get(MetadataTypes\ModuleSource::SOURCE_MODULE_DEVICES),
$publishRoutingKey,
$this->entityFactory->create(Utils\Json::encode($entity->toArray()), $publishRoutingKey),
);
@@ -283,7 +287,7 @@ private function publishEntity(Entities\Entity $entity, string $action): void
$state = $this->connectorPropertiesStatesRepository->findOne($entity);
$this->publisher->publish(
- MetadataTypes\ModuleSourceType::get(MetadataTypes\ModuleSourceType::SOURCE_MODULE_DEVICES),
+ MetadataTypes\ModuleSource::get(MetadataTypes\ModuleSource::SOURCE_MODULE_DEVICES),
$publishRoutingKey,
$this->entityFactory->create(
Utils\Json::encode(
@@ -298,14 +302,14 @@ private function publishEntity(Entities\Entity $entity, string $action): void
} catch (Exceptions\NotImplemented) {
$this->publisher->publish(
- MetadataTypes\ModuleSourceType::get(MetadataTypes\ModuleSourceType::SOURCE_MODULE_DEVICES),
+ MetadataTypes\ModuleSource::get(MetadataTypes\ModuleSource::SOURCE_MODULE_DEVICES),
$publishRoutingKey,
$this->entityFactory->create(Utils\Json::encode($entity->toArray()), $publishRoutingKey),
);
}
} else {
$this->publisher->publish(
- MetadataTypes\ModuleSourceType::get(MetadataTypes\ModuleSourceType::SOURCE_MODULE_DEVICES),
+ MetadataTypes\ModuleSource::get(MetadataTypes\ModuleSource::SOURCE_MODULE_DEVICES),
$publishRoutingKey,
$this->entityFactory->create(Utils\Json::encode($entity->toArray()), $publishRoutingKey),
);
diff --git a/src/Utilities/ValueHelper.php b/src/Utilities/ValueHelper.php
index d6df5f06..449606f3 100644
--- a/src/Utilities/ValueHelper.php
+++ b/src/Utilities/ValueHelper.php
@@ -42,23 +42,23 @@ final class ValueHelper
{
public static function normalizeValue(
- MetadataTypes\DataTypeType $dataType,
- bool|float|int|string|DateTimeInterface|MetadataTypes\ButtonPayloadType|MetadataTypes\SwitchPayloadType|null $value,
+ MetadataTypes\DataType $dataType,
+ bool|float|int|string|DateTimeInterface|MetadataTypes\ButtonPayload|MetadataTypes\SwitchPayload|null $value,
MetadataValueObjects\StringEnumFormat|MetadataValueObjects\NumberRangeFormat|MetadataValueObjects\CombinedEnumFormat|null $format = null,
float|int|string|null $invalid = null,
- ): bool|float|int|string|DateTimeInterface|MetadataTypes\ButtonPayloadType|MetadataTypes\SwitchPayloadType|null
+ ): bool|float|int|string|DateTimeInterface|MetadataTypes\ButtonPayload|MetadataTypes\SwitchPayload|null
{
if ($value === null) {
return null;
}
if (
- $dataType->equalsValue(MetadataTypes\DataTypeType::DATA_TYPE_CHAR)
- || $dataType->equalsValue(MetadataTypes\DataTypeType::DATA_TYPE_UCHAR)
- || $dataType->equalsValue(MetadataTypes\DataTypeType::DATA_TYPE_SHORT)
- || $dataType->equalsValue(MetadataTypes\DataTypeType::DATA_TYPE_USHORT)
- || $dataType->equalsValue(MetadataTypes\DataTypeType::DATA_TYPE_INT)
- || $dataType->equalsValue(MetadataTypes\DataTypeType::DATA_TYPE_UINT)
+ $dataType->equalsValue(MetadataTypes\DataType::DATA_TYPE_CHAR)
+ || $dataType->equalsValue(MetadataTypes\DataType::DATA_TYPE_UCHAR)
+ || $dataType->equalsValue(MetadataTypes\DataType::DATA_TYPE_SHORT)
+ || $dataType->equalsValue(MetadataTypes\DataType::DATA_TYPE_USHORT)
+ || $dataType->equalsValue(MetadataTypes\DataType::DATA_TYPE_INT)
+ || $dataType->equalsValue(MetadataTypes\DataType::DATA_TYPE_UINT)
) {
if ($invalid === intval($value)) {
return $invalid;
@@ -75,7 +75,7 @@ public static function normalizeValue(
}
return intval($value);
- } elseif ($dataType->equalsValue(MetadataTypes\DataTypeType::DATA_TYPE_FLOAT)) {
+ } elseif ($dataType->equalsValue(MetadataTypes\DataType::DATA_TYPE_FLOAT)) {
if ($invalid === floatval($value)) {
return $invalid;
}
@@ -91,11 +91,11 @@ public static function normalizeValue(
}
return floatval($value);
- } elseif ($dataType->equalsValue(MetadataTypes\DataTypeType::DATA_TYPE_STRING)) {
+ } elseif ($dataType->equalsValue(MetadataTypes\DataType::DATA_TYPE_STRING)) {
return $value;
- } elseif ($dataType->equalsValue(MetadataTypes\DataTypeType::DATA_TYPE_BOOLEAN)) {
+ } elseif ($dataType->equalsValue(MetadataTypes\DataType::DATA_TYPE_BOOLEAN)) {
return in_array(Utils\Strings::lower(strval($value)), ['true', 't', 'yes', 'y', '1', 'on'], true);
- } elseif ($dataType->equalsValue(MetadataTypes\DataTypeType::DATA_TYPE_DATE)) {
+ } elseif ($dataType->equalsValue(MetadataTypes\DataType::DATA_TYPE_DATE)) {
if ($value instanceof DateTime) {
return $value;
}
@@ -103,7 +103,7 @@ public static function normalizeValue(
$value = Utils\DateTime::createFromFormat('Y-m-d', strval($value));
return $value === false ? null : $value;
- } elseif ($dataType->equalsValue(MetadataTypes\DataTypeType::DATA_TYPE_TIME)) {
+ } elseif ($dataType->equalsValue(MetadataTypes\DataType::DATA_TYPE_TIME)) {
if ($value instanceof DateTime) {
return $value;
}
@@ -111,7 +111,7 @@ public static function normalizeValue(
$value = Utils\DateTime::createFromFormat('H:i:sP', strval($value));
return $value === false ? null : $value;
- } elseif ($dataType->equalsValue(MetadataTypes\DataTypeType::DATA_TYPE_DATETIME)) {
+ } elseif ($dataType->equalsValue(MetadataTypes\DataType::DATA_TYPE_DATETIME)) {
if ($value instanceof DateTime) {
return $value;
}
@@ -119,27 +119,27 @@ public static function normalizeValue(
$value = Utils\DateTime::createFromFormat(DateTimeInterface::ATOM, strval($value));
return $value === false ? null : $value;
- } elseif ($dataType->equalsValue(MetadataTypes\DataTypeType::DATA_TYPE_BUTTON)) {
- if ($value instanceof MetadataTypes\ButtonPayloadType) {
+ } elseif ($dataType->equalsValue(MetadataTypes\DataType::DATA_TYPE_BUTTON)) {
+ if ($value instanceof MetadataTypes\ButtonPayload) {
return $value;
}
- if (MetadataTypes\ButtonPayloadType::isValidValue(strval($value))) {
- return MetadataTypes\ButtonPayloadType::get($value);
+ if (MetadataTypes\ButtonPayload::isValidValue(strval($value))) {
+ return MetadataTypes\ButtonPayload::get($value);
}
return null;
- } elseif ($dataType->equalsValue(MetadataTypes\DataTypeType::DATA_TYPE_SWITCH)) {
- if ($value instanceof MetadataTypes\SwitchPayloadType) {
+ } elseif ($dataType->equalsValue(MetadataTypes\DataType::DATA_TYPE_SWITCH)) {
+ if ($value instanceof MetadataTypes\SwitchPayload) {
return $value;
}
- if (MetadataTypes\SwitchPayloadType::isValidValue(strval($value))) {
- return MetadataTypes\SwitchPayloadType::get($value);
+ if (MetadataTypes\SwitchPayload::isValidValue(strval($value))) {
+ return MetadataTypes\SwitchPayload::get($value);
}
return null;
- } elseif ($dataType->equalsValue(MetadataTypes\DataTypeType::DATA_TYPE_ENUM)) {
+ } elseif ($dataType->equalsValue(MetadataTypes\DataType::DATA_TYPE_ENUM)) {
if ($format instanceof MetadataValueObjects\StringEnumFormat) {
$filtered = array_filter(
$format->getItems(),
@@ -184,7 +184,7 @@ static function (MetadataValueObjects\CombinedEnumFormatItem|null $part) use ($v
}
public static function flattenValue(
- bool|float|int|string|DateTimeInterface|MetadataTypes\ButtonPayloadType|MetadataTypes\SwitchPayloadType|null $value,
+ bool|float|int|string|DateTimeInterface|MetadataTypes\ButtonPayload|MetadataTypes\SwitchPayload|null $value,
): bool|float|int|string|null
{
if ($value instanceof DateTimeInterface) {
diff --git a/tests/cases/Types/DatatypeTypeTest.phpt b/tests/cases/Types/DatatypeTypeTest.phpt
deleted file mode 100644
index 49f561f1..00000000
--- a/tests/cases/Types/DatatypeTypeTest.phpt
+++ /dev/null
@@ -1,55 +0,0 @@
-run();
diff --git a/tests/cases/Controllers/ChannelControlsV1ControllerTest.phpt b/tests/cases/unit/Controllers/ChannelControlsV1ControllerTest.phpt
similarity index 88%
rename from tests/cases/Controllers/ChannelControlsV1ControllerTest.phpt
rename to tests/cases/unit/Controllers/ChannelControlsV1ControllerTest.phpt
index 6dc6b0ab..2a0318b5 100644
--- a/tests/cases/Controllers/ChannelControlsV1ControllerTest.phpt
+++ b/tests/cases/unit/Controllers/ChannelControlsV1ControllerTest.phpt
@@ -1,6 +1,6 @@
setTempDirectory(TEMP_DIR);
@@ -107,7 +107,7 @@ final class ServicesTest extends BaseTestCase
$config->addParameters(['container' => ['class' => 'SystemContainer_' . md5((string) time())]]);
$config->addParameters(['appDir' => $rootDir, 'wwwDir' => $rootDir]);
- $config->addConfig(__DIR__ . '/../../common.neon');
+ $config->addConfig(__DIR__ . '/../../../common.neon');
DI\DevicesModuleExtension::register($config);
diff --git a/tests/cases/DataStorage/ReaderTest.phpt b/tests/cases/unit/DataStorage/ReaderTest.phpt
similarity index 96%
rename from tests/cases/DataStorage/ReaderTest.phpt
rename to tests/cases/unit/DataStorage/ReaderTest.phpt
index 0c90bf1f..27d87c67 100644
--- a/tests/cases/DataStorage/ReaderTest.phpt
+++ b/tests/cases/unit/DataStorage/ReaderTest.phpt
@@ -1,12 +1,12 @@
registerDatabaseSchemaFile(__DIR__ . '/../sql/dummy.data.sql');
+ $this->registerDatabaseSchemaFile(__DIR__ . '/../../sql/dummy.data.sql');
parent::setUp();
- $dateTimeFactory = Mockery::mock(DateTimeFactory\DateTimeFactory::class);
+ $dateTimeFactory = Mockery::mock(DateTimeFactory\Factory::class);
$dateTimeFactory
->shouldReceive('getNow')
->andReturn(new DateTimeImmutable('2020-04-01T12:00:00+00:00'));
$this->mockContainerService(
- DateTimeFactory\DateTimeFactory::class,
+ DateTimeFactory\Factory::class,
$dateTimeFactory,
);
}
@@ -90,7 +90,7 @@ protected function getContainer(): Nette\DI\Container
private function createContainer(): Nette\DI\Container
{
- $rootDir = __DIR__ . '/../../tests';
+ $rootDir = __DIR__ . '/../../../tests';
$config = new Nette\Configurator();
$config->setTempDirectory(TEMP_DIR);
@@ -98,7 +98,7 @@ private function createContainer(): Nette\DI\Container
$config->addParameters(['container' => ['class' => 'SystemContainer_' . md5((string) time())]]);
$config->addParameters(['appDir' => $rootDir, 'wwwDir' => $rootDir]);
- $config->addConfig(__DIR__ . '/../common.neon');
+ $config->addConfig(__DIR__ . '/../../common.neon');
foreach ($this->neonFiles as $neonFile) {
$config->addConfig($neonFile);
diff --git a/tests/cases/Entities/DeviceEntitiesTest.phpt b/tests/cases/unit/Entities/DeviceEntitiesTest.phpt
similarity index 98%
rename from tests/cases/Entities/DeviceEntitiesTest.phpt
rename to tests/cases/unit/Entities/DeviceEntitiesTest.phpt
index 69979d3e..1b654358 100644
--- a/tests/cases/Entities/DeviceEntitiesTest.phpt
+++ b/tests/cases/unit/Entities/DeviceEntitiesTest.phpt
@@ -1,6 +1,6 @@
findById(Uuid\Uuid::fromString('17c59dfa-2edd-438e-8c49-faa4e38e5a5e'));
- Assert::type(MetadataEntities\Modules\DevicesModule\IConnectorEntity::class, $connector);
+ Assert::type(MetadataEntities\DevicesModule\Connector::class, $connector);
Assert::same('Blank', $connector->getName());
Assert::same('blank', $connector->getType());
}
diff --git a/tests/cases/Models/Repositories/ChannelsRepositoryTest.phpt b/tests/cases/unit/Models/Repositories/ChannelsRepositoryTest.phpt
similarity index 94%
rename from tests/cases/Models/Repositories/ChannelsRepositoryTest.phpt
rename to tests/cases/unit/Models/Repositories/ChannelsRepositoryTest.phpt
index 3b2d09b5..2e1e6e98 100644
--- a/tests/cases/Models/Repositories/ChannelsRepositoryTest.phpt
+++ b/tests/cases/unit/Models/Repositories/ChannelsRepositoryTest.phpt
@@ -1,6 +1,6 @@
shouldReceive('publish')
- ->withArgs(function (string $source, string $key, MetadataEntities\IEntity $data): bool {
+ ->withArgs(function (string $source, string $key, MetadataEntities\Entity $data): bool {
$asArray = $data->toArray();
unset($asArray['id']);
@@ -129,7 +129,7 @@ final class EntitiesSubscriberTest extends BaseMockeryTestCase
$channelPropertiesStateManager = Mockery::mock(Models\States\ChannelPropertiesManager::class);
- $entityItem = Mockery::mock(MetadataEntities\Modules\DevicesModule\DeviceEntity::class);
+ $entityItem = Mockery::mock(MetadataEntities\DevicesModule\Device::class);
$entityItem
->shouldReceive('toArray')
->andReturn([
@@ -185,7 +185,7 @@ final class EntitiesSubscriberTest extends BaseMockeryTestCase
$publisher = Mockery::mock(ExchangePublisher\Publisher::class);
$publisher
->shouldReceive('publish')
- ->withArgs(function (string $source, string $key, MetadataEntities\IEntity $data): bool {
+ ->withArgs(function (string $source, string $key, MetadataEntities\Entity $data): bool {
$asArray = $data->toArray();
unset($asArray['id']);
@@ -230,7 +230,7 @@ final class EntitiesSubscriberTest extends BaseMockeryTestCase
$channelPropertiesStateManager = Mockery::mock(Models\States\ChannelPropertiesManager::class);
- $entityItem = Mockery::mock(MetadataEntities\Modules\DevicesModule\DeviceEntity::class);
+ $entityItem = Mockery::mock(MetadataEntities\DevicesModule\Device::class);
$entityItem
->shouldReceive('toArray')
->andReturn([
@@ -285,7 +285,7 @@ final class EntitiesSubscriberTest extends BaseMockeryTestCase
$publisher = Mockery::mock(ExchangePublisher\Publisher::class);
$publisher
->shouldReceive('publish')
- ->withArgs(function (string $source, string $key, MetadataEntities\IEntity $data): bool {
+ ->withArgs(function (string $source, string $key, MetadataEntities\Entity $data): bool {
$asArray = $data->toArray();
unset($asArray['id']);
@@ -335,7 +335,7 @@ final class EntitiesSubscriberTest extends BaseMockeryTestCase
$channelPropertiesStateManager = Mockery::mock(Models\States\ChannelPropertiesManager::class);
- $entityItem = Mockery::mock(MetadataEntities\Modules\DevicesModule\DeviceEntity::class);
+ $entityItem = Mockery::mock(MetadataEntities\DevicesModule\Device::class);
$entityItem
->shouldReceive('toArray')
->andReturn([
diff --git a/tests/cases/unit/Types/DataTypeTest.phpt b/tests/cases/unit/Types/DataTypeTest.phpt
new file mode 100644
index 00000000..0f2be850
--- /dev/null
+++ b/tests/cases/unit/Types/DataTypeTest.phpt
@@ -0,0 +1,55 @@
+run();
diff --git a/tests/tools/DummyConnectorFactory.php b/tests/tools/DummyConnectorFactory.php
index 6218c02d..c9ae0a16 100644
--- a/tests/tools/DummyConnectorFactory.php
+++ b/tests/tools/DummyConnectorFactory.php
@@ -14,7 +14,7 @@ public function getType(): string
return 'dummy';
}
- public function create(MetadataEntities\Modules\DevicesModule\IConnectorEntity $connector): Connector
+ public function create(MetadataEntities\DevicesModule\Connector $connector): Connector
{
return new DummyConnector();
}
diff --git a/tests/tools/DummyConnectorSchema.php b/tests/tools/DummyConnectorSchema.php
index 712fce1e..76cec49a 100644
--- a/tests/tools/DummyConnectorSchema.php
+++ b/tests/tools/DummyConnectorSchema.php
@@ -11,7 +11,7 @@ final class DummyConnectorSchema extends Schemas\Connectors\Connector
/**
* Define entity schema type string
*/
- public const SCHEMA_TYPE = MetadataTypes\ModuleSourceType::SOURCE_MODULE_DEVICES . '/connector/dummy';
+ public const SCHEMA_TYPE = MetadataTypes\ModuleSource::SOURCE_MODULE_DEVICES . '/connector/dummy';
public function getEntityClass(): string
{