Passed
Push — master ( d43caf...13a6d1 )
by Tim
02:51
created

CompatibilityUtility   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 9
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A stringBeginsWith() 0 7 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace LD\LanguageDetection\Utility;
6
7
use TYPO3\CMS\Core\Utility\StringUtility;
8
9
class CompatibilityUtility
10
{
11
    public static function stringBeginsWith(string $haystack, string $needle): bool
12
    {
13
        if (\function_exists('str_starts_with')) {
14
            return str_starts_with($haystack, $needle);
15
        }
16
17
        return StringUtility::beginsWith($haystack, $needle);
0 ignored issues
show
Deprecated Code introduced by
The function TYPO3\CMS\Core\Utility\StringUtility::beginsWith() has been deprecated: will be removed in TYPO3 v12.0. Use PHP's native str_starts_with() function instead. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

17
        return /** @scrutinizer ignore-deprecated */ StringUtility::beginsWith($haystack, $needle);

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
18
    }
19
}
20