| @@ 32-55 (lines=24) @@ | ||
| 29 | /** |
|
| 30 | * Class MaterialServiceProvider. |
|
| 31 | */ |
|
| 32 | class MaterialServiceProvider implements ServiceProviderInterface |
|
| 33 | { |
|
| 34 | /** |
|
| 35 | * Registers services on the given container. |
|
| 36 | * |
|
| 37 | * This method should only be used to configure services and parameters. |
|
| 38 | * It should not get services. |
|
| 39 | * |
|
| 40 | * @param Container $pimple A container instance |
|
| 41 | */ |
|
| 42 | public function register(Container $pimple) |
|
| 43 | { |
|
| 44 | $pimple['material'] = function ($pimple) { |
|
| 45 | return new Material($pimple['access_token']); |
|
| 46 | }; |
|
| 47 | ||
| 48 | $temporary = function ($pimple) { |
|
| 49 | return new Temporary($pimple['access_token']); |
|
| 50 | }; |
|
| 51 | ||
| 52 | $pimple['material_temporary'] = $temporary; |
|
| 53 | $pimple['material.temporary'] = $temporary; |
|
| 54 | } |
|
| 55 | } |
|
| 56 | ||
| @@ 36-59 (lines=24) @@ | ||
| 33 | /** |
|
| 34 | * Class UserServiceProvider. |
|
| 35 | */ |
|
| 36 | class UserServiceProvider implements ServiceProviderInterface |
|
| 37 | { |
|
| 38 | /** |
|
| 39 | * Registers services on the given container. |
|
| 40 | * |
|
| 41 | * This method should only be used to configure services and parameters. |
|
| 42 | * It should not get services. |
|
| 43 | * |
|
| 44 | * @param Container $pimple A container instance |
|
| 45 | */ |
|
| 46 | public function register(Container $pimple) |
|
| 47 | { |
|
| 48 | $pimple['user'] = function ($pimple) { |
|
| 49 | return new User($pimple['access_token']); |
|
| 50 | }; |
|
| 51 | ||
| 52 | $group = function ($pimple) { |
|
| 53 | return new Group($pimple['access_token']); |
|
| 54 | }; |
|
| 55 | ||
| 56 | $pimple['user_group'] = $group; |
|
| 57 | $pimple['user.group'] = $group; |
|
| 58 | } |
|
| 59 | } |
|
| 60 | ||