Esempio n. 1
0
 public function execute()
 {
     // Configure the dependency injection container
     $configuration = new \Spark\Configuration\DefaultConfigurationSet();
     $configuration->apply($this->injector);
     // Configure middleware
     $this->injector->alias('\\Spark\\Middleware\\Collection', '\\Spark\\Middleware\\DefaultCollection');
     // Bootstrap the application
     $dispatcher = $this->injector->make('\\Relay\\Relay');
     $dispatcher($this->injector->make('Psr\\Http\\Message\\ServerRequestInterface'), $this->injector->make('Psr\\Http\\Message\\ResponseInterface'));
     return $this;
 }
Esempio n. 2
0
<?php

header("Access-Control-Allow-Origin: *");
// Include Composer autoloader
require __DIR__ . '/../vendor/autoload.php';
use Spark\Auth\Credentials\ExtractorInterface;
use Spark\Auth\Credentials\JsonExtractor;
use Spark\Project\Utils;
use Spark\Project\Utils\Constants;
// Configure the dependency injection container
$injector = new \Auryn\Injector();
$configuration = new \Spark\Configuration\DefaultConfigurationSet();
$configuration->apply($injector);
// Configure middleware
$injector->alias(AdapterInterface::class, Adapter::class);
$injector->alias(ExtractorInterface::class, JsonExtractor::class);
$injector->define(QueryExtractor::class, [':parameter' => 'al']);
$injector->alias('\\Spark\\Middleware\\Collection', '\\Spark\\Middleware\\DefaultCollection');
// Configure the router
$injector->prepare('\\Spark\\Router', function (\Spark\Router $router) {
    $router->get('/employee/sample', 'Spark\\Project\\Domain\\SampleEmployee');
    $router->get('/manager/sample', 'Spark\\Project\\Domain\\SampleManager');
    // As an employee, I want to know who I am working with, by being able to see the employees that are working during the same time period as me.
    $router->get('/employee/shift/buddy[/{' . Constants::SHIFT_ID . '}]', 'Spark\\Project\\Domain\\ShiftBuddy');
    // As an employee, I want to know how much I worked, by being able to get a summary of hours worked for each week.
    $router->get('/employee/shift/hours[/{' . Constants::WEEK_DATE . '}]', 'Spark\\Project\\Domain\\ShiftHours');
    // As an employee, I want to be able to contact my managers, by seeing manager contact information for my shifts.
    $router->get('/employee/manager[/{' . Constants::SHIFT_ID . '}]', 'Spark\\Project\\Domain\\EmployeeManager');
    // As an employee, I want to know when I am working, by being able to see all of the shifts assigned to me
    $router->get('/employee/shifts', 'Spark\\Project\\Domain\\EmployeeShifts');
    // As a manager, I want to schedule my employees, by creating shifts for any employee.