2015-01-16 14:23:05 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace ServiceProvider;
|
|
|
|
|
2015-02-25 17:29:06 +01:00
|
|
|
use Core\Paginator;
|
2015-08-16 17:04:56 +02:00
|
|
|
use Core\OAuth2;
|
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-08-16 17:04:56 +02:00
|
|
|
'ProjectDailyColumnStats',
|
|
|
|
'ProjectDailyStats',
|
|
|
|
'ProjectIntegration',
|
2015-01-16 14:23:05 +01:00
|
|
|
'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',
|
2015-08-16 17:04:56 +02:00
|
|
|
'TaskAnalytic',
|
2015-01-16 14:23:05 +01:00
|
|
|
'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',
|
2015-08-16 17:04:56 +02:00
|
|
|
'TimetableExtra',
|
2015-04-21 17:56:16 +02:00
|
|
|
'TimetableWeek',
|
|
|
|
'TimetableOff',
|
|
|
|
'Transition',
|
2015-01-16 14:23:05 +01:00
|
|
|
'User',
|
|
|
|
'UserSession',
|
|
|
|
'Webhook',
|
|
|
|
),
|
|
|
|
'Core' => array(
|
2015-08-16 17:04:56 +02:00
|
|
|
'EmailClient',
|
2015-02-25 17:29:06 +01:00
|
|
|
'Helper',
|
2015-08-16 17:04:56 +02:00
|
|
|
'HttpClient',
|
|
|
|
'Lexer',
|
2015-01-16 14:23:05 +01:00
|
|
|
'MemoryCache',
|
2015-02-25 17:29:06 +01:00
|
|
|
'Request',
|
2015-08-16 17:04:56 +02:00
|
|
|
'Router',
|
|
|
|
'Session',
|
|
|
|
'Template',
|
2015-01-16 14:23:05 +01:00
|
|
|
),
|
|
|
|
'Integration' => array(
|
2015-02-25 17:29:06 +01:00
|
|
|
'BitbucketWebhook',
|
2015-08-16 17:04:56 +02:00
|
|
|
'GithubWebhook',
|
|
|
|
'GitlabWebhook',
|
|
|
|
'HipchatWebhook',
|
|
|
|
'Jabber',
|
|
|
|
'Mailgun',
|
|
|
|
'Postmark',
|
|
|
|
'Sendgrid',
|
2015-04-21 17:56:16 +02:00
|
|
|
'SlackWebhook',
|
2015-08-16 17:04:56 +02:00
|
|
|
'Smtp',
|
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-08-16 17:04:56 +02:00
|
|
|
|
|
|
|
$container['oauth'] = $container->factory(function ($c) {
|
|
|
|
return new OAuth2($c);
|
|
|
|
});
|
2015-01-16 14:23:05 +01:00
|
|
|
}
|
|
|
|
}
|