1 | <?php |
||
11 | class Slim extends \Twig_Extension |
||
12 | { |
||
13 | private $uri; |
||
14 | |||
15 | public function __construct(RouterInterface $router, UriInterface $uri) |
||
20 | |||
21 | public function getName() |
||
25 | |||
26 | public function getFunctions() |
||
34 | |||
35 | /** |
||
36 | * pathFor function. |
||
37 | * |
||
38 | * @access public |
||
39 | * @param mixed $name |
||
40 | * @param mixed $data (default: []) |
||
41 | * @param mixed $queryParams (default: []) |
||
42 | * @return string |
||
43 | */ |
||
44 | public function pathFor($name, $data = [], $queryParams = []) |
||
48 | |||
49 | /** |
||
50 | * baseUrl function. |
||
51 | * |
||
52 | * @access public |
||
53 | * @return string |
||
54 | */ |
||
55 | public function baseUrl() |
||
64 | |||
65 | /** |
||
66 | * isCurrentPath function. |
||
67 | * |
||
68 | * @access public |
||
69 | * @param mixed $name |
||
70 | * @return boolean |
||
71 | */ |
||
72 | public function isCurrentPath($name) |
||
76 | |||
77 | /** |
||
78 | * Set the base url |
||
79 | * |
||
80 | * @param string|Slim\Http\Uri $baseUrl |
||
81 | * @return void |
||
82 | */ |
||
83 | public function setBaseUrl($baseUrl) |
||
87 | } |
||
88 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: