Skip to content

Commit 83da5d0

Browse files
committed
style: some gentle php-cs-fixer fixes
1 parent 4124c9f commit 83da5d0

14 files changed

Lines changed: 164 additions & 116 deletions

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/.php_cs
2+
/.php_cs.cache
13
vendor/*
24
.env
35
composer.lock

.php_cs.dist

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
$finder = PhpCsFixer\Finder::create()
4+
->in(__DIR__.'/src')
5+
;
6+
7+
return PhpCsFixer\Config::create()
8+
->setRules([
9+
'@PSR1' => true,
10+
'@PSR2' => true,
11+
'@Symfony' => true,
12+
'single_line_throw' => false,
13+
'no_superfluous_phpdoc_tags' => false,
14+
'ordered_imports' => true,
15+
'phpdoc_align' => false,
16+
'no_extra_consecutive_blank_lines' => false,
17+
'blank_line_before_statement' => [
18+
'statements' => [
19+
'declare',
20+
]
21+
],
22+
'array_syntax' => false,
23+
])
24+
->setFinder($finder)
25+
;

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,10 @@ Please refer to the `examples/` directory for other examples.
5252

5353
A Silex Provider is available [here](https://github.com/linkorb/silex-provider-userbase-client)
5454

55-
### Symfony 4
55+
### Symfony
5656

57-
A Symfony 4 bundle can be found [here](https://github.com/linkorb/userbase-client-bundle)
57+
A Symfony bundle can be found [here](https://github.com/linkorb/userbase-client-bundle).
58+
It works with Symfony 4 and 5 projects.
5859

5960
## License
6061

src/Client.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22

33
namespace UserBase\Client;
44

5-
use UserBase\Client\Model\User;
5+
use Psr\Cache\CacheItemPoolInterface;
6+
use RuntimeException;
7+
use Symfony\Component\Cache\Adapter\ArrayAdapter;
8+
use Symfony\Component\Security\Core\Encoder\MessageDigestPasswordEncoder;
69
use UserBase\Client\Model\Account;
7-
use UserBase\Client\Model\AccountUser;
810
use UserBase\Client\Model\AccountEmail;
911
use UserBase\Client\Model\AccountProperty;
12+
use UserBase\Client\Model\AccountUser;
1013
use UserBase\Client\Model\Policy;
11-
use Psr\Cache\CacheItemPoolInterface;
12-
use RuntimeException;
14+
use UserBase\Client\Model\User;
1315

1416
if (!function_exists('curl_file_create')) {
1517
function curl_file_create($filename, $mimetype = '', $postname = '')
@@ -52,7 +54,7 @@ public function __construct($url, $username = null, $password = null, $partition
5254
}
5355

5456
$this->partition = $partition;
55-
$this->cache = new \Symfony\Component\Cache\Adapter\ArrayAdapter();
57+
$this->cache = new ArrayAdapter();
5658
}
5759

5860
private function parse_dsn(array $parts)
@@ -285,8 +287,7 @@ public function getData($uri, $jsonData = null)
285287

286288
$json = curl_exec($ch);
287289

288-
if($json === false)
289-
{
290+
if (false === $json) {
290291
throw new RuntimeException('Curl error: '.curl_error($ch));
291292
}
292293

@@ -296,7 +297,6 @@ public function getData($uri, $jsonData = null)
296297
$this->timeDataCollector->stopMeasure('getData');
297298
}
298299

299-
300300
if (200 != $code) {
301301
throw new RuntimeException('HTTP Status code: '.$code.'message: '.$json);
302302
}
@@ -313,7 +313,7 @@ public function checkCredentials($username, $password)
313313
} catch (\Exception $e) {
314314
return false;
315315
}
316-
$encoder = new \Symfony\Component\Security\Core\Encoder\MessageDigestPasswordEncoder();
316+
$encoder = new MessageDigestPasswordEncoder();
317317
$valid = $encoder->isPasswordValid($user->getPassword(), $password, $user->getSalt());
318318

319319
return $valid;

0 commit comments

Comments
 (0)