Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 19 |
|
0.00% |
0 / 10 |
CRAP | |
0.00% |
0 / 1 |
| Employee | |
0.00% |
0 / 19 |
|
0.00% |
0 / 10 |
132 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |||
| getEmployee | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
6 | |||
| getActive | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setActive | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getFirstName | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setFirstName | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getLastName | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setLastName | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace BuyerKiosk\Core; |
| 4 | |
| 5 | class Employee extends Store { |
| 6 | |
| 7 | private $db; |
| 8 | public $id; |
| 9 | private $firstName; |
| 10 | private $lastName; |
| 11 | public $active; |
| 12 | |
| 13 | public function __construct($emp_id, $typeNum) { |
| 14 | parent::__construct(); |
| 15 | $this->createStore($typeNum); |
| 16 | $this->db = dbConnectByName($this->getDbName()); |
| 17 | |
| 18 | $this->getEmployee($emp_id); |
| 19 | } |
| 20 | private function getEmployee($id) { |
| 21 | $query = $this->db->query("SELECT * FROM employees WHERE employeeID = ".$id); |
| 22 | if($query) { |
| 23 | $row = $query->fetch(\PDO::FETCH_ASSOC); |
| 24 | |
| 25 | $this->setId($row['employeeID']); |
| 26 | $this->setFirstName($row['employeeFirstName']); |
| 27 | $this->setLastName($row['employeeLastName']); |
| 28 | $this->setActive($row['active']); |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | /** |
| 33 | * @return mixed |
| 34 | */ |
| 35 | public function getActive() |
| 36 | { |
| 37 | return $this->active; |
| 38 | } |
| 39 | |
| 40 | /** |
| 41 | * @param mixed $active |
| 42 | */ |
| 43 | public function setActive($active) |
| 44 | { |
| 45 | $this->active = $active; |
| 46 | } |
| 47 | |
| 48 | /** |
| 49 | * @return mixed |
| 50 | */ |
| 51 | public function getFirstName() |
| 52 | { |
| 53 | return $this->firstName; |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * @param mixed $firstName |
| 58 | */ |
| 59 | public function setFirstName($firstName) |
| 60 | { |
| 61 | $this->firstName = $firstName; |
| 62 | } |
| 63 | |
| 64 | /** |
| 65 | * @return mixed |
| 66 | */ |
| 67 | public function getId() |
| 68 | { |
| 69 | return $this->id; |
| 70 | } |
| 71 | |
| 72 | /** |
| 73 | * @param mixed $id |
| 74 | */ |
| 75 | public function setId($id) |
| 76 | { |
| 77 | $this->id = $id; |
| 78 | } |
| 79 | |
| 80 | /** |
| 81 | * @return mixed |
| 82 | */ |
| 83 | public function getLastName() |
| 84 | { |
| 85 | return $this->lastName; |
| 86 | } |
| 87 | |
| 88 | /** |
| 89 | * @param mixed $lastName |
| 90 | */ |
| 91 | public function setLastName($lastName) |
| 92 | { |
| 93 | $this->lastName = $lastName; |
| 94 | } |
| 95 | |
| 96 | } |