ProductServiceProvider   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 23
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 7 1
A addRoutes() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Platine\App\Provider;
6
7
use Platine\App\Http\Action\Product\CategoryAction;
8
use Platine\App\Http\Action\Product\ProductAction;
9
use Platine\App\Model\Repository\ProductCategoryRepository;
10
use Platine\App\Model\Repository\ProductRepository;
11
use Platine\Framework\Service\ServiceProvider;
12
use Platine\Route\Router;
13
14
/**
15
* @class ProductServiceProvider
16
* @package Platine\App\Provider
17
*/
18
class ProductServiceProvider extends ServiceProvider
19
{
20
    /**
21
    * {@inheritdoc}
22
    */
23
    public function register(): void
24
    {
25
        $this->app->bind(ProductCategoryRepository::class);
26
        $this->app->bind(ProductRepository::class);
27
28
        $this->app->bind(CategoryAction::class);
29
        $this->app->bind(ProductAction::class);
30
    }
31
32
33
    /**
34
    * {@inheritdoc}
35
    */
36
    public function addRoutes(Router $router): void
37
    {
38
        $router->group('/product', function (Router $router) {
39
            $router->resource('', ProductAction::class, 'product');
40
            $router->resource('/category', CategoryAction::class, 'product_category');
41
        });
42
    }
43
}
44