2017 © Pedro Peláez
 

library attendance

Attendance parser and calculator based on text input

image

aminebenhariz/attendance

Attendance parser and calculator based on text input

  • Thursday, April 14, 2016
  • by aminebenhariz
  • Repository
  • 1 Watchers
  • 1 Stars
  • 19 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

Attendance

Build Status Code Coverage Scrutinizer Code Quality, (*1)

SensioLabsInsight, (*2)

Table of Contents

Install

Via Composer, (*3)

``` bash $ composer require aminebenhariz/attendance, (*4)


## DayAttendanceLine Format

2015-12-12|08:30 (10:00-10:30) (16:00-16:30) 17:30, (*5)

  • 2015-12-12 : date (yyyy-mm-dd)
  • 08:30 : arrival time (hh:mm)
  • (10:00-10:30) : pause from 10:00 to 10:30
  • (16:00-16:30) : pause from 16:00 to 16:30
  • 17:30 : departure time (hh:mm)

Description can be added like this

2015-12-12|08:30 (10:00-10:30) (16:00-16:30) 17:30|Some Description, (*6)


## Usage ### Calculate attendance ``` php $dayAttendanceLine = '2015-12-12|08:30 (10:00-10:30) (16:00-16:30) 17:30'; $dayAttendance = DayAttendance::parseDayAttendanceLine($dayAttendanceLine); echo $dayAttendance->getDuration()->format('%H:%I:%S'); // 07:30:00 echo $dayAttendance->exportLine(); // 2015-12-12|08:30 (10:00-10:15) (12:30-13:30) (16:00-16:15) 17:30

Calculate average attendance of multiple days

``` php $day1 = DayAttendance::parseDayAttendanceLine('2015-12-14|08:31 (12:02-13:42) 17:25'); $day2 = DayAttendance::parseDayAttendanceLine('2015-12-15|08:29 (12:21-13:32) (16:12-16:22) 17:24'); $day3 = DayAttendance::parseDayAttendanceLine('2015-12-16|08:52 (12:18-13:12) 17:31'); $day4 = DayAttendance::parseDayAttendanceLine('2015-12-17|08:12 (12:21-13:52) 17:24'); $day5 = DayAttendance::parseDayAttendanceLine('2015-12-18|08:35 (12:24-13:25) 17:42');, (*7)

$attendance = new Attendance([$day1, $day2, $day3, $day4, $day5]);, (*8)

echo $attendance->getAverage()->format('%H:%I'); // 07:40, (*9)


## Requirements The following versions of PHP are supported by this version. + PHP 5.4 + PHP 5.5 + PHP 5.6 + PHP 7.0 + HHVM ## Testing ``` bash $ composer test

The Versions

14/04 2016

dev-master

9999999-dev https://github.com/aminebenhariz/Attendance

Attendance parser and calculator based on text input

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Amine Ben Hariz

time attendance

29/03 2016

0.4.1

0.4.1.0 https://github.com/aminebenhariz/Attendance

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Amine Ben Hariz

19/01 2016

0.4.0

0.4.0.0 https://github.com/aminebenhariz/Attendance

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Amine Ben Hariz

17/12 2015

0.3.0

0.3.0.0 https://github.com/aminebenhariz/Attendance

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Amine Ben Hariz

16/12 2015

0.2.0

0.2.0.0 https://github.com/aminebenhariz/Attendance

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Amine Ben Hariz

16/12 2015

0.1.0

0.1.0.0

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Amine Ben Hariz