Total Complexity | 6 |
Total Lines | 72 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 0 |
1 | <?php |
||
10 | class FileWriter implements FileWriterInterface |
||
11 | { |
||
12 | /** |
||
13 | * @var string |
||
14 | */ |
||
15 | private $path; |
||
16 | |||
17 | /** |
||
18 | * @var string |
||
19 | */ |
||
20 | private $filename; |
||
21 | |||
22 | /** |
||
23 | * FileWriter constructor. |
||
24 | * |
||
25 | * @param string $path |
||
26 | * @param string $filename |
||
27 | */ |
||
28 | public function __construct(string $path, string $filename) |
||
29 | { |
||
30 | $this->path = $path; |
||
31 | $this->filename = $filename; |
||
32 | } |
||
33 | |||
34 | /** |
||
35 | * @param \DataProvider\LogMessageDataProvider $messageDataProvider |
||
36 | */ |
||
37 | public function writeLog(LogMessageDataProvider $messageDataProvider): void |
||
38 | { |
||
39 | $this->createFileIfNotExist(); |
||
40 | |||
41 | file_put_contents( |
||
42 | $this->getLogFile(), |
||
43 | $this->getLogContent($messageDataProvider), |
||
44 | FILE_APPEND |
||
45 | ); |
||
46 | } |
||
47 | |||
48 | /** |
||
49 | * @param \DataProvider\LogMessageDataProvider $messageDataProvider |
||
50 | * |
||
51 | * @return string |
||
52 | */ |
||
53 | private function getLogContent(LogMessageDataProvider $messageDataProvider): string |
||
54 | { |
||
55 | return sprintf( |
||
56 | '%s - %s%s%s%s%s%s%s%s%s', |
||
57 | date('Y-m-d H:i:s'), |
||
58 | $messageDataProvider->getTitle(), |
||
59 | PHP_EOL, |
||
60 | $messageDataProvider->getMessage(), |
||
61 | PHP_EOL, |
||
62 | PHP_EOL, |
||
63 | $messageDataProvider->getContext(), |
||
64 | PHP_EOL, |
||
65 | PHP_EOL, |
||
66 | PHP_EOL |
||
67 | ); |
||
68 | } |
||
69 | |||
70 | /** |
||
71 | * @return string |
||
72 | */ |
||
73 | private function getLogFile(): string |
||
76 | } |
||
77 | |||
78 | private function createFileIfNotExist(): void |
||
79 | { |
||
84 | } |
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.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths