Skip to content

Commit 62bca74

Browse files
authored
Merge pull request #28 from j0k3r/3/fix-error-over-capacity
Fix error when "Imgur is temporarily over capacity"
2 parents 900279b + 17d334f commit 62bca74

37 files changed

+292
-236
lines changed

Diff for: .php_cs

+39-8
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,45 @@
11
<?php
22

3-
$finder = PhpCsFixer\Finder::create()
4-
->in(__DIR__)
5-
->exclude(array('vendor'));
6-
73
return PhpCsFixer\Config::create()
8-
->setUsingCache(true)
4+
->setRiskyAllowed(true)
95
->setRules([
10-
'@PSR2' => true,
11-
'array_syntax' => ['syntax' => 'short'],
6+
'@Symfony' => true,
7+
'@Symfony:risky' => true,
8+
'array_syntax' => [
9+
'syntax' => 'short'
10+
],
11+
'combine_consecutive_unsets' => true,
12+
'heredoc_to_nowdoc' => true,
13+
'no_extra_consecutive_blank_lines' => [
14+
'break',
15+
'continue',
16+
'extra',
17+
'return',
18+
'throw',
19+
'use',
20+
'parenthesis_brace_block',
21+
'square_brace_block',
22+
'curly_brace_block'
23+
],
24+
'no_unreachable_default_argument_value' => true,
25+
'no_useless_else' => true,
26+
'no_useless_return' => true,
27+
'ordered_class_elements' => true,
28+
'ordered_imports' => true,
29+
'php_unit_strict' => true,
1230
'phpdoc_order' => true,
31+
// 'psr4' => true,
32+
'strict_comparison' => true,
33+
'strict_param' => true,
34+
'concat_space' => [
35+
'spacing' => 'one'
36+
],
1337
])
14-
->setFinder($finder);
38+
->setFinder(
39+
PhpCsFixer\Finder::create()
40+
->exclude([
41+
'vendor',
42+
])
43+
->in(__DIR__)
44+
)
45+
;

Diff for: .travis.yml

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
11
language: php
22

33
php:
4-
- 5.5
54
- 5.6
65
- 7.0
76
- 7.1
87
- 7.2
8+
- 7.3
99
- nightly
10-
- hhvm
1110

1211
# run build against nightly but allow them to fail
1312
matrix:
1413
fast_finish: true
1514
include:
16-
- php: 7.0
15+
- php: 7.2
1716
env: CS_FIXER=run
1817
allow_failures:
19-
- php: hhvm
2018
- php: nightly
2119

2220
# faster builds on new travis setup not using sudo
@@ -32,10 +30,10 @@ install:
3230
- composer self-update
3331

3432
before_script:
35-
- composer install --prefer-dist --no-interaction
33+
- composer install --prefer-dist --no-interaction -o
3634

3735
script:
38-
- phpunit --coverage-clover=coverage.clover
36+
- ./vendor/bin/simple-phpunit -v --coverage-clover=coverage.clover
3937
- if [ "$CS_FIXER" = "run" ]; then php vendor/bin/php-cs-fixer fix --verbose --dry-run ; fi;
4038

4139
after_script:

Diff for: README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Uses [Imgur API v3](https://api.imgur.com/).
1616
* Branch [2.x](https://github.com/j0k3r/php-imgur-api-client/tree/2.x) use Guzzle 5
1717
* Branch [3.x](https://github.com/j0k3r/php-imgur-api-client/tree/3.x) use Guzzle 6
1818

19-
All actives branches required PHP >= 5.5
19+
All actives branches required PHP >= 5.6
2020

2121
## Composer
2222

@@ -54,7 +54,7 @@ if (isset($_SESSION['token'])) {
5454
$client->setAccessToken($_SESSION['token']);
5555

5656
if ($client->checkAccessTokenExpired()) {
57-
$client->refreshToken();
57+
$client->refreshToken();
5858
}
5959
} elseif (isset($_GET['code'])) {
6060
$client->requestAccessToken($_GET['code']);

Diff for: composer.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@
3434
}
3535
},
3636
"require": {
37-
"php": ">=5.5.0",
37+
"php": ">=5.6.0",
3838
"ext-curl": "*",
3939
"guzzlehttp/guzzle": "^6.0"
4040
},
4141
"require-dev": {
42-
"friendsofphp/php-cs-fixer": "^2",
43-
"phpunit/phpunit": "^4.8|^6.5|^7.0"
42+
"friendsofphp/php-cs-fixer": "^2.0",
43+
"symfony/phpunit-bridge": "^4.0"
4444
},
4545
"extra": {
4646
"branch-alias": {

Diff for: lib/Imgur/Api/AbstractApi.php

+14-14
Original file line numberDiff line numberDiff line change
@@ -98,20 +98,6 @@ public function delete($url, $parameters = [])
9898
return $httpClient->parseResponse($response);
9999
}
100100

101-
/**
102-
* Global method to validate an argument.
103-
*
104-
* @param string $type The required parameter (used for the error message)
105-
* @param string $input Input value
106-
* @param array $possibleValues Possible values for this argument
107-
*/
108-
private function validateArgument($type, $input, $possibleValues)
109-
{
110-
if (!in_array($input, $possibleValues, true)) {
111-
throw new InvalidArgumentException($type . ' parameter "' . $input . '" is wrong. Possible values are: ' . implode(', ', $possibleValues));
112-
}
113-
}
114-
115101
/**
116102
* Validate "sort" parameter and throw an exception if it's a bad value.
117103
*
@@ -144,4 +130,18 @@ protected function validateVoteArgument($vote, $possibleValues)
144130
{
145131
$this->validateArgument('Vote', $vote, $possibleValues);
146132
}
133+
134+
/**
135+
* Global method to validate an argument.
136+
*
137+
* @param string $type The required parameter (used for the error message)
138+
* @param string $input Input value
139+
* @param array $possibleValues Possible values for this argument
140+
*/
141+
private function validateArgument($type, $input, $possibleValues)
142+
{
143+
if (!\in_array($input, $possibleValues, true)) {
144+
throw new InvalidArgumentException($type . ' parameter "' . $input . '" is wrong. Possible values are: ' . implode(', ', $possibleValues));
145+
}
146+
}
147147
}

0 commit comments

Comments
 (0)