Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
0.00% |
0 / 1 |
|
33.33% |
1 / 3 |
CRAP | |
41.67% |
5 / 12 |
CURL | |
0.00% |
0 / 1 |
|
33.33% |
1 / 3 |
7.18 | |
41.67% |
5 / 12 |
__construct($url) | |
100.00% |
1 / 1 |
1 | |
100.00% |
5 / 5 |
|||
setOpt($optionFlag) | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
transmit($params) | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 6 |
<?php | |
/** | |
* | |
*/ | |
namespace aae\connect { | |
/** | |
* @author Axel Ancona Esselmann | |
* @package aae\connect | |
*/ | |
class CURL implements TransmitterInterface { | |
private $_ch = null; | |
public function __construct($url) { | |
//initialize and setup the curl handler | |
$this->_ch = curl_init(); | |
curl_setopt($this->_ch, CURLOPT_RETURNTRANSFER, true); | |
curl_setopt($this->_ch, CURLOPT_USERAGENT, "Mozilla/5.0 (AAE cURL; 1.0)"); | |
curl_setopt($this->_ch, CURLOPT_URL, $url); | |
} | |
public function setOpt($optionFlag) { | |
} | |
public function transmit($params) { | |
curl_setopt($this->_ch, CURLOPT_POST, count($params)); | |
curl_setopt($this->_ch, CURLOPT_POSTFIELDS, $params); | |
$response = curl_exec($this->_ch); | |
if (!$response) { | |
throw new TransmissionException("The Transmission failed", 218141511); | |
} | |
return $response; | |
} | |
} | |
} |