Completed
Push — spi_getname_change ( 9b3757...5d4921 )
by André
23:58
created

PathStringRouteBasedLimitationParser   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 14
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A parseIdFromHref() 0 4 1
1
<?php
2
/**
3
 * @license For full copyright and license information view LICENSE file distributed with this source code.
4
 */
5
namespace eZ\Publish\Core\REST\Server\Input\Parser\Limitation;
6
7
use eZ\Publish\API\Repository\Values;
8
9
/**
10
 * Generic limitation value parser.
11
 *
12
 * Instances are built with:
13
 * - The name of a route parameter, that will be searched for limitation values
14
 *   Example: "sectionId" from "/content/section/{sectionId}"
15
 * - The FQN of the limitation value object that the parser builds
16
 */
17
class PathStringRouteBasedLimitationParser extends RouteBasedLimitationParser
18
{
19
    /**
20
     * Prefixes the value parsed by the parent with a '/'.
21
     *
22
     * @param $limitationValue
23
     *
24
     * @return false|mixed
25
     */
26
    protected function parseIdFromHref($limitationValue)
27
    {
28
        return '/' . ltrim(parent::parseIdFromHref($limitationValue), '/');
29
    }
30
}
31