From 4c41e57bc2527d2bd0741ce08f7da17c059ba024 Mon Sep 17 00:00:00 2001 From: recursive_tree Date: Fri, 13 Oct 2023 14:57:09 +0200 Subject: [PATCH] styleci --- src/Contracts/HasTypeID.php | 22 +++++++- src/Contracts/IPriceable.php | 27 ++++++++-- src/Helpers/UserAgentBuilder.php | 91 ++++++++++++++++++++++---------- src/Items/EveType.php | 29 ++++++++-- src/Items/PriceableEveType.php | 30 +++++++++-- 5 files changed, 156 insertions(+), 43 deletions(-) diff --git a/src/Contracts/HasTypeID.php b/src/Contracts/HasTypeID.php index 51fd5db8..a31b1dbe 100644 --- a/src/Contracts/HasTypeID.php +++ b/src/Contracts/HasTypeID.php @@ -1,5 +1,25 @@ product = sprintf('%s:%s',$vendor, $package); + $this->product = sprintf('%s:%s', $vendor, $package); $this->version = $this->getPackageVersion($vendor, $package); return $this; } /** - * Adds a comment containing the product and version of the user agent for a seat plugin - * @param string|AbstractSeatPlugin $plugin A plugin service provider instance or the FCQN of the service provider (e.g. MyServiceProvider::class) + * Adds a comment containing the product and version of the user agent for a seat plugin. + * + * @param string|AbstractSeatPlugin $plugin A plugin service provider instance or the FCQN of the service provider (e.g. MyServiceProvider::class) * @return $this */ public function commentSeatPlugin(string|AbstractSeatPlugin $plugin): UserAgentBuilder { @@ -83,20 +108,22 @@ public function commentSeatPlugin(string|AbstractSeatPlugin $plugin): UserAgentB } /** - * Adds a comment containing the product and version of the user agent for a packagist package - * @param string $vendor The packagist vendor name - * @param string $package The packagist package name + * Adds a comment containing the product and version of the user agent for a packagist package. + * + * @param string $vendor The packagist vendor name + * @param string $package The packagist package name * @return $this */ public function commentPackagist(string $vendor, string $package): UserAgentBuilder { - $this->comment(sprintf('%s:%s/%s',$vendor, $package, $this->getPackageVersion($vendor, $package))); + $this->comment(sprintf('%s:%s/%s', $vendor, $package, $this->getPackageVersion($vendor, $package))); return $this; } /** - * Add a comment to the user agent - * @param string $comment the comment + * Add a comment to the user agent. + * + * @param string $comment the comment * @return $this */ public function comment(string $comment): UserAgentBuilder { @@ -107,33 +134,39 @@ public function comment(string $comment): UserAgentBuilder { /** * Adds a reasonable set of default comments for any seat plugin. + * * @return $this + * * @throws SettingException */ public function defaultComments(): UserAgentBuilder { $this->comment(sprintf('(admin contact: %s)', setting('admin_contact', true) ?? 'not specified')); $this->comment('(https://github.com/eveseat/seat)'); - $this->commentPackagist('eveseat','seat'); - $this->commentPackagist('eveseat','web'); - $this->commentPackagist('eveseat','eveapi'); + $this->commentPackagist('eveseat', 'seat'); + $this->commentPackagist('eveseat', 'web'); + $this->commentPackagist('eveseat', 'eveapi'); + return $this; } /** - * Assembles the user agent form its product, version, and comments into a string + * Assembles the user agent form its product, version, and comments into a string. + * * @return string The user agent */ public function build(): string { - if($this->product === null || $this->version===null) { + if($this->product === null || $this->version === null) { throw new \Error('version or product not set.'); } - return sprintf('%s/%s %s', $this->product, $this->version, implode(' ',$this->comments)); + + return sprintf('%s/%s %s', $this->product, $this->version, implode(' ', $this->comments)); } /** - * Gets the installed version of a packagist package - * @param string $vendor The packagist vendor name - * @param string $package The packagist package name + * Gets the installed version of a packagist package. + * + * @param string $vendor The packagist vendor name + * @param string $package The packagist package name * @return string */ private function getPackageVersion(string $vendor, string $package): string { @@ -143,4 +176,4 @@ private function getPackageVersion(string $vendor, string $package): string { return 'unknown'; } } -} \ No newline at end of file +} diff --git a/src/Items/EveType.php b/src/Items/EveType.php index d9662465..a23fcf48 100644 --- a/src/Items/EveType.php +++ b/src/Items/EveType.php @@ -1,21 +1,40 @@ getTypeID(); @@ -31,4 +50,4 @@ public function getTypeID(): int { return $this->type_id; } -} \ No newline at end of file +} diff --git a/src/Items/PriceableEveType.php b/src/Items/PriceableEveType.php index 194ca44d..dbe6b95b 100644 --- a/src/Items/PriceableEveType.php +++ b/src/Items/PriceableEveType.php @@ -1,12 +1,32 @@ price = $price; } -} \ No newline at end of file +}