-
Notifications
You must be signed in to change notification settings - Fork 38
/
scanner_config.example.php
96 lines (89 loc) · 2.8 KB
/
scanner_config.example.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<?php
/**
* Set $projectPath = getcwd(); if your put it under project root
**/
$projectPath = __DIR__ . '/my/project/';
/**
* Array of full directories path for scan;
* Scan will be recursive
* Put directories with most intensive imports in top of list for more quick result
* @see http://api.symfony.com/4.0/Symfony/Component/Finder/Finder.html#method_in
**/
$scanDirectories = [
$projectPath . '/config/',
$projectPath . '/Acme/',
$projectPath . '/controllers/',
$projectPath . '/console/',
$projectPath . '/models/',
$projectPath . '/modules/',
$projectPath . '/services/',
];
$scanFiles = [
$projectPath . '/autocomplete.php',
];
/**
* Names relative to ones of scanDirectories
*
* @see http://api.symfony.com/4.0/Symfony/Component/Finder/Finder.html#method_exclude
**/
$excludeDirectories = [
'runtime',
'storage/logs',
];
return [
/**
* Required params
**/
'composerJsonPath' => $projectPath . '/composer.json',
'vendorPath' => $projectPath . '/vendor/',
'scanDirectories' => $scanDirectories,
/**
* Optional params
**/
'skipPackages' => [], //List of packages that must be excluded from verification
'excludeDirectories' => $excludeDirectories,
'scanFiles' => $scanFiles,
'extensions' => ['*.php'],
'requireDev' => false, //Check composer require-dev section, default false
/**
* Optional, custom logic for check is file contains definitions of package
*
* @example
* 'customMatch'=> function($definition, $packageName, \Symfony\Component\Finder\SplFileInfo $file):bool{
* $isPresent = false;
* if($packageName === 'phpunit/phpunit'){
* $isPresent = true;
* }
* if($file->getExtension()==='twig'){
* $isPresent = customCheck();
* }
* return $isPresent;
* }
**/
'customMatch'=> null,
/**
* Report mode options
* Report mode enabled, when reportPath value is valid directory path
* !!!Note!!! The scanning time and memory usage will be increased when report mode enabled,
* it sensitive especially for big projects and when requireDev option enabled
**/
'reportPath' => null, //path in directory, where usage report will be stores;
/**
* Optional custom formatter (by default report stored as json)
* $report array format
* [
* 'packageName'=> [
* 'definition'=>['fileNames',...]
* ....
* ]
* ...
* ]
*
* @example
* 'reportFormatter'=>function(array $report):string{
* return print_r($report, true);
* }
**/
'reportFormatter' => null,
'reportExtension' => null, //by default - json, set own, if use custom formatter
];