Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 79 |
|
0.00% |
0 / 4 |
CRAP | |
0.00% |
0 / 1 |
Navigator | |
0.00% |
0 / 79 |
|
0.00% |
0 / 4 |
1332 | |
0.00% |
0 / 1 |
_getMissingProp | |
0.00% |
0 / 12 |
|
0.00% |
0 / 1 |
12 | |||
_setMissingProp | |
0.00% |
0 / 11 |
|
0.00% |
0 / 1 |
12 | |||
__get | |
0.00% |
0 / 28 |
|
0.00% |
0 / 1 |
240 | |||
__isset | |
0.00% |
0 / 28 |
|
0.00% |
0 / 1 |
240 |
1 | <?php |
2 | |
3 | // AUTOMATICALLY GENERATED. DO NOT EDIT. |
4 | // Use `composer build` to regenerate. |
5 | |
6 | namespace Wikimedia\IDLeDOM\Helper; |
7 | |
8 | trait Navigator { |
9 | |
10 | // Underscore is used to avoid conflicts with DOM-reserved names |
11 | // phpcs:disable PSR2.Methods.MethodDeclaration.Underscore |
12 | // phpcs:disable MediaWiki.NamingConventions.LowerCamelFunctionsName.FunctionName |
13 | |
14 | /** |
15 | * Handle an attempt to get a non-existing property on this |
16 | * object. The default implementation raises an exception |
17 | * but the implementor can choose a different behavior: |
18 | * return null (like JavaScript), dynamically create the |
19 | * property, etc. |
20 | * @param string $prop the name of the property requested |
21 | * @return mixed |
22 | */ |
23 | protected function _getMissingProp( string $prop ) { |
24 | $trace = debug_backtrace(); |
25 | while ( |
26 | count( $trace ) > 0 && |
27 | $trace[0]['function'] !== "__get" |
28 | ) { |
29 | array_shift( $trace ); |
30 | } |
31 | trigger_error( |
32 | 'Undefined property' . |
33 | ' via ' . ( $trace[0]['function'] ?? '' ) . '(): ' . $prop . |
34 | ' in ' . ( $trace[0]['file'] ?? '' ) . |
35 | ' on line ' . ( $trace[0]['line'] ?? '' ), |
36 | E_USER_NOTICE |
37 | ); |
38 | return null; |
39 | } |
40 | |
41 | /** |
42 | * Handle an attempt to set a non-existing property on this |
43 | * object. The default implementation raises an exception |
44 | * but the implementor can choose a different behavior: |
45 | * ignore the operation (like JavaScript), dynamically create |
46 | * the property, etc. |
47 | * @param string $prop the name of the property requested |
48 | * @param mixed $value the value to set |
49 | */ |
50 | protected function _setMissingProp( string $prop, $value ): void { |
51 | $trace = debug_backtrace(); |
52 | while ( |
53 | count( $trace ) > 0 && |
54 | $trace[0]['function'] !== "__set" |
55 | ) { |
56 | array_shift( $trace ); |
57 | } |
58 | trigger_error( |
59 | 'Undefined property' . |
60 | ' via ' . ( $trace[0]['function'] ?? '' ) . '(): ' . $prop . |
61 | ' in ' . ( $trace[0]['file'] ?? '' ) . |
62 | ' on line ' . ( $trace[0]['line'] ?? '' ), |
63 | E_USER_NOTICE |
64 | ); |
65 | } |
66 | |
67 | // phpcs:enable |
68 | |
69 | /** |
70 | * @param string $name |
71 | * @return mixed |
72 | */ |
73 | public function __get( string $name ) { |
74 | '@phan-var \Wikimedia\IDLeDOM\Navigator $this'; |
75 | // @var \Wikimedia\IDLeDOM\Navigator $this |
76 | switch ( $name ) { |
77 | case "cookieEnabled": |
78 | return $this->getCookieEnabled(); |
79 | case "appCodeName": |
80 | return $this->getAppCodeName(); |
81 | case "appName": |
82 | return $this->getAppName(); |
83 | case "appVersion": |
84 | return $this->getAppVersion(); |
85 | case "platform": |
86 | return $this->getPlatform(); |
87 | case "product": |
88 | return $this->getProduct(); |
89 | case "productSub": |
90 | return $this->getProductSub(); |
91 | case "userAgent": |
92 | return $this->getUserAgent(); |
93 | case "vendor": |
94 | return $this->getVendor(); |
95 | case "vendorSub": |
96 | return $this->getVendorSub(); |
97 | case "oscpu": |
98 | return $this->getOscpu(); |
99 | case "language": |
100 | return $this->getLanguage(); |
101 | case "onLine": |
102 | return $this->getOnLine(); |
103 | default: |
104 | break; |
105 | } |
106 | '@phan-var \Wikimedia\IDLeDOM\Helper\Navigator $this'; |
107 | // @var \Wikimedia\IDLeDOM\Helper\Navigator $this |
108 | return $this->_getMissingProp( $name ); |
109 | } |
110 | |
111 | /** |
112 | * @param string $name |
113 | * @return bool |
114 | */ |
115 | public function __isset( string $name ): bool { |
116 | '@phan-var \Wikimedia\IDLeDOM\Navigator $this'; |
117 | // @var \Wikimedia\IDLeDOM\Navigator $this |
118 | switch ( $name ) { |
119 | case "cookieEnabled": |
120 | return true; |
121 | case "appCodeName": |
122 | return true; |
123 | case "appName": |
124 | return true; |
125 | case "appVersion": |
126 | return true; |
127 | case "platform": |
128 | return true; |
129 | case "product": |
130 | return true; |
131 | case "productSub": |
132 | return true; |
133 | case "userAgent": |
134 | return true; |
135 | case "vendor": |
136 | return true; |
137 | case "vendorSub": |
138 | return true; |
139 | case "oscpu": |
140 | return true; |
141 | case "language": |
142 | return true; |
143 | case "onLine": |
144 | return true; |
145 | default: |
146 | break; |
147 | } |
148 | return false; |
149 | } |
150 | |
151 | } |