Skip to content

Commit d5b6179

Browse files
authored
Merge pull request #27 from NativePHP/fix/fetch-printers
Fix/fetch printers
2 parents 152e5a4 + 505efcb commit d5b6179

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

src/DataObjects/Printer.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,22 @@ public function __construct(
88
public string $name,
99
public string $displayName,
1010
public string $description,
11-
public int $status,
12-
public bool $isDefault,
1311
public array $options
1412
) {}
13+
14+
public function __get(string $name): mixed
15+
{
16+
return match ($name) {
17+
'status' => $this->handleDeprecatedProperty('status', 0),
18+
'isDefault' => $this->handleDeprecatedProperty('isDefault', false),
19+
default => throw new \InvalidArgumentException("Property '{$name}' does not exist on Printer class"),
20+
};
21+
}
22+
23+
private function handleDeprecatedProperty(string $property, mixed $defaultValue): mixed
24+
{
25+
logger()->warning("Deprecated: Printer::\${$property} property has been removed in upstream Electron and will no longer be available");
26+
27+
return $defaultValue;
28+
}
1529
}

src/System.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@ public function printers(): array
5555
data_get($printer, 'name'),
5656
data_get($printer, 'displayName'),
5757
data_get($printer, 'description'),
58-
data_get($printer, 'status'),
59-
data_get($printer, 'isDefault'),
6058
data_get($printer, 'options'),
6159
);
6260
})->toArray();

0 commit comments

Comments
 (0)