22
33namespace 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 ;
69use UserBase \Client \Model \Account ;
7- use UserBase \Client \Model \AccountUser ;
810use UserBase \Client \Model \AccountEmail ;
911use UserBase \Client \Model \AccountProperty ;
12+ use UserBase \Client \Model \AccountUser ;
1013use UserBase \Client \Model \Policy ;
11- use Psr \Cache \CacheItemPoolInterface ;
12- use RuntimeException ;
14+ use UserBase \Client \Model \User ;
1315
1416if (!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