File tree Expand file tree Collapse file tree 5 files changed +4461
-160
lines changed Expand file tree Collapse file tree 5 files changed +4461
-160
lines changed Original file line number Diff line number Diff line change @@ -124,7 +124,7 @@ public function getDevice(): string
124
124
125
125
public function getAndroidSdkVersion (): string
126
126
{
127
- return $ this ->androidSdkVersion ;
127
+ return DeviceResource:: getUpdatedSdkVersion ( $ this ->androidSdkVersion ) ;
128
128
}
129
129
130
130
public function getFirstName (): string
Original file line number Diff line number Diff line change @@ -16,10 +16,6 @@ class DeviceResource
16
16
* @var string
17
17
*/
18
18
private $ model ;
19
- /**
20
- * @var int
21
- */
22
- private $ sdkVersion ;
23
19
/** @var array */
24
20
private static $ devices = [];
25
21
@@ -33,9 +29,6 @@ public function __construct()
33
29
34
30
$ this ->brand = $ randomDevice ['brand ' ];
35
31
$ this ->model = $ randomDevice ['model ' ];
36
-
37
- $ sdks = $ randomDevice ['sdks ' ];
38
- $ this ->sdkVersion = $ sdks [array_rand ($ sdks )];
39
32
}
40
33
41
34
public function getDeviceString (): string
@@ -45,6 +38,26 @@ public function getDeviceString(): string
45
38
46
39
public function getSdkString (): string
47
40
{
48
- return 'SDK ' .$ this ->sdkVersion ;
41
+ return 'SDK ' .rand (self ::getMinSdkVersion (), self ::getMaxSdkVersion ());
42
+ }
43
+
44
+ public static function getUpdatedSdkVersion ($ currentSdkString ): string
45
+ {
46
+ $ intVersion = strstr ($ currentSdkString , 'SDK ' ) ?
47
+ (int ) explode (' ' , $ currentSdkString )[1 ] : (int ) $ currentSdkString ;
48
+ $ newVersion = $ intVersion < self ::getMinSdkVersion () ?
49
+ self ::getMinSdkVersion () + ($ intVersion % (self ::getMaxSdkVersion () - self ::getMinSdkVersion () + 1 )) : $ intVersion ;
50
+
51
+ return 'SDK ' .$ newVersion ;
52
+ }
53
+
54
+ public static function getMinSdkVersion (): int
55
+ {
56
+ return 26 ;
57
+ }
58
+
59
+ public static function getMaxSdkVersion (): int
60
+ {
61
+ return 30 ;
49
62
}
50
63
}
You can’t perform that action at this time.
0 commit comments