|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace AhmadMayahi\Vision\Enums; |
|
6
|
|
|
|
|
7
|
|
|
use Google\Cloud\Vision\V1\Likelihood as LikelihoodVision; |
|
8
|
|
|
|
|
9
|
|
|
class Likelihood |
|
10
|
|
|
{ |
|
11
|
|
|
/** |
|
12
|
|
|
* Unknown likelihood. |
|
13
|
|
|
* |
|
14
|
|
|
* Generated from protobuf enum <code>UNKNOWN = 0;</code> |
|
15
|
|
|
*/ |
|
16
|
|
|
public const UNKNOWN = LikelihoodVision::UNKNOWN; |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* It is very unlikely. |
|
20
|
|
|
* |
|
21
|
|
|
* Generated from protobuf enum <code>VERY_UNLIKELY = 1;</code> |
|
22
|
|
|
*/ |
|
23
|
|
|
public const VERY_UNLIKELY = LikelihoodVision::VERY_UNLIKELY; |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* It is unlikely. |
|
27
|
|
|
* |
|
28
|
|
|
* Generated from protobuf enum <code>UNLIKELY = 2;</code> |
|
29
|
|
|
*/ |
|
30
|
|
|
public const UNLIKELY = LikelihoodVision::UNLIKELY; |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* It is possible. |
|
34
|
|
|
* |
|
35
|
|
|
* Generated from protobuf enum <code>POSSIBLE = 3;</code> |
|
36
|
|
|
*/ |
|
37
|
|
|
|
|
38
|
|
|
public const POSSIBLE = LikelihoodVision::POSSIBLE; |
|
39
|
|
|
/** |
|
40
|
|
|
* It is likely. |
|
41
|
|
|
* |
|
42
|
|
|
* Generated from protobuf enum <code>LIKELY = 4;</code> |
|
43
|
|
|
*/ |
|
44
|
|
|
|
|
45
|
|
|
public const LIKELY = LikelihoodVision::LIKELY; |
|
46
|
|
|
/** |
|
47
|
|
|
* It is very likely. |
|
48
|
|
|
* |
|
49
|
|
|
* Generated from protobuf enum <code>VERY_LIKELY = 5;</code> |
|
50
|
|
|
*/ |
|
51
|
|
|
public const VERY_LIKELY = LikelihoodVision::VERY_LIKELY; |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* @var array|string[] |
|
55
|
|
|
*/ |
|
56
|
|
|
public static array $likelihood = [ |
|
57
|
|
|
self::UNKNOWN => 'UNKNOWN', |
|
58
|
|
|
self::VERY_UNLIKELY => 'VERY_UNLIKELY', |
|
59
|
|
|
self::UNLIKELY => 'UNLIKELY', |
|
60
|
|
|
self::POSSIBLE => 'POSSIBLE', |
|
61
|
|
|
self::LIKELY => 'LIKELY', |
|
62
|
|
|
self::VERY_LIKELY => 'VERY_LIKELY', |
|
63
|
|
|
]; |
|
64
|
|
|
|
|
65
|
|
|
public static function fromKey(int $key): ?string |
|
66
|
|
|
{ |
|
67
|
|
|
return self::$likelihood[$key] ?? null; |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
public static function fromVal(string $val): ?int |
|
71
|
|
|
{ |
|
72
|
|
|
if ($res = array_search($val, self::$likelihood)) { |
|
73
|
|
|
return intval($res); |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
|
|
return null; |
|
77
|
|
|
} |
|
78
|
|
|
} |
|
79
|
|
|
|