Completed
Push — rest_role_limitation_href ( 1f459a...8a17ac )
by
unknown
28:44
created

parseIdFromHref()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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