1 | <?php |
||
20 | final class AuthService extends AbstractService |
||
21 | { |
||
22 | /** |
||
23 | * @var string |
||
24 | */ |
||
25 | private $authUrl; |
||
26 | |||
27 | /** |
||
28 | * AuthService constructor. |
||
29 | * |
||
30 | * @param ConnectionInterface $connection |
||
31 | * @param string $authUrl |
||
32 | */ |
||
33 | public function __construct(ConnectionInterface $connection, $authUrl = 'http://www.last.fm/api/auth/') |
||
39 | |||
40 | |||
41 | /** |
||
42 | * Creates a new session from a token. |
||
43 | * |
||
44 | * @param string $token |
||
45 | * |
||
46 | * @return SessionInterface|null |
||
47 | * |
||
48 | * @throws ApiException |
||
49 | * @throws NotFoundException |
||
50 | */ |
||
51 | public function createSession($token) |
||
63 | |||
64 | /** |
||
65 | * Creates a new api token. |
||
66 | * |
||
67 | * @return string|false |
||
68 | * |
||
69 | * @throws ApiException |
||
70 | * @throws NotFoundException |
||
71 | */ |
||
72 | public function createToken() |
||
82 | |||
83 | /** |
||
84 | * Return the auth url. |
||
85 | * |
||
86 | * @param string $callbackUrl |
||
87 | * |
||
88 | * @return string |
||
89 | */ |
||
90 | public function getAuthUrl($callbackUrl) |
||
94 | } |
||
95 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)
or! empty(...)
instead.