ProductServiceProvider::addRoutes()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 5
rs 10
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