Skip to content

Commit

Permalink
Standardise Curl object usage throughout
Browse files Browse the repository at this point in the history
  • Loading branch information
g105b committed Oct 27, 2018
1 parent e043855 commit 9a40987
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
12 changes: 9 additions & 3 deletions src/CurlMulti.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,17 @@ public function getContent(CurlInterface $curl):string {
* @see http://php.net/manual/en/function.curl-multi-info-read.php
* @throws CurlException on failure
*/
public function infoRead(int &$msgsInQueue = null):CurlMultiInfoInterface {
return new CurlMultiInfo(curl_multi_info_read(
public function infoRead(int &$msgsInQueue = null):?CurlMultiInfoInterface {
$info = curl_multi_info_read(
$this->mh,
$msgsInQueue
));
);

if(!$info) {
return null;
}

return new CurlMultiInfo($info);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/CurlMultiInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function getResult():int {
* @see curl_multi_info_read
* Resource of type curl indicates the handle which it concerns.
*/
public function getHandle() {
return $this->handle;
public function getHandle():CurlInterface {
return CurlObjectLookup::getObjectFromHandle($this->handle);
}
}
2 changes: 1 addition & 1 deletion src/CurlMultiInfoInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ public function getResult():int;
* @see curl_multi_info_read
* Resource of type curl indicates the handle which it concerns.
*/
public function getHandle();
public function getHandle():CurlInterface;
}
2 changes: 1 addition & 1 deletion src/CurlMultiInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function getContent(CurlInterface $curl):string;
* @see http://php.net/manual/en/function.curl-multi-info-read.php
* @throws CurlException on failure
*/
public function infoRead(int &$msgsInQueue = null):CurlMultiInfoInterface;
public function infoRead(int &$msgsInQueue = null):?CurlMultiInfoInterface;

/**
* Initialises a new cURL multi handle
Expand Down

0 comments on commit 9a40987

Please sign in to comment.