Commit 15ae9d9e authored by Sigrid Suski's avatar Sigrid Suski

status returns error message

parent eb8f01cb
......@@ -17,7 +17,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* @created Sat, Dec 3, 2016 15:22:50 by Radek Suski
* @modified 30 April 2020 by Sigrid Suski
* @modified 01 May 2020 by Sigrid Suski
*/
namespace Sobi\Communication;
......@@ -231,14 +231,6 @@ class CURL
return curl_setopt_array( $this->resource, $options );
}
/**
* @return array
*/
public function status()
{
return $this->curlStatus;
}
/**
* Sets an URL.
*
......@@ -431,7 +423,8 @@ class CURL
* @param bool $message - return string containing the last error
* @param bool $number - return error number
*
* @return string
* @return string|null
* @throws Exception
*/
public function error( $message = true, $number = true )
{
......@@ -450,4 +443,32 @@ class CURL
return null;
}
}
/**
* Returns the initialisation status as number and/or as string.
*
* @param bool $message
* @param bool $number
*
* @return string|null
* @throws Exception
*/
public function status( $message = true, $number = true )
{
$err = [];
$errno = $this->curlStatus;
if ( $number ) {
$err[] = $errno;
}
if ( $message ) {
$err[] = Framework::Txt( 'CURL_NOT_INSTALLED' );
}
if ( $errno ) {
return implode( ': ', $err );
}
else {
return null;
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment