Skip to content

Commit

Permalink
fix/main: fix cs
Browse files Browse the repository at this point in the history
  • Loading branch information
2amjsouza committed Aug 14, 2023
1 parent d7ec947 commit dfc2471
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 40 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,14 +182,14 @@ accessToken: access-key-user-1

Then you can send `multipart/form-data` request with the following parameters:

- from
- sender *(optional)*
- to
- receiver *(optional)*
- subject
- language *(optional, default=en)*
- template *(optional, default defined on the application)*
- attachments[] *(optional)*
- from
- sender *(optional)*
- to
- receiver *(optional)*
- subject
- language *(optional, default=en)*
- template *(optional, default defined on the application)*
- attachments[] *(optional)*

Here is a sample request:

Expand Down
8 changes: 4 additions & 4 deletions app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,19 @@ public function register(): void
});
}

public function render($request, Throwable $e)
public function render($request, Throwable $exception)
{
$e = $this->mapException($e);
$exception = $this->mapException($exception);

$response = [
'error' => [
'message' => $e->getMessage(),
'message' => $exception->getMessage(),
],
'status' => 500,
];

if (env('APP_ENV') !== 'production') {
$response['trace'] = $e->getTrace();
$response['trace'] = $exception->getTrace();
}

return response() ->json(
Expand Down
4 changes: 2 additions & 2 deletions app/Providers/AuthorizationProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,14 @@ public static function getTokenProperties(string $accessKey): array

$keys = collect(config('laravel-mail-api.accessTokens'));

if (is_null($accessTokenProperties = $keys->get($accessKey))) {
if (is_null($accessProperties = $keys->get($accessKey))) {
$errorMessage = 'Invalid access token.';

Log::error($errorMessage);

throw new Exception($errorMessage);
}

return $accessTokenProperties;
return $accessProperties;
}
}
14 changes: 7 additions & 7 deletions contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ We accept contributions via Pull Requests on [Github](https://github.com/2amigos

## Pull Requests

- **[PSR-12 Coding Standard](https://www.php-fig.org/psr/psr-12/)** - The easiest way to apply the conventions is by running **Laravel Ping** command: `./vendor/bin/pint`
- **[PSR-12 Coding Standard](https://www.php-fig.org/psr/psr-12/)** - The easiest way to apply the conventions is by running **Laravel Ping** command: `./vendor/bin/pint`
and using [PHP Code Sniffer](https://github.com/squizlabs/PHP_CodeSniffer)

- **Add tests!** - Your patch won't be accepted if it doesn't have tests.
- **Add tests!** - Your patch won't be accepted if it doesn't have tests.

- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date.
- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date.

- **Consider our release cycle** - We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option.
- **Consider our release cycle** - We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option.

- **Create feature branches** - Don't ask us to pull from your master branch.
- **Create feature branches** - Don't ask us to pull from your master branch.

- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.
- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.

- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please squash them before submitting.
- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please squash them before submitting.


## Running Tests
Expand Down
32 changes: 16 additions & 16 deletions license.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,27 @@

Copyright (c) 2013-2023, 2amigOS! Consulting Group LLC.

> Redistribution and use in source and binary forms, with or without modification,
> are permitted provided that the following conditions are met:
>
> Redistribution and use in source and binary forms, with or without modification,
> are permitted provided that the following conditions are met:
>
> Redistributions of source code must retain the above copyright notice, this
> list of conditions and the following disclaimer.
>
>
> Redistributions in binary form must reproduce the above copyright notice, this
> list of conditions and the following disclaimer in the documentation and/or
> other materials provided with the distribution.
>
>
> Neither the name of 2amigOS! Consulting Group, LLC. nor the names of its
> contributors may be used to endorse or promote products derived from
> this software without specific prior written permission.
>
>THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
>ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
>WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
>DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
>ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
>(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
>LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
>ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
>(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
>SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
>
> THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
> ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
> WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
> ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
> (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
> LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
> ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
> SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
8 changes: 5 additions & 3 deletions tests/Unit/TokenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,12 @@ public function test_check_signature(string $accessKey, string $timeStampCheck,
private function createSignedToken(string $accessKey, string $timeStamp): string
{
try {
$accessToken = AuthorizationProvider::getTokenProperties($accessKey);

return AuthorizationProvider::signToken(
appKey: $this->accessKeyProperties['appKey'],
appSecret: $this->accessKeyProperties['appSecret'],
timeStamp: $this->timeStamp,
appKey: $accessToken['appKey'],
appSecret: $accessToken['appSecret'],
timeStamp: $timeStamp,
);
} catch (Exception $exception) {
$this->fail($exception->getMessage());
Expand Down

0 comments on commit dfc2471

Please sign in to comment.