1 | <?php |
||||||
2 | |||||||
0 ignored issues
–
show
Coding Style
introduced
by
![]() |
|||||||
3 | namespace Db3v4l\Controller; |
||||||
4 | |||||||
5 | use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; |
||||||
0 ignored issues
–
show
The type
Symfony\Bundle\Framework...ller\AbstractController was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||||
6 | use Symfony\Component\Routing\Annotation\Route; |
||||||
0 ignored issues
–
show
The type
Symfony\Component\Routing\Annotation\Route was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||||
7 | |||||||
8 | /** |
||||||
0 ignored issues
–
show
|
|||||||
9 | * @Route("/doc") |
||||||
10 | */ |
||||||
0 ignored issues
–
show
|
|||||||
11 | class DocController extends AbstractController |
||||||
12 | { |
||||||
13 | /// @todo get this injected |
||||||
14 | protected $docRoot = '/var/www/doc'; |
||||||
15 | |||||||
16 | /** |
||||||
0 ignored issues
–
show
|
|||||||
17 | * @Route("/list", name="doc_list") |
||||||
18 | */ |
||||||
0 ignored issues
–
show
|
|||||||
19 | public function list() |
||||||
20 | { |
||||||
21 | $docs = glob($this->docRoot . '/*.md'); |
||||||
22 | array_walk($docs, function(&$path, $key) {$path = basename($path);}); |
||||||
0 ignored issues
–
show
The parameter
$key is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. ![]() It seems like
$docs can also be of type false ; however, parameter $array of array_walk() does only seem to accept array , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
23 | return $this->render('Doc/list.html.twig', ['docs' => $docs]); |
||||||
24 | } |
||||||
25 | |||||||
26 | /** |
||||||
0 ignored issues
–
show
|
|||||||
27 | * @Route("/view/{filename}", name="doc_view") |
||||||
28 | * |
||||||
29 | * @param string $filename |
||||||
0 ignored issues
–
show
|
|||||||
30 | * @return \Symfony\Component\HttpFoundation\Response |
||||||
0 ignored issues
–
show
The type
Symfony\Component\HttpFoundation\Response was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||||
31 | */ |
||||||
32 | public function displayFile($filename) |
||||||
33 | { |
||||||
34 | // sanitize |
||||||
35 | $filename = basename($filename); |
||||||
36 | |||||||
37 | $filename = $this->docRoot . '/' . $filename; |
||||||
38 | |||||||
39 | if (!is_file($filename)) { |
||||||
40 | throw $this->createNotFoundException("The doc file '$filename' does not exist"); |
||||||
41 | } |
||||||
42 | |||||||
43 | /// @todo allow different types of doc format |
||||||
44 | return $this->render('Doc/File/markdown.html.twig', ['file' => basename($filename), 'markup' => file_get_contents($filename)]); |
||||||
45 | } |
||||||
46 | } |
||||||
47 |