Conditions | 6 |
Paths | 5 |
Total Lines | 16 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 42 |
Changes | 0 |
1 | <?php |
||
31 | protected function check( $target ) |
||
32 | { |
||
33 | $blacklist = trim( glsr( OptionManager::class )->get( 'settings.submissions.blacklist.entries' )); |
||
34 | if( empty( $blacklist )) { |
||
35 | return false; |
||
36 | } |
||
37 | $lines = explode( "\n", $blacklist ); |
||
38 | foreach( (array)$lines as $line ) { |
||
39 | $line = trim( $line ); |
||
40 | if( empty( $line ) || 256 < strlen( $line ))continue; |
||
41 | $pattern = sprintf( '#%s#i', preg_quote( $line, '#' )); |
||
42 | if( preg_match( $pattern, $target )) { |
||
43 | return true; |
||
44 | } |
||
45 | } |
||
46 | return false; |
||
47 | } |
||
49 |