Completed
Push — rest_role_limitation_href ( 1f459a...8a17ac )
by
unknown
28:44
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 1
Metric Value
wmc 1
c 1
b 0
f 1
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\Core\REST\Common\Input\BaseParser;
8
use eZ\Publish\Core\REST\Common\Input\ParsingDispatcher;
9
use eZ\Publish\Core\REST\Common\Exceptions;
10
use eZ\Publish\API\Repository\Values;
11
12
/**
13
 * Generic limitation value parser.
14
 *
15
 * Instances are built with:
16
 * - The name of a route parameter, that will be searched for limitation values
17
 *   Example: "sectionId" from "/content/section/{sectionId}"
18
 * - The FQN of the limitation value object that the parser builds
19
 */
20
class PathStringRouteBasedLimitationParser extends RouteBasedLimitationParser
21
{
22
    /**
23
     * Prefixes the value parsed by the parent with a '/'.
24
     *
25
     * @param $limitationValue
26
     *
27
     * @return false|mixed
28
     */
29
    protected function parseIdFromHref($limitationValue)
30
    {
31
        return '/' . ltrim(parent::parseIdFromHref($limitationValue), '/');
32
    }
33
}
34