View::src()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 4
Bugs 0 Features 3
Metric Value
c 4
b 0
f 3
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 3
1
<?php
2
/**
3
 * Created by Vitaly Iegorov <[email protected]>.
4
 * on 22.02.16 at 14:04
5
 */
6
namespace samsonphp\view;
7
8
use samsonframework\core\SystemInterface;
9
use samsonphp\resource\Resource;
10
11
/**
12
 * SamsonPHP View class.
13
 *
14
 * @package samsonphp\view
15
 */
16
class View extends \samsonframework\view\View
17
{
18
    /** @var SystemInterface Pointer to system interface */
19
    public static $system;
20
21
    /**
22
     * Generate url for resource path that is not accessible by web-server.
23
     *
24
     * @param string $path       Path to resource
25
     * @param string $parentPath Path to parent entity
26
     * @param string $controller Url to controller for handling resource serving
27
     *
28
     * @return string Url for resource serving
29
     * TODO: Remove dependency from constant from samsonphp/resource
30
     * TODO: How to point static resource from one vendor module to another,
31
     * we use this in SamsonCMS to share template images across modules to avoid
32
     * static resources duplication. Defining path throw vendor is not an option.
33
     * Specifying identifier as second parameter to view()?
34
     * @throws \samsonphp\resource\exception\ResourceNotFound
35
     */
36
    public function src($path, $parentPath = '', $controller = STATIC_RESOURCE_HANDLER)
37
    {
38
        return $controller.'?p='.Resource::getRelativePath($path, $parentPath);
39
    }
40
}
41