Moved user agent string creation thingy into a method.
This commit is contained in:
parent
676e3fb217
commit
e5a947e973
2 changed files with 5 additions and 1 deletions
|
@ -20,7 +20,7 @@ class XrpcClient {
|
||||||
'base_uri' => sprintf('%s/xrpc/', rtrim($service, '/')),
|
'base_uri' => sprintf('%s/xrpc/', rtrim($service, '/')),
|
||||||
'timeout' => 10,
|
'timeout' => 10,
|
||||||
'headers' => [
|
'headers' => [
|
||||||
'User-Agent' => sprintf('Misuzu/%s', Misuzu::version()),
|
'User-Agent' => Misuzu::userAgent(),
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,10 @@ final class Misuzu {
|
||||||
return trim($version);
|
return trim($version);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function userAgent(): string {
|
||||||
|
return sprintf('%s/%s', __NAMESPACE__, self::version());
|
||||||
|
}
|
||||||
|
|
||||||
public static function debug(): bool {
|
public static function debug(): bool {
|
||||||
return !empty(ini_get('display_errors'));
|
return !empty(ini_get('display_errors'));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue