Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Authenticator/CookieAuthenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function authenticate(ServerRequestInterface $request): ResultInterface

$identity = $this->_identifier->identify(compact('username'));

if (empty($identity)) {
if (!$identity) {
return new Result(null, Result::FAILURE_IDENTITY_NOT_FOUND, $this->_identifier->getErrors());
}

Expand Down
4 changes: 2 additions & 2 deletions src/Authenticator/EnvironmentAuthenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public function authenticate(ServerRequestInterface $request): ResultInterface
return $this->_buildLoginUrlErrorResult($request);
}
$data = $this->_getData($request);
if (empty($data)) {
if (!$data) {
return new Result(null, Result::FAILURE_CREDENTIALS_MISSING, [
'Environment credentials not found',
]);
Expand All @@ -147,7 +147,7 @@ public function authenticate(ServerRequestInterface $request): ResultInterface

$user = $this->_identifier->identify($data);

if (empty($user)) {
if (!$user) {
return new Result(null, Result::FAILURE_IDENTITY_NOT_FOUND, $this->_identifier->getErrors());
}

Expand Down
2 changes: 1 addition & 1 deletion src/Authenticator/FormAuthenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public function authenticate(ServerRequestInterface $request): ResultInterface

$user = $this->_identifier->identify($data);

if (empty($user)) {
if (!$user) {
return new Result(null, Result::FAILURE_IDENTITY_NOT_FOUND, $this->_identifier->getErrors());
}

Expand Down
8 changes: 4 additions & 4 deletions src/Authenticator/HttpDigestAuthenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function authenticate(ServerRequestInterface $request): ResultInterface
AbstractIdentifier::CREDENTIAL_USERNAME => $digest['username'],
]);

if (empty($user)) {
if (!$user) {
return new Result(null, Result::FAILURE_IDENTITY_NOT_FOUND);
}

Expand Down Expand Up @@ -132,13 +132,13 @@ protected function _getDigest(ServerRequestInterface $request): ?array
{
$server = $request->getServerParams();
$digest = empty($server['PHP_AUTH_DIGEST']) ? null : $server['PHP_AUTH_DIGEST'];
if (empty($digest) && function_exists('apache_request_headers')) {
if (!$digest && function_exists('apache_request_headers')) {
$headers = apache_request_headers();
if (!empty($headers['Authorization']) && substr($headers['Authorization'], 0, 7) === 'Digest ') {
$digest = substr($headers['Authorization'], 7);
}
}
if (empty($digest)) {
if (!$digest) {
return null;
}

Expand All @@ -165,7 +165,7 @@ public function parseAuthData(string $digest): ?array
unset($req[$i[1]]);
}

if (empty($req)) {
if (!$req) {
return $keys;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Authenticator/JwtAuthenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public function authenticate(ServerRequestInterface $request): ResultInterface
$subjectKey => $result[$subjectKey],
]);

if (empty($user)) {
if (!$user) {
return new Result(null, Result::FAILURE_IDENTITY_NOT_FOUND, $this->_identifier->getErrors());
}

Expand Down
4 changes: 2 additions & 2 deletions src/Authenticator/SessionAuthenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function authenticate(ServerRequestInterface $request): ResultInterface
$session = $request->getAttribute('session');
$user = $session->read($sessionKey);

if (empty($user)) {
if (!$user) {
return new Result(null, Result::FAILURE_IDENTITY_NOT_FOUND);
}

Expand All @@ -71,7 +71,7 @@ public function authenticate(ServerRequestInterface $request): ResultInterface
}
$user = $this->_identifier->identify($credentials);

if (empty($user)) {
if (!$user) {
return new Result(null, Result::FAILURE_CREDENTIALS_INVALID);
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/Authenticator/TokenAuthenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ protected function stripTokenPrefix(string $token, string $prefix): string
*/
protected function getTokenFromHeader(ServerRequestInterface $request, ?string $headerLine): ?string
{
if (!empty($headerLine)) {
if ($headerLine) {
$header = $request->getHeaderLine($headerLine);
if (!empty($header)) {
if ($header) {
return $header;
}
}
Expand All @@ -89,12 +89,12 @@ protected function getTokenFromHeader(ServerRequestInterface $request, ?string $
* Gets the token from the request query
*
* @param \Psr\Http\Message\ServerRequestInterface $request The request that contains login information.
* @param string $queryParam Request query parameter name
* @param string|null $queryParam Request query parameter name
* @return string|null
*/
protected function getTokenFromQuery(ServerRequestInterface $request, ?string $queryParam): ?string
{
if (empty($queryParam)) {
if (!$queryParam) {
return null;
}

Expand Down Expand Up @@ -123,7 +123,7 @@ public function authenticate(ServerRequestInterface $request): ResultInterface
TokenIdentifier::CREDENTIAL_TOKEN => $token,
]);

if (empty($user)) {
if (!$user) {
return new Result(null, Result::FAILURE_IDENTITY_NOT_FOUND, $this->_identifier->getErrors());
}

Expand Down
3 changes: 1 addition & 2 deletions src/UrlChecker/DefaultUrlChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ public function check(ServerRequestInterface $request, $loginUrls, array $option
$options = $this->_mergeDefaultOptions($options);

$urls = (array)$loginUrls;

if (empty($urls)) {
if (!$urls) {
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion src/View/Helper/IdentityHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public function is(int|string $id, string $field = 'id'): bool
*/
public function get(?string $key = null): mixed
{
if (empty($this->_identity)) {
if ($this->_identity === null) {
return null;
}

Expand Down