2015-01-16 14:23:05 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace ServiceProvider;
|
|
|
|
|
2015-02-25 17:29:06 +01:00
|
|
|
use Core\Paginator;
|
2015-01-16 14:23:05 +01:00
|
|
|
use Model\Config;
|
|
|
|
use Model\Project;
|
|
|
|
use Model\Webhook;
|
|
|
|
use Pimple\Container;
|
|
|
|
use Pimple\ServiceProviderInterface;
|
|
|
|
|
|
|
|
class ClassProvider implements ServiceProviderInterface
|
|
|
|
{
|
|
|
|
private $classes = array(
|
|
|
|
'Model' => array(
|
|
|
|
'Acl',
|
|
|
|
'Action',
|
|
|
|
'Authentication',
|
|
|
|
'Board',
|
2015-04-21 17:56:16 +02:00
|
|
|
'Budget',
|
2015-01-16 14:23:05 +01:00
|
|
|
'Category',
|
|
|
|
'Color',
|
|
|
|
'Comment',
|
|
|
|
'Config',
|
2015-04-21 17:56:16 +02:00
|
|
|
'Currency',
|
2015-01-16 14:23:05 +01:00
|
|
|
'DateParser',
|
|
|
|
'File',
|
2015-04-21 17:56:16 +02:00
|
|
|
'HourlyRate',
|
2015-01-16 14:23:05 +01:00
|
|
|
'LastLogin',
|
2015-02-25 17:29:06 +01:00
|
|
|
'Link',
|
2015-01-16 14:23:05 +01:00
|
|
|
'Notification',
|
|
|
|
'Project',
|
|
|
|
'ProjectActivity',
|
|
|
|
'ProjectAnalytic',
|
2015-02-25 17:29:06 +01:00
|
|
|
'ProjectDuplication',
|
2015-01-16 14:23:05 +01:00
|
|
|
'ProjectDailySummary',
|
|
|
|
'ProjectPermission',
|
2015-02-25 17:29:06 +01:00
|
|
|
'Subtask',
|
2015-01-16 14:23:05 +01:00
|
|
|
'SubtaskExport',
|
2015-04-21 17:56:16 +02:00
|
|
|
'SubtaskForecast',
|
2015-02-25 17:29:06 +01:00
|
|
|
'SubtaskTimeTracking',
|
2015-01-16 14:23:05 +01:00
|
|
|
'Swimlane',
|
|
|
|
'Task',
|
|
|
|
'TaskCreation',
|
|
|
|
'TaskDuplication',
|
|
|
|
'TaskExport',
|
|
|
|
'TaskFinder',
|
2015-02-25 17:29:06 +01:00
|
|
|
'TaskFilter',
|
|
|
|
'TaskLink',
|
2015-01-16 14:23:05 +01:00
|
|
|
'TaskModification',
|
|
|
|
'TaskPermission',
|
|
|
|
'TaskPosition',
|
|
|
|
'TaskStatus',
|
|
|
|
'TaskValidator',
|
2015-04-21 17:56:16 +02:00
|
|
|
'Timetable',
|
|
|
|
'TimetableDay',
|
|
|
|
'TimetableWeek',
|
|
|
|
'TimetableOff',
|
|
|
|
'TimetableExtra',
|
|
|
|
'Transition',
|
2015-01-16 14:23:05 +01:00
|
|
|
'User',
|
|
|
|
'UserSession',
|
|
|
|
'Webhook',
|
|
|
|
),
|
|
|
|
'Core' => array(
|
2015-02-25 17:29:06 +01:00
|
|
|
'Helper',
|
2015-01-16 14:23:05 +01:00
|
|
|
'Template',
|
|
|
|
'Session',
|
|
|
|
'MemoryCache',
|
|
|
|
'FileCache',
|
2015-02-25 17:29:06 +01:00
|
|
|
'Request',
|
2015-04-21 17:56:16 +02:00
|
|
|
'HttpClient',
|
2015-01-16 14:23:05 +01:00
|
|
|
),
|
|
|
|
'Integration' => array(
|
|
|
|
'GitlabWebhook',
|
|
|
|
'GithubWebhook',
|
2015-02-25 17:29:06 +01:00
|
|
|
'BitbucketWebhook',
|
2015-04-21 17:56:16 +02:00
|
|
|
'Hipchat',
|
|
|
|
'SlackWebhook',
|
2015-01-16 14:23:05 +01:00
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
public function register(Container $container)
|
|
|
|
{
|
|
|
|
foreach ($this->classes as $namespace => $classes) {
|
|
|
|
|
|
|
|
foreach ($classes as $name) {
|
|
|
|
|
|
|
|
$class = '\\'.$namespace.'\\'.$name;
|
|
|
|
|
|
|
|
$container[lcfirst($name)] = function ($c) use ($class) {
|
|
|
|
return new $class($c);
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
2015-02-25 17:29:06 +01:00
|
|
|
|
|
|
|
$container['paginator'] = $container->factory(function ($c) {
|
|
|
|
return new Paginator($c);
|
|
|
|
});
|
2015-01-16 14:23:05 +01:00
|
|
|
}
|
|
|
|
}
|