These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace GulpAssets; |
||
4 | |||
5 | /** |
||
6 | * @author Adam Bisek <[email protected]> |
||
7 | */ |
||
8 | class BaseControl extends \Nette\Application\UI\Control |
||
9 | { |
||
10 | |||
11 | /** @var array */ |
||
12 | protected $files; |
||
13 | |||
14 | /** @var string */ |
||
15 | private $basePath; |
||
16 | |||
17 | |||
18 | /** |
||
19 | * @return array |
||
20 | */ |
||
21 | 4 | public function getFiles() |
|
22 | { |
||
23 | 4 | return $this->files; |
|
24 | } |
||
25 | |||
26 | |||
27 | /** |
||
28 | * @param array $files |
||
29 | */ |
||
30 | 6 | public function setFiles($files) |
|
31 | { |
||
32 | 6 | $this->files = $files; |
|
33 | 6 | } |
|
34 | |||
35 | |||
36 | /** |
||
37 | * @return string |
||
38 | */ |
||
39 | 2 | public function getBasePath() |
|
40 | { |
||
41 | 2 | return $this->basePath; |
|
42 | } |
||
43 | |||
44 | |||
45 | /** |
||
46 | * @param string $basePath |
||
47 | */ |
||
48 | 6 | public function setBasePath($basePath) |
|
49 | { |
||
50 | 6 | $this->basePath = $basePath; |
|
51 | 6 | } |
|
52 | |||
53 | |||
54 | 2 | protected function formatFileUrl($file) |
|
55 | { |
||
56 | 2 | $appendix = ''; |
|
57 | 2 | if(is_file($this->basePath . '/' . $file)){ |
|
58 | 2 | $appendix = '?' . md5(filemtime($this->basePath . '/' . $file)); |
|
59 | 2 | } |
|
60 | |||
61 | 2 | return $this->template->baseUrl . '/' . $file . $appendix; |
|
2 ignored issues
–
show
Accessing
baseUrl on the interface Nette\Application\UI\ITemplate suggest that you code against a concrete implementation. How about adding an instanceof check?
If you access a property on an interface, you most likely code against a concrete implementation of the interface. Available Fixes
Loading history...
|
|||
62 | } |
||
63 | |||
64 | } |
Since your code implements the magic setter
_set
, this function will be called for any write access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.Since the property has write access only, you can use the @property-write annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.