Skip to content

Commit bc3b4e6

Browse files
committed
[viera-connector] Fixed viera device installation (#303)
1 parent 73602b2 commit bc3b4e6

File tree

4 files changed

+0
-26
lines changed

4 files changed

+0
-26
lines changed

src/API/Gen1HttpApi.php

-10
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,6 @@ public function setDeviceState(
246246
{
247247
if (
248248
preg_match(self::CHANNEL_BLOCK, $blockIdentifier, $channelMatches) !== 1
249-
|| !array_key_exists('identifier', $channelMatches)
250-
|| !array_key_exists('description', $channelMatches)
251249
|| !array_key_exists('channel', $channelMatches)
252250
) {
253251
if ($async) {
@@ -933,14 +931,6 @@ private function buildSensorAction(string $property): string
933931
throw new Exceptions\InvalidState('Property identifier is not valid');
934932
}
935933

936-
if (
937-
!array_key_exists('identifier', $propertyMatches)
938-
|| !array_key_exists('type', $propertyMatches)
939-
|| !array_key_exists('description', $propertyMatches)
940-
) {
941-
throw new Exceptions\InvalidState('Property identifier is not valid');
942-
}
943-
944934
if ($propertyMatches['description'] === Types\SensorDescription::OUTPUT->value) {
945935
return 'turn';
946936
}

src/API/Gen2HttpApi.php

-8
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,6 @@ public function setDeviceState(
219219
{
220220
if (
221221
preg_match(self::PROPERTY_COMPONENT, $component, $propertyMatches) !== 1
222-
|| !array_key_exists('component', $propertyMatches)
223-
|| !array_key_exists('identifier', $propertyMatches)
224222
|| !array_key_exists('attribute', $propertyMatches)
225223
) {
226224
if ($async) {
@@ -349,7 +347,6 @@ private function parseGetDeviceConfiguration(
349347
if (
350348
$configuration instanceof Utils\ArrayHash
351349
&& preg_match(self::COMPONENT_KEY, $key, $componentMatches) === 1
352-
&& array_key_exists('component', $componentMatches)
353350
&& Types\ComponentType::tryFrom($componentMatches['component']) !== null
354351
) {
355352
if ($componentMatches['component'] === Types\ComponentType::SWITCH->value) {
@@ -432,7 +429,6 @@ private function parseGetDeviceState(
432429
if (
433430
$state instanceof Utils\ArrayHash
434431
&& preg_match(self::COMPONENT_KEY, $key, $componentMatches) === 1
435-
&& array_key_exists('component', $componentMatches)
436432
&& Types\ComponentType::tryFrom($componentMatches['component']) !== null
437433
) {
438434
if ($componentMatches['component'] === Types\ComponentType::SWITCH->value) {
@@ -567,8 +563,6 @@ private function buildComponentMethod(string $component, int|float|string|bool $
567563
{
568564
if (
569565
preg_match(self::PROPERTY_COMPONENT, $component, $componentMatches) !== 1
570-
|| !array_key_exists('component', $componentMatches)
571-
|| !array_key_exists('identifier', $componentMatches)
572566
|| !array_key_exists('attribute', $componentMatches)
573567
) {
574568
throw new Exceptions\InvalidState('Property identifier is not in expected format');
@@ -623,8 +617,6 @@ private function buildComponentAttribute(string $component): Types\ComponentActi
623617
{
624618
if (
625619
preg_match(self::PROPERTY_COMPONENT, $component, $componentMatches) !== 1
626-
|| !array_key_exists('component', $componentMatches)
627-
|| !array_key_exists('identifier', $componentMatches)
628620
|| !array_key_exists('attribute', $componentMatches)
629621
) {
630622
throw new Exceptions\InvalidState('Property identifier is not in expected format');

src/API/Gen2WsApi.php

-7
Original file line numberDiff line numberDiff line change
@@ -703,8 +703,6 @@ public function writeState(
703703

704704
if (
705705
preg_match(self::PROPERTY_COMPONENT, $component, $propertyMatches) !== 1
706-
|| !array_key_exists('component', $propertyMatches)
707-
|| !array_key_exists('identifier', $propertyMatches)
708706
|| !array_key_exists('attribute', $propertyMatches)
709707
) {
710708
return Promise\reject(new Exceptions\InvalidState('Property identifier is not in expected format'));
@@ -839,7 +837,6 @@ private function parseDeviceStatusResponse(
839837
if (
840838
$state instanceof Utils\ArrayHash
841839
&& preg_match(self::COMPONENT_KEY, $key, $componentMatches) === 1
842-
&& array_key_exists('component', $componentMatches)
843840
&& Types\ComponentType::tryFrom($componentMatches['component']) !== null
844841
) {
845842
if ($componentMatches['component'] === Types\ComponentType::SWITCH->value) {
@@ -1086,8 +1083,6 @@ private function buildComponentMethod(string $component, int|float|string|bool $
10861083
{
10871084
if (
10881085
preg_match(self::PROPERTY_COMPONENT, $component, $componentMatches) !== 1
1089-
|| !array_key_exists('component', $componentMatches)
1090-
|| !array_key_exists('identifier', $componentMatches)
10911086
|| !array_key_exists('attribute', $componentMatches)
10921087
) {
10931088
throw new Exceptions\InvalidState('Property identifier is not in expected format');
@@ -1142,8 +1137,6 @@ private function buildComponentAttribute(string $component): Types\ComponentActi
11421137
{
11431138
if (
11441139
preg_match(self::PROPERTY_COMPONENT, $component, $componentMatches) !== 1
1145-
|| !array_key_exists('component', $componentMatches)
1146-
|| !array_key_exists('identifier', $componentMatches)
11471140
|| !array_key_exists('attribute', $componentMatches)
11481141
) {
11491142
throw new Exceptions\InvalidState('Property identifier is not in expected format');

src/Clients/Discovery.php

-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,6 @@ private function discoverLocalDevices(): void
199199
if (
200200
$sender !== null
201201
&& preg_match(self::MATCH_IP_ADDRESS_PORT, $sender, $matches) === 1
202-
&& array_key_exists('address', $matches)
203202
&& array_key_exists('port', $matches)
204203
) {
205204
$serviceIpAddress = $matches['address'];

0 commit comments

Comments
 (0)