Issues (5)

src/View/StringView.php (1 issue)

Labels
Severity
1
<?php
2
/**
3
 * This file is part of the sauls/widget package.
4
 *
5
 * @author    Saulius Vaičeliūnas <[email protected]>
6
 * @link      http://saulius.vaiceliunas.lt
7
 * @copyright 2018
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
namespace Sauls\Component\Widget\View;
14
15
16
class StringView implements ViewInterface
17
{
18
    /**
19
     * @param string $viewFile
20
     * @param array  $viewData
21
     *
22
     * @return string
23
     *
24
     */
25 6
    public function render(string $viewFile, array $viewData = []): string
26
    {
27 6
        return strtr(
28 6
            $viewFile,
29 6
            array_combine(
0 ignored issues
show
It seems like array_combine(array_map(...rray_values($viewData)) can also be of type false; however, parameter $replace_pairs of strtr() 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 ignore-type  annotation

29
            /** @scrutinizer ignore-type */ array_combine(
Loading history...
30 6
                array_map(
31 6
                    function ($key) {
32 6
                        return '{'.$key.'}';
33 6
                    },
34 6
                    array_keys($viewData)
35
                ),
36 6
                array_values($viewData)
37
            )
38
        );
39
    }
40
41 19
    public function getName(): string
42
    {
43 19
        return 'string';
44
    }
45
}
46