@@ -117,7 +117,7 @@ public function loadFromFile(string $file, ?Options $options = null): Dom
117117 * @throws StrictException
118118 * @throws ClientExceptionInterface
119119 */
120- public function loadFromUrl (string $ url , ?Options $ options , ?ClientInterface $ client = null , ?RequestInterface $ request = null ): Dom
120+ public function loadFromUrl (string $ url , ?Options $ options = null , ?ClientInterface $ client = null , ?RequestInterface $ request = null ): Dom
121121 {
122122 if ($ client === null ) {
123123 $ client = new Client ();
@@ -152,20 +152,18 @@ public function loadStr(string $str, ?Options $options = null): Dom
152152 $ localOptions = $ localOptions ->setFromOptions ($ options );
153153 }
154154
155- $ html = $ this ->domCleaner ->clean ($ str , $ localOptions );
155+ $ html = $ this ->domCleaner ->clean ($ str , $ localOptions, $ this -> defaultCharset );
156156
157157 $ this ->content = new Content ($ html );
158158
159- $ this ->root = $ this ->domParser ->parse ($ localOptions , $ this ->content , strlen ($ str ));
159+ $ this ->root = $ this ->domParser ->parse ($ localOptions , $ this ->content , \ strlen ($ str ));
160160 $ this ->domParser ->detectCharset ($ localOptions , $ this ->defaultCharset , $ this ->root );
161161
162162 return $ this ;
163163 }
164164
165165 /**
166166 * Sets a global options array to be used by all load calls.
167- *
168- *
169167 */
170168 public function setOptions (Options $ options ): Dom
171169 {
@@ -177,10 +175,10 @@ public function setOptions(Options $options): Dom
177175 /**
178176 * Find elements by css selector on the root node.
179177 *
180- * @return mixed|Collection|null
181178 * @throws NotLoadedException
182- *
183179 * @throws ChildNotFoundException
180+ *
181+ * @return mixed|Collection|null
184182 */
185183 public function find (string $ selector , int $ nth = null )
186184 {
@@ -195,10 +193,10 @@ public function find(string $selector, int $nth = null)
195193 *
196194 * @param $id
197195 *
198- * @return mixed|Collection|null
199196 * @throws NotLoadedException
200- *
201197 * @throws ChildNotFoundException
198+ *
199+ * @return mixed|Collection|null
202200 */
203201 public function getElementById ($ id )
204202 {
@@ -211,10 +209,10 @@ public function getElementById($id)
211209 * Simple wrapper function that returns all elements by
212210 * tag name.
213211 *
214- * @return mixed|Collection|null
215212 * @throws NotLoadedException
216- *
217213 * @throws ChildNotFoundException
214+ *
215+ * @return mixed|Collection|null
218216 */
219217 public function getElementsByTag (string $ name )
220218 {
@@ -227,10 +225,10 @@ public function getElementsByTag(string $name)
227225 * Simple wrapper function that returns all elements by
228226 * class name.
229227 *
230- * @return mixed|Collection|null
231228 * @throws NotLoadedException
232- *
233229 * @throws ChildNotFoundException
230+ *
231+ * @return mixed|Collection|null
234232 */
235233 public function getElementsByClass (string $ class )
236234 {
@@ -250,4 +248,4 @@ private function isLoaded(): void
250248 throw new NotLoadedException ('Content is not loaded! ' );
251249 }
252250 }
253- }
251+ }
0 commit comments