1 | <?php |
||
20 | trait WebTrait |
||
21 | { |
||
22 | /** |
||
23 | * Return web title |
||
24 | * |
||
25 | * @return string |
||
26 | */ |
||
27 | public function getWebTitle() |
||
31 | |||
32 | /** |
||
33 | * Return web source |
||
34 | * |
||
35 | * @return string |
||
36 | */ |
||
37 | public function getWebSource() |
||
41 | |||
42 | /** |
||
43 | * @return string |
||
44 | */ |
||
45 | protected function getServerUrl() |
||
50 | |||
51 | /** |
||
52 | * @return string |
||
53 | */ |
||
54 | protected function getSessionId() |
||
58 | |||
59 | /** |
||
60 | * @return bool |
||
61 | */ |
||
62 | public function is404() |
||
68 | |||
69 | /** |
||
70 | * Assert that page source contains given string |
||
71 | * |
||
72 | * @param string $string |
||
73 | * @return $this |
||
74 | */ |
||
75 | public function assertWebContains($string) |
||
80 | |||
81 | /** |
||
82 | * Assert that page source does not contains given string |
||
83 | * |
||
84 | * @param string $string |
||
85 | * @return $this |
||
86 | */ |
||
87 | public function assertWebNotContains($string) |
||
92 | |||
93 | /** |
||
94 | * Assert that web page is without errors |
||
95 | * |
||
96 | * @return $this |
||
97 | */ |
||
98 | protected function assertWebNotError() |
||
113 | |||
114 | /** |
||
115 | * @todo remove, deprecated |
||
116 | * @deprecated use assertWebNotError() instead |
||
117 | * @return $this |
||
118 | */ |
||
119 | protected function assertNotError() |
||
124 | |||
125 | /** |
||
126 | * Opens URI and asserts not error |
||
127 | * |
||
128 | * @param string $path |
||
129 | * @param string|null $caption |
||
130 | * @return $this |
||
131 | */ |
||
132 | protected function open($path = '', $caption = null) |
||
139 | |||
140 | /** |
||
141 | * @param string $path |
||
142 | * @param string $caption |
||
143 | * @return $this |
||
144 | * @deprecated use open() |
||
145 | * @todo remove |
||
146 | */ |
||
147 | protected function openOk($path = '', $caption = 'Home') |
||
151 | |||
152 | /** |
||
153 | * Get raw source from URL |
||
154 | * |
||
155 | * @param string $url |
||
156 | * @param null $sessId |
||
157 | * @return string |
||
158 | */ |
||
159 | protected function source($url, $sessId = null) |
||
165 | } |
||
166 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: