Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
100.00% |
1 / 1 |
|
100.00% |
10 / 10 |
CRAP | |
100.00% |
27 / 27 |
User | |
100.00% |
1 / 1 |
|
100.00% |
10 / 10 |
13 | |
100.00% |
27 / 27 |
__construct | |
100.00% |
1 / 1 |
2 | |
100.00% |
7 / 7 |
|||
getUser | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
setUser | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
getPassword | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
setPassword | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
getMerchant | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
setMerchant | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
getApikey | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
setApikey | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
getData | |
100.00% |
1 / 1 |
3 | |
100.00% |
8 / 8 |
<?php | |
namespace TodoPago\Data; | |
class User { | |
protected $user = null; | |
protected $password = null; | |
protected $merchant = null; | |
protected $apikey = null; | |
public function __construct($user = null, $password = null){ | |
if(is_array($user)) { | |
$this->user = $user["user"]; | |
$this->password = $user["password"]; | |
} else { | |
$this->user = $user; | |
$this->password = $password; | |
} | |
} | |
public function getUser(){ | |
return $this->user; | |
} | |
public function setUser($user){ | |
$this->user = $user; | |
} | |
public function getPassword(){ | |
return $this->password; | |
} | |
public function setPassword($password){ | |
$this->password = $password; | |
} | |
public function getMerchant(){ | |
return $this->merchant; | |
} | |
public function setMerchant($merchant){ | |
$this->merchant = $merchant; | |
} | |
public function getApikey(){ | |
return $this->apikey; | |
} | |
public function setApikey($apikey){ | |
$this->apikey = $apikey; | |
} | |
public function getData() { | |
if($this->getUser() == null) { | |
throw new \TodoPago\Exception\Data\EmptyFieldUserException(); | |
} | |
if($this->getPassword() == null) { | |
throw new \TodoPago\Exception\Data\EmptyFieldPasswordException(); | |
} | |
$data = array( | |
"USUARIO" => $this->getUser(), | |
"CLAVE" => $this->getPassword() | |
); | |
return $data; | |
} | |
} |