| 1 | <?php |
||
| 13 | class TextCatLanguageDetector implements LanguageDetector { |
||
| 14 | |||
| 15 | const VERION = '0.1'; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @var TextCat |
||
| 19 | */ |
||
| 20 | private $textCat; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @var array|null |
||
| 24 | */ |
||
| 25 | private $languageCandidates = null; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @since 0.1 |
||
| 29 | * |
||
| 30 | * @param TextCat|null $textCat |
||
| 31 | */ |
||
| 32 | public function __construct( TextCat $textCat = null ) { |
||
| 39 | |||
| 40 | /** |
||
| 41 | * @since 0.1 |
||
| 42 | * |
||
| 43 | * @param array $languageCandidates |
||
| 44 | */ |
||
| 45 | public function setLanguageCandidates( array $languageCandidates ) { |
||
| 48 | |||
| 49 | /** |
||
| 50 | * @since 0.1 |
||
| 51 | * |
||
| 52 | * @param string $text |
||
| 53 | * |
||
| 54 | * @return string|null |
||
| 55 | */ |
||
| 56 | public function detect( $text ) { |
||
| 64 | |||
| 65 | } |
||
| 66 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.