|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace PhpWinTools\WmiScripting\Support\ApiObjects; |
|
4
|
|
|
|
|
5
|
|
|
use PhpWinTools\Support\COM\ComVariantWrapper; |
|
6
|
|
|
use PhpWinTools\WmiScripting\Contracts\Jsonable; |
|
7
|
|
|
use PhpWinTools\WmiScripting\Contracts\Arrayable; |
|
8
|
|
|
use PhpWinTools\WmiScripting\Contracts\HasAttributes; |
|
9
|
|
|
use PhpWinTools\WmiScripting\Contracts\CastsAttributes; |
|
10
|
|
|
use PhpWinTools\WmiScripting\Contracts\HidesAttributes; |
|
11
|
|
|
use PhpWinTools\WmiScripting\Concerns\HasHiddenAttributes; |
|
12
|
|
|
use PhpWinTools\WmiScripting\Concerns\HasCastableAttributes; |
|
13
|
|
|
use PhpWinTools\WmiScripting\Concerns\HasArrayableAttributes; |
|
14
|
|
|
|
|
15
|
|
|
/** |
|
16
|
|
|
* @link https://docs.microsoft.com/en-us/windows/win32/wmisdk/winmgmt |
|
17
|
|
|
*/ |
|
18
|
|
|
class AbstractWbemObject implements Arrayable, Jsonable, HasAttributes, CastsAttributes, HidesAttributes |
|
19
|
|
|
{ |
|
20
|
|
|
use HasArrayableAttributes, |
|
21
|
|
|
HasHiddenAttributes, |
|
22
|
|
|
HasCastableAttributes; |
|
23
|
|
|
|
|
24
|
|
|
protected $object; |
|
25
|
2 |
|
|
|
26
|
|
|
protected $merge_parent_casting = true; |
|
27
|
2 |
|
|
|
28
|
2 |
|
protected $merge_parent_hidden_attributes = true; |
|
29
|
2 |
|
|
|
30
|
|
|
protected $hidden_attributes = ['object', 'services', 'resolve_property_sets', 'config']; |
|
31
|
|
|
|
|
32
|
|
|
public function __construct(ComVariantWrapper $object) |
|
33
|
|
|
{ |
|
34
|
|
|
$this->object = $object; |
|
35
|
|
|
$this->mergeHiddenAttributes($this->hidden_attributes, $this->merge_parent_hidden_attributes); |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
public function toJson(): string |
|
39
|
|
|
{ |
|
40
|
|
|
return json_encode($this->toArray()); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
public function toString(): string |
|
44
|
|
|
{ |
|
45
|
|
|
return $this->toJson(); |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
public function __toString() |
|
49
|
|
|
{ |
|
50
|
|
|
return $this->toString(); |
|
51
|
|
|
} |
|
52
|
|
|
} |
|
53
|
|
|
|