ParamsListService::getRouteId()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the SF Forward Bundle.
5
 *
6
 * (c) DAOUDI Soufian <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace SfForward\Util;
13
14
use Nayjest\StrCaseConverter\Str;
15
16
/**
17
 * Class ParamsListService.
18
 */
19
class ParamsListService
20
{
21
    protected $serviceName;
22
    protected $routeId;
23
24
    /**
25
     * ParamsListService constructor.
26
     *
27
     * @param string $paramsList
28
     */
29
    public function __construct($paramsList)
30
    {
31
        list($this->serviceName, $this->routeId) = explode('&', $paramsList);
32
        $this->serviceName = str_replace('service=', '', $this->serviceName);
33
        $this->routeId = str_replace('routeId=', '', $this->routeId);
34
        $this->routeId = str_replace('_', '/', $this->routeId);
35
    }
36
37
    /**
38
     * @return string
39
     */
40
    public function getServiceName()
41
    {
42
        return Str::toSnakeCase($this->serviceName);
43
    }
44
45
    /**
46
     * @return string
47
     */
48
    public function getRouteId()
49
    {
50
        return $this->routeId;
51
    }
52
}
53