Skip to content

Commit

Permalink
Small updates
Browse files Browse the repository at this point in the history
  • Loading branch information
ericsizemore committed Mar 29, 2024
1 parent 3a6fc37 commit 25c152d
Show file tree
Hide file tree
Showing 5 changed files with 156 additions and 49 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,7 @@ jobs:
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: ericsizemore/librariesio

- name: Check coverage
run: composer run-script coverage

59 changes: 32 additions & 27 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
# CHANGELOG
A not so exhaustive list of changes for each release.
# Changelog

For a more detailed listing of changes between each version,
you can use the following url: https://github.com/ericsizemore/librariesio/compare/v1.0.0...v2.0.0.
All notable changes to this project will be documented in this file.

Simply replace the version numbers depending on which set of changes you wish to see.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).


## 2.0.0-dev (TBD, ~2024-04-01)
## [Unreleased]

**NOTE:** Version 2.0.0 *should* be backwards compatible (for the most part) with 1.x.
However, if you make use of the `raw`, `toArray`, or `toObject` functions, please check the **CHANGED** section below.

### Added

* `AbstractClient` class which the main `LibrariesIO` class extends.
* `Utils` class which holds various useful static methods used throughout the library.
* New exceptions:
* Exception\InvalidApiKeyException
* Exception\InvalidEndpointException
* Exception\InvalidEndpointOptionsException
* `vimeo/psalm` as a dev dependency

### Changed

* The `LibrariesIO` constructor now takes a new option `$clientOptions` which is an array of options to pass to the Guzzle Client.
Expand All @@ -25,39 +34,33 @@ However, if you make use of the `raw`, `toArray`, or `toObject` functions, pleas
* `Exception\RateLimitExceededException` now takes `GuzzleHttp\Exception\ClientException` as a parameter.
* Fixes to both code and docblocks/etc. throughout per Psalm.

### Added

* `AbstractClient` class which the main `LibrariesIO` class extends.
* `Utils` class which holds various useful static methods used throughout the library.
* New exceptions:
* Exception\InvalidApiKeyException
* Exception\InvalidEndpointException
* Exception\InvalidEndpointOptionsException
* `vimeo/psalm` as a dev dependency

### Removed

* Removed the `$cachePath` property.
* Removed unnecessary comments throughout.


## 1.1.1 (2024-03-14)
## [1.1.1] - 2024-03-14

### Added

* Added PHP-CS-Fixer to dev dependencies.

### Changed

* Updated/refactored some code to reduce duplicate checks/etc. throughout.
* CS improvements/fixes.

### Added

* Added PHP-CS-Fixer to dev dependencies.

### Removed

* Cleaned up some doc blocks and removed some unnecessary comments.


## 1.1.0 (2023-12-29)
## [1.1.0] - 2023-12-29

### Added

* Added `subscription()` to handle adding, updating, checking and removing a subscription to a project.

### Changed

Expand All @@ -69,15 +72,17 @@ However, if you make use of the `raw`, `toArray`, or `toObject` functions, pleas
* Converted line endings to linux, some files snuck through with Windows line endings
* Documentation updated

### Added

* Added `subscription()` to handle adding, updating, checking and removing a subscription to a project.

### Removed

* None


## 1.0.0 (2023-12-25)
## [1.0.0] - 2023-12-25

* Initial release


[unreleased]: https://github.com/ericsizemore/librariesio/tree/master
[1.1.1]: https://github.com/ericsizemore/librariesio/releases/tag/v1.1.1
[1.1.0]: https://github.com/ericsizemore/librariesio/releases/tag/v1.1.0
[1.0.0]: https://github.com/ericsizemore/librariesio/releases/tag/v1.0.0
2 changes: 2 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"symfony/cache": "^7.0"
},
"require-dev": {
"esi/phpunit-coverage-check": "^1.0",
"friendsofphp/php-cs-fixer": "dev-master",
"phpstan/phpstan": "^1.11 <2.0",
"phpstan/phpstan-phpunit": "^1.4",
Expand All @@ -58,6 +59,7 @@
}
},
"scripts": {
"coverage": "vendor/bin/coverage-check coverage:check build/logs/clover.xml 100 --ansi",
"phpcs-fix": "vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php",
"phpcs-nofix": "vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php --dry-run --diff",
"phpstan": "vendor/bin/phpstan analyse -c phpstan.neon",
Expand Down
126 changes: 109 additions & 17 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 9 additions & 5 deletions src/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,17 @@ final class Utils
public static function endpointParameters(string $endpoint, string $subset, array $options): array
{
$parameters = match($endpoint) {
'project' => Utils::$projectParameters[$subset] ?? throw new InvalidEndpointException('Invalid endpoint subset specified.'),
'repository' => Utils::$repositoryParameters[$subset] ?? throw new InvalidEndpointException('Invalid endpoint subset specified.'),
'user' => Utils::$userParameters[$subset] ?? throw new InvalidEndpointException('Invalid endpoint subset specified.'),
'subscription' => Utils::$subscriptionParameters[$subset] ?? throw new InvalidEndpointException('Invalid endpoint subset specified.'),
default => throw new InvalidEndpointException('Invalid endpoint subset specified.')
'project' => Utils::$projectParameters[$subset] ?? null,
'repository' => Utils::$repositoryParameters[$subset] ?? null,
'user' => Utils::$userParameters[$subset] ?? null,
'subscription' => Utils::$subscriptionParameters[$subset] ?? null,
default => null
};

if ($parameters === null) {
throw new InvalidEndpointException('Invalid endpoint subset specified.');
}

foreach ($parameters['options'] as $endpointOption) {
if (!isset($options[$endpointOption])) {
throw new InvalidEndpointOptionsException(
Expand Down

0 comments on commit 25c152d

Please sign in to comment.