Determine the number of vacation days for each of its employees for a given year. The script should take the year of interest as its only input argument and output the name of each employee along with the respective number of vacation days for the given year.
- Each employee has a minimum of 26 vacation days
- A special contract can overwrite the minimum amount of vacation days
- Employees with an age >= 30 years get one additional vacation day every 5 years of employment
- Contracts may start on the 1st or 15th of the month
composer
php (>=8.2)
Docker (Optional for Containerized Development)
The application will not work if register_argc_argv is disabled.
- All the
coderequired to get started - Need write permission to following
directory./var/logs - Install the script
$ cd /path/to/base/directory
$ composer install --no-dev- Run the script and sample output
$ php index.php 2025
Hans Müller: 26
Angelika Fringe: 26
Peter Klever: 27
Marina Helter: 26
Sepp Meier: 26$ php index.php 2021
Hans Müller: 27
Angelika Fringe: 27
Peter Klever: 28
Marina Helter: 26
Sepp Meier: 26$ php index.php 2017
Hans Müller: 26
Angelika Fringe: 26
Peter Klever: 27
Marina Helter: Not applicable
Sepp Meier: 2.16- Follow Install instructions.
Adapt
phpunit.xml.distPHP Constant according to your setup environment.
$ cd /path/to/base/directory
$ composer update
$ ./vendor/bin/phpunit testsTest-cases, test unit and integration tests.
- Build the Docker Image
$ docker build --no-cache -t vacation_days .- Run the Container and script
$ docker run -it --rm vacation_days
$ php index.php <year>
$ ./vendor/bin/phpunit tests