Code Duplication    Length = 43-43 lines in 2 locations

src/system/RoutesModule/Entity/Historical/v110/RouteEntity.php 1 location

@@ 33-75 (lines=43) @@
30
 *     }
31
 * )
32
 */
33
class RouteEntity extends BaseEntity
34
{
35
    const POSITION_FIXED_TOP = 3;
36
37
    const POSITION_MIDDLE = 5;
38
39
    const POSITION_FIXED_BOTTOM = 7;
40
41
    /**
42
     * {@inheritdoc}
43
     */
44
    public function __construct()
45
    {
46
        parent::__construct();
47
48
        // Always add route to the end of the list.
49
        $this->sort = -1;
50
    }
51
52
    /**
53
     * Returns the route's path prepended with the bundle prefix.
54
     *
55
     * @param null $container Used to set the container for \ServiceUtil in case it is not already set
56
     *
57
     * @return string
58
     */
59
    public function getPathWithBundlePrefix($container = null)
60
    {
61
        if (isset($this->options['zkNoBundlePrefix']) && $this->options['zkNoBundlePrefix']) {
62
            // return path only
63
            return $this->path;
64
        }
65
66
        $bundle = $this->getBundle();
67
68
        if (!\ServiceUtil::hasContainer()) {
69
            \ServiceUtil::setContainer($container);
70
        }
71
72
        // return path prepended with bundle prefix
73
        return '/' . $bundle->getMetaData()->getUrl() . $this->path;
74
    }
75
}
76

src/system/RoutesModule/Entity/RouteEntity.php 1 location

@@ 34-76 (lines=43) @@
31
 *     }
32
 * )
33
 */
34
class RouteEntity extends BaseEntity
35
{
36
    const POSITION_FIXED_TOP = 3;
37
38
    const POSITION_MIDDLE = 5;
39
40
    const POSITION_FIXED_BOTTOM = 7;
41
42
    /**
43
     * {@inheritdoc}
44
     */
45
    public function __construct()
46
    {
47
        parent::__construct();
48
49
        // Always add route to the end of the list.
50
        $this->sort = -1;
51
    }
52
53
    /**
54
     * Returns the route's path prepended with the bundle prefix.
55
     *
56
     * @param null $container Used to set the container for ServiceUtil in case it is not already set
57
     *
58
     * @return string
59
     */
60
    public function getPathWithBundlePrefix($container = null)
61
    {
62
        if (isset($this->options['zkNoBundlePrefix']) && $this->options['zkNoBundlePrefix']) {
63
            // return path only
64
            return $this->path;
65
        }
66
67
        $bundle = $this->getBundle();
68
69
        if (!ServiceUtil::hasContainer()) {
70
            ServiceUtil::setContainer($container);
71
        }
72
73
        // return path prepended with bundle prefix
74
        return '/' . $bundle->getMetaData()->getUrl() . $this->path;
75
    }
76
}
77