Compare commits
No commits in common. "324fe21d735db7aaf2a61d3e38c3299756d8ab14" and "f8aaa71260ae2c57b91c626a2981a2b31f1ca71c" have entirely different histories.
324fe21d73
...
f8aaa71260
3 changed files with 70 additions and 87 deletions
62
composer.lock
generated
62
composer.lock
generated
|
@ -457,11 +457,11 @@
|
|||
},
|
||||
{
|
||||
"name": "flashwave/index",
|
||||
"version": "v0.2408.611934",
|
||||
"version": "v0.2408.401738",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://patchii.net/flash/index.git",
|
||||
"reference": "2217c8c3de8e4ec8d7f9ec0f37078dbc2183d14e"
|
||||
"reference": "1339de93bf08d773207468227f7d134d41e68688"
|
||||
},
|
||||
"require": {
|
||||
"ext-mbstring": "*",
|
||||
|
@ -495,7 +495,7 @@
|
|||
],
|
||||
"description": "Composer package for the common library for my projects.",
|
||||
"homepage": "https://railgun.sh/index",
|
||||
"time": "2024-09-30T17:34:51+00:00"
|
||||
"time": "2024-09-13T15:38:44+00:00"
|
||||
},
|
||||
{
|
||||
"name": "flashwave/sasae",
|
||||
|
@ -752,16 +752,16 @@
|
|||
},
|
||||
{
|
||||
"name": "matomo/device-detector",
|
||||
"version": "6.4.1",
|
||||
"version": "6.4.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/matomo-org/device-detector.git",
|
||||
"reference": "0d364e0dd6c177da3c24cd4049178026324fd7ac"
|
||||
"reference": "05dca429cfe7b6a59947a0d449dbeb60cddc02f2"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/matomo-org/device-detector/zipball/0d364e0dd6c177da3c24cd4049178026324fd7ac",
|
||||
"reference": "0d364e0dd6c177da3c24cd4049178026324fd7ac",
|
||||
"url": "https://api.github.com/repos/matomo-org/device-detector/zipball/05dca429cfe7b6a59947a0d449dbeb60cddc02f2",
|
||||
"reference": "05dca429cfe7b6a59947a0d449dbeb60cddc02f2",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -817,7 +817,7 @@
|
|||
"source": "https://github.com/matomo-org/matomo",
|
||||
"wiki": "https://dev.matomo.org/"
|
||||
},
|
||||
"time": "2024-09-24T13:50:04+00:00"
|
||||
"time": "2024-09-10T08:27:24+00:00"
|
||||
},
|
||||
{
|
||||
"name": "mustangostang/spyc",
|
||||
|
@ -1775,16 +1775,16 @@
|
|||
},
|
||||
{
|
||||
"name": "symfony/mailer",
|
||||
"version": "v6.4.12",
|
||||
"version": "v6.4.9",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/mailer.git",
|
||||
"reference": "b6a25408c569ae2366b3f663a4edad19420a9c26"
|
||||
"reference": "e2d56f180f5b8c5e7c0fbea872bb1f529b6d6d45"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/mailer/zipball/b6a25408c569ae2366b3f663a4edad19420a9c26",
|
||||
"reference": "b6a25408c569ae2366b3f663a4edad19420a9c26",
|
||||
"url": "https://api.github.com/repos/symfony/mailer/zipball/e2d56f180f5b8c5e7c0fbea872bb1f529b6d6d45",
|
||||
"reference": "e2d56f180f5b8c5e7c0fbea872bb1f529b6d6d45",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -1835,7 +1835,7 @@
|
|||
"description": "Helps sending emails",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/mailer/tree/v6.4.12"
|
||||
"source": "https://github.com/symfony/mailer/tree/v6.4.9"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
@ -1851,20 +1851,20 @@
|
|||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-09-08T12:30:05+00:00"
|
||||
"time": "2024-06-28T07:59:05+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/mime",
|
||||
"version": "v7.1.5",
|
||||
"version": "v7.1.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/mime.git",
|
||||
"reference": "711d2e167e8ce65b05aea6b258c449671cdd38ff"
|
||||
"reference": "ccaa6c2503db867f472a587291e764d6a1e58758"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/mime/zipball/711d2e167e8ce65b05aea6b258c449671cdd38ff",
|
||||
"reference": "711d2e167e8ce65b05aea6b258c449671cdd38ff",
|
||||
"url": "https://api.github.com/repos/symfony/mime/zipball/ccaa6c2503db867f472a587291e764d6a1e58758",
|
||||
"reference": "ccaa6c2503db867f472a587291e764d6a1e58758",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -1919,7 +1919,7 @@
|
|||
"mime-type"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/mime/tree/v7.1.5"
|
||||
"source": "https://github.com/symfony/mime/tree/v7.1.4"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
@ -1935,7 +1935,7 @@
|
|||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-09-20T08:28:38+00:00"
|
||||
"time": "2024-08-13T14:28:19+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/options-resolver",
|
||||
|
@ -2564,16 +2564,16 @@
|
|||
},
|
||||
{
|
||||
"name": "symfony/translation",
|
||||
"version": "v7.1.5",
|
||||
"version": "v7.1.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/translation.git",
|
||||
"reference": "235535e3f84f3dfbdbde0208ede6ca75c3a489ea"
|
||||
"reference": "8d5e50c813ba2859a6dfc99a0765c550507934a1"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/translation/zipball/235535e3f84f3dfbdbde0208ede6ca75c3a489ea",
|
||||
"reference": "235535e3f84f3dfbdbde0208ede6ca75c3a489ea",
|
||||
"url": "https://api.github.com/repos/symfony/translation/zipball/8d5e50c813ba2859a6dfc99a0765c550507934a1",
|
||||
"reference": "8d5e50c813ba2859a6dfc99a0765c550507934a1",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2638,7 +2638,7 @@
|
|||
"description": "Provides tools to internationalize your application",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/translation/tree/v7.1.5"
|
||||
"source": "https://github.com/symfony/translation/tree/v7.1.3"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
@ -2654,7 +2654,7 @@
|
|||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-09-16T06:30:38+00:00"
|
||||
"time": "2024-07-26T12:41:01+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/translation-contracts",
|
||||
|
@ -2885,16 +2885,16 @@
|
|||
"packages-dev": [
|
||||
{
|
||||
"name": "phpstan/phpstan",
|
||||
"version": "1.12.5",
|
||||
"version": "1.12.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpstan/phpstan.git",
|
||||
"reference": "7e6c6cb7cecb0a6254009a1a8a7d54ec99812b17"
|
||||
"reference": "0fcbf194ab63d8159bb70d9aa3e1350051632009"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/7e6c6cb7cecb0a6254009a1a8a7d54ec99812b17",
|
||||
"reference": "7e6c6cb7cecb0a6254009a1a8a7d54ec99812b17",
|
||||
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/0fcbf194ab63d8159bb70d9aa3e1350051632009",
|
||||
"reference": "0fcbf194ab63d8159bb70d9aa3e1350051632009",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2939,7 +2939,7 @@
|
|||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2024-09-26T12:45:22+00:00"
|
||||
"time": "2024-09-09T08:10:35+00:00"
|
||||
}
|
||||
],
|
||||
"aliases": [],
|
||||
|
|
38
package-lock.json
generated
38
package-lock.json
generated
|
@ -357,9 +357,9 @@
|
|||
"license": "ISC"
|
||||
},
|
||||
"node_modules/browserslist": {
|
||||
"version": "4.24.0",
|
||||
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.24.0.tgz",
|
||||
"integrity": "sha512-Rmb62sR1Zpjql25eSanFGEhAxcFwfA1K0GuQcLoaJBAcENegrQut3hYdhXFF1obQfiDyqIW/cLM5HSJ/9k884A==",
|
||||
"version": "4.23.3",
|
||||
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.23.3.tgz",
|
||||
"integrity": "sha512-btwCFJVjI4YWDNfau8RhZ+B1Q/VLoUITrm3RlP6y1tYGWIOa+InuYiRGXUBXo8nA1qKmHMyLB/iVQg5TT4eFoA==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "opencollective",
|
||||
|
@ -376,8 +376,8 @@
|
|||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"caniuse-lite": "^1.0.30001663",
|
||||
"electron-to-chromium": "^1.5.28",
|
||||
"caniuse-lite": "^1.0.30001646",
|
||||
"electron-to-chromium": "^1.5.4",
|
||||
"node-releases": "^2.0.18",
|
||||
"update-browserslist-db": "^1.1.0"
|
||||
},
|
||||
|
@ -417,9 +417,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/caniuse-lite": {
|
||||
"version": "1.0.30001664",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001664.tgz",
|
||||
"integrity": "sha512-AmE7k4dXiNKQipgn7a2xg558IRqPN3jMQY/rOsbxDhrd0tyChwbITBfiwtnqz8bi2M5mIWbxAYBvk7W7QBUS2g==",
|
||||
"version": "1.0.30001660",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001660.tgz",
|
||||
"integrity": "sha512-GacvNTTuATm26qC74pt+ad1fW15mlQ/zuTzzY1ZoIzECTP8HURDfF43kNxPgf7H1jmelCBQTTbBNxdSXOA7Bqg==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "opencollective",
|
||||
|
@ -703,9 +703,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/electron-to-chromium": {
|
||||
"version": "1.5.29",
|
||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.29.tgz",
|
||||
"integrity": "sha512-PF8n2AlIhCKXQ+gTpiJi0VhcHDb69kYX4MtCiivctc2QD3XuNZ/XIOlbGzt7WAjjEev0TtaH6Cu3arZExm5DOw==",
|
||||
"version": "1.5.23",
|
||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.23.tgz",
|
||||
"integrity": "sha512-mBhODedOXg4v5QWwl21DjM5amzjmI1zw9EPrPK/5Wx7C8jt33bpZNrC7OhHUG3pxRtbLpr3W2dXT+Ph1SsfRZA==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/entities": {
|
||||
|
@ -1429,9 +1429,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/terser": {
|
||||
"version": "5.34.1",
|
||||
"resolved": "https://registry.npmjs.org/terser/-/terser-5.34.1.tgz",
|
||||
"integrity": "sha512-FsJZ7iZLd/BXkz+4xrRTGJ26o/6VTjQytUk8b8OxkwcD2I+79VPJlz7qss1+zE7h8GNIScFqXcDyJ/KqBYZFVA==",
|
||||
"version": "5.32.0",
|
||||
"resolved": "https://registry.npmjs.org/terser/-/terser-5.32.0.tgz",
|
||||
"integrity": "sha512-v3Gtw3IzpBJ0ugkxEX8U0W6+TnPKRRCWGh1jC/iM/e3Ki5+qvO1L1EAZ56bZasc64aXHwRHNIQEzm6//i5cemQ==",
|
||||
"license": "BSD-2-Clause",
|
||||
"dependencies": {
|
||||
"@jridgewell/source-map": "^0.3.3",
|
||||
|
@ -1459,9 +1459,9 @@
|
|||
"license": "0BSD"
|
||||
},
|
||||
"node_modules/update-browserslist-db": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.1.tgz",
|
||||
"integrity": "sha512-R8UzCaa9Az+38REPiJ1tXlImTJXlVfgHZsglwBD/k6nj76ctsH1E3q4doGrukiLQd3sGQYu56r5+lo5r94l29A==",
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.0.tgz",
|
||||
"integrity": "sha512-EdRAaAyk2cUE1wOf2DkEhzxqOQvFOoRJFNS6NeyJ01Gp2beMRpBAINjM2iDXE3KCuKhwnvHIQCJm6ThL2Z+HzQ==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "opencollective",
|
||||
|
@ -1478,8 +1478,8 @@
|
|||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"escalade": "^3.2.0",
|
||||
"picocolors": "^1.1.0"
|
||||
"escalade": "^3.1.2",
|
||||
"picocolors": "^1.0.1"
|
||||
},
|
||||
"bin": {
|
||||
"update-browserslist-db": "cli.js"
|
||||
|
|
|
@ -5,12 +5,10 @@ use stdClass;
|
|||
use JsonSerializable;
|
||||
use RuntimeException;
|
||||
use Stringable;
|
||||
use DeviceDetector\{ClientHints,DeviceDetector};
|
||||
use Index\Json\{JsonProperty,JsonSerializableTrait};
|
||||
use DeviceDetector\ClientHints;
|
||||
use DeviceDetector\DeviceDetector;
|
||||
|
||||
class ClientInfo implements Stringable, JsonSerializable {
|
||||
use JsonSerializableTrait;
|
||||
|
||||
private const SERIALIZE_VERSION = 1;
|
||||
|
||||
public function __construct(
|
||||
|
@ -21,39 +19,6 @@ class ClientInfo implements Stringable, JsonSerializable {
|
|||
private string $modelName
|
||||
) {}
|
||||
|
||||
#[JsonProperty('version')]
|
||||
public function getVersion(): int {
|
||||
return self::SERIALIZE_VERSION;
|
||||
}
|
||||
|
||||
#[JsonProperty('bot')]
|
||||
public function getBotInfo(): bool|array|null {
|
||||
if($this->botInfo === true || is_array($this->botInfo))
|
||||
return $this->botInfo;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
#[JsonProperty('client')]
|
||||
public function getClientInfo(): ?array {
|
||||
return $this->clientInfo;
|
||||
}
|
||||
|
||||
#[JsonProperty('os')]
|
||||
public function getOsInfo(): ?array {
|
||||
return $this->osInfo;
|
||||
}
|
||||
|
||||
#[JsonProperty('vendor', omitIfValue: '')]
|
||||
public function getVendorName(): string {
|
||||
return $this->brandName;
|
||||
}
|
||||
|
||||
#[JsonProperty('model', omitIfValue: '')]
|
||||
public function getModelName(): string {
|
||||
return $this->modelName;
|
||||
}
|
||||
|
||||
public function __toString(): string {
|
||||
if($this->botInfo === true || is_array($this->botInfo)) {
|
||||
if($this->botInfo === true)
|
||||
|
@ -99,6 +64,24 @@ class ClientInfo implements Stringable, JsonSerializable {
|
|||
return json_encode($this);
|
||||
}
|
||||
|
||||
public function jsonSerialize(): mixed {
|
||||
$data = new stdClass;
|
||||
$data->version = self::SERIALIZE_VERSION;
|
||||
|
||||
if($this->botInfo === true || is_array($this->botInfo))
|
||||
$data->bot = $this->botInfo;
|
||||
if($this->clientInfo !== null)
|
||||
$data->client = $this->clientInfo;
|
||||
if($this->osInfo !== null)
|
||||
$data->os = $this->osInfo;
|
||||
if($this->brandName !== '')
|
||||
$data->vendor = $this->brandName;
|
||||
if($this->modelName !== '')
|
||||
$data->model = $this->modelName;
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public static function decode(string $encoded): self {
|
||||
$data = json_decode($encoded, true);
|
||||
$version = $data['version'] ?? 0;
|
||||
|
|
Loading…
Reference in a new issue