1 | <?php |
||
5 | class IDS |
||
6 | { |
||
7 | protected $rules; |
||
8 | protected $violations; |
||
9 | |||
10 | /** |
||
11 | * Create an instance from a rule file. Rule files follow the Expose / PHPIDS format |
||
12 | * @param string $path the path to the file to load |
||
13 | * @return self the new instance |
||
14 | */ |
||
15 | 1 | public static function fromFile(string $path) : IDS |
|
29 | /** |
||
30 | * Creates an instance from the default rule file that comes with the lib. |
||
31 | * @return \vakata\ids\IDS the new instance |
||
32 | */ |
||
33 | 1 | public static function fromDefaults() : IDS |
|
37 | /** |
||
38 | * Create an instance. |
||
39 | * Each rule is and array and must contain `rule` and `impact` keys, and may contain `tags` and `description` keys |
||
40 | * @param array $rules array or rule arrays |
||
41 | */ |
||
42 | 2 | public function __construct(array $rules = []) |
|
46 | /** |
||
47 | * Analyze an array of data |
||
48 | * @param array $data the data to analyze |
||
49 | * @param int|null $threshold if non-null analysis will stop once this impact number is reached |
||
50 | * @param array|null $tags if non-null only rules containing any of the supplied tags will be run |
||
51 | * @return int the total impact of the data |
||
52 | */ |
||
53 | 2 | public function analyzeData(array $data, int $threshold = null, array $tags = null) : int |
|
58 | /** |
||
59 | * Get the violations from the last analyze call |
||
60 | * @return array the violated rules and the values that violated them |
||
61 | */ |
||
62 | public function getViolations() : array |
||
101 | } |
||
102 |