| @@ 80-99 (lines=20) @@ | ||
| 77 | * @param ObjectArray $htmlObjectArray | |
| 78 | * @return void | |
| 79 | */ | |
| 80 | private function createRequestDefinition(UrlInterface $url, ObjectArray &$htmlObjectArray): void | |
| 81 |     { | |
| 82 | $client = $this->clientFactory->create($this->loop); | |
| 83 |         $request = $client->request('GET', $url->getUrl()); | |
| 84 |         $request->on('response', function (Response $response) use (&$htmlObjectArray) { | |
| 85 | $data = ''; | |
| 86 | $response->on( | |
| 87 | 'data', | |
| 88 |                 function ($chunk) use (&$data) { | |
| 89 | $data .= $chunk; | |
| 90 | } | |
| 91 | )->on( | |
| 92 | 'end', | |
| 93 |                 function () use (&$htmlObjectArray, &$data) { | |
| 94 | $htmlObjectArray->add(new Html($data)); | |
| 95 | } | |
| 96 | ); | |
| 97 | }); | |
| 98 | $request->end(); | |
| 99 | } | |
| 100 | } | |
| 101 | ||
| @@ 86-105 (lines=20) @@ | ||
| 83 | * @param ObjectArray $htmlObjectArray | |
| 84 | * @return void | |
| 85 | */ | |
| 86 | private function createRequestDefinition(UrlInterface $url, ObjectArray &$htmlObjectArray): void | |
| 87 |     { | |
| 88 | $client = $this->clientFactory->create($this->loop); | |
| 89 |         $request = $client->request('GET', $url->getUrl()); | |
| 90 |         $request->on('response', function (Response $response) use (&$htmlObjectArray) { | |
| 91 | $data = ''; | |
| 92 | $response->on( | |
| 93 | 'data', | |
| 94 |                 function ($chunk) use (&$data) { | |
| 95 | $data .= $chunk; | |
| 96 | } | |
| 97 | )->on( | |
| 98 | 'end', | |
| 99 |                 function () use (&$htmlObjectArray, &$data) { | |
| 100 | $htmlObjectArray->add(new Html($data)); | |
| 101 | } | |
| 102 | ); | |
| 103 | }); | |
| 104 | $request->end(); | |
| 105 | } | |
| 106 | } | |
| 107 | ||