| Conditions | 5 |
| Paths | 5 |
| Total Lines | 23 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 32 | public static function strIs($pattern, $value) |
||
| 33 | { |
||
| 34 | $patterns = static::arrayWrap($pattern); |
||
| 35 | |||
| 36 | if (empty($patterns)) { |
||
| 37 | return false; |
||
| 38 | } |
||
| 39 | |||
| 40 | foreach ($patterns as $pattern) { |
||
|
|
|||
| 41 | if ($pattern == $value) { |
||
| 42 | return true; |
||
| 43 | } |
||
| 44 | |||
| 45 | $pattern = preg_quote($pattern, '#'); |
||
| 46 | |||
| 47 | $pattern = str_replace('\*', '.*', $pattern); |
||
| 48 | |||
| 49 | if (preg_match('#^'.$pattern.'\z#u', $value) === 1) { |
||
| 50 | return true; |
||
| 51 | } |
||
| 52 | } |
||
| 53 | |||
| 54 | return false; |
||
| 55 | } |
||
| 56 | } |