Skip to content

Commit

Permalink
Add support for employee IDs in session attendace writebacks (#18)
Browse files Browse the repository at this point in the history
* Add support for employee IDs in session attendace writebacks

* Update SessionAttendanceRecord.php

Updated casing for consistency

Co-authored-by: Darren Hodges <[email protected]>
  • Loading branch information
cdplant and Hodglim authored Jul 12, 2021
1 parent 8f169dc commit 4a8babb
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Client
/**
* @var string
*/
const version = '2.1.1';
const version = '2.1.2';

/**
* Client constructor.
Expand Down
37 changes: 35 additions & 2 deletions src/Writeback/SessionAttendanceRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ class SessionAttendanceRecord
*/
private $student_id;

/**
* @var string
*/
private $employee_id;

/**
* @var string
*/
Expand Down Expand Up @@ -39,7 +44,7 @@ class SessionAttendanceRecord
/**
* Set student id
*
* @param string $date
* @param string $studentId
* @return void
* @throws InvalidAttendanceException
*/
Expand All @@ -52,6 +57,18 @@ public function setStudentId($studentId)
$this->student_id = $studentId;
}

/**
* Set employee id
*
* @param string $employeeId
* @return void
* @throws InvalidAttendanceException
*/
public function setEmployeeId($employeeId)
{
$this->employee_id = $employeeId;
}

/**
* Set date
*
Expand Down Expand Up @@ -131,6 +148,16 @@ public function getStudentId()
return $this->student_id;
}

/**
* Return the student id
*
* @return string
*/
public function getEmployeeId()
{
return $this->employee_id;
}

/**
* Return the date
*
Expand Down Expand Up @@ -180,6 +207,12 @@ public function toArray()
if ( ! empty($comment)) {
$required['comment'] = $comment;
}

$employeeId = $this->getEmployeeId();

if ( ! empty($employeeId)) {
$required['employee_id'] = $employeeId;
}

$minutesLate = $this->getMinutesLate();

Expand Down Expand Up @@ -234,4 +267,4 @@ public function getMinutesLate()
{
return $this->minutesLate;
}
}
}

0 comments on commit 4a8babb

Please sign in to comment.