Completed
Push — spi_getname_change ( 9b3757...5d4921 )
by André
23:58
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 0
Metric Value
c 1
b 0
f 0
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\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