Beispiel #1
0
<?php

/**
 * @file
 *   Day 1, Exercise 2
 *
 */
include __DIR__ . '/../vendor/autoload.php';
use Company\Employee;
use Company\Intern;
use Company\Payroll;
use Company\Supervisor;
$intern = new Intern('Example', 'Intern');
$intern->setTitle('Intern')->setRate('20')->setHours('30');
$employee = new Employee('Example', 'Employee');
$employee->setTitle('Employee')->setRate('60000');
$supervisor = new Supervisor('Example', 'Supervisor');
$supervisor->setTitle('Supervisor')->setRate('100000')->addEmployees([$employee, $intern]);
print_r($supervisor->getEmployees());
$payroll = new Payroll();
$payroll->addEmployee($supervisor);
$results = $payroll->run();
print_r($results);
$payroll->addEmployees([$employee, $intern]);
$results = $payroll->run();
print_r($results);
Beispiel #2
0
<?php

/**
 * @file
 *   Day 1, Exercise 1
 *
 */
include __DIR__ . '/../vendor/autoload.php';
use Company\Employee;
use Company\Intern;
use Company\Supervisor;
// Print Intern title via static.
print_r(Intern::printTitle() . PHP_EOL);
$intern = new Intern('Example', 'Employee');
$intern->setTitle('Intern');
print_r($intern->getFullName() . PHP_EOL);
print_r($intern->getTitle() . PHP_EOL);
$employee = new Employee('Example', 'Employee');
$employee->setTitle('Employee');
print_r($employee->getFullName() . PHP_EOL);
print_r($employee->getTitle() . PHP_EOL);
$supervisor = new Supervisor('Example', 'Supervisor');
$supervisor->setTitle('Supervisor')->addEmployees([$employee, $intern]);
print_r($supervisor->getFullName() . PHP_EOL);
print_r($supervisor->getTitle() . PHP_EOL);
print_r($supervisor->getEmployees());