Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Commit

Permalink
Merge pull request #34 from webimpress/improvement/import-internals
Browse files Browse the repository at this point in the history
Import internal PHP functions + optimize imports
  • Loading branch information
Geert Eltink committed Mar 15, 2018
2 parents 2a0a7d9 + 61d4446 commit f441c30
Show file tree
Hide file tree
Showing 15 changed files with 44 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/CryptKeyTrait.php
Expand Up @@ -10,6 +10,9 @@

use League\OAuth2\Server\CryptKey;

use function is_string;
use function sprintf;

trait CryptKeyTrait
{
protected function getCryptKey($keyConfig, string $configPath) : CryptKey
Expand Down
2 changes: 2 additions & 0 deletions src/Entity/ClientEntity.php
Expand Up @@ -14,6 +14,8 @@
use League\OAuth2\Server\Entities\Traits\ClientTrait;
use League\OAuth2\Server\Entities\Traits\EntityTrait;

use function explode;

class ClientEntity implements ClientEntityInterface
{
use ClientTrait, EntityTrait, RevokableTrait, TimestampableTrait;
Expand Down
2 changes: 2 additions & 0 deletions src/Entity/TimestampableTrait.php
Expand Up @@ -13,6 +13,8 @@
use DateTime;
use DateTimeZone;

use function method_exists;

trait TimestampableTrait
{
/**
Expand Down
1 change: 0 additions & 1 deletion src/OAuth2AdapterFactory.php
Expand Up @@ -13,7 +13,6 @@
use League\OAuth2\Server\ResourceServer;
use Psr\Container\ContainerInterface;
use Psr\Http\Message\ResponseInterface;
use Zend\Expressive\Authentication\OAuth2\Exception;

class OAuth2AdapterFactory
{
Expand Down
2 changes: 2 additions & 0 deletions src/OAuth2Middleware.php
Expand Up @@ -18,6 +18,8 @@
use Psr\Http\Server\RequestHandlerInterface;
use Zend\Expressive\Authentication\OAuth2\Entity\UserEntity;

use function strtoupper;

class OAuth2Middleware implements MiddlewareInterface
{
/**
Expand Down
2 changes: 2 additions & 0 deletions src/OAuth2MiddlewareFactory.php
Expand Up @@ -14,6 +14,8 @@
use Psr\Container\ContainerInterface;
use Psr\Http\Message\ResponseInterface;

use function sprintf;

class OAuth2MiddlewareFactory
{
public function __invoke(ContainerInterface $container) : OAuth2Middleware
Expand Down
3 changes: 3 additions & 0 deletions src/Repository/Pdo/AbstractRepository.php
Expand Up @@ -10,6 +10,9 @@

namespace Zend\Expressive\Authentication\OAuth2\Repository\Pdo;

use function array_reduce;
use function trim;

class AbstractRepository
{
/**
Expand Down
4 changes: 4 additions & 0 deletions src/Repository/Pdo/AccessTokenRepository.php
Expand Up @@ -16,6 +16,10 @@
use League\OAuth2\Server\Repositories\AccessTokenRepositoryInterface;
use Zend\Expressive\Authentication\OAuth2\Entity\AccessTokenEntity;

use function array_key_exists;
use function implode;
use function sprintf;

class AccessTokenRepository extends AbstractRepository implements AccessTokenRepositoryInterface
{
/**
Expand Down
2 changes: 2 additions & 0 deletions src/Repository/Pdo/ClientRepository.php
Expand Up @@ -13,6 +13,8 @@
use League\OAuth2\Server\Repositories\ClientRepositoryInterface;
use Zend\Expressive\Authentication\OAuth2\Entity\ClientEntity;

use function password_verify;

class ClientRepository extends AbstractRepository implements ClientRepositoryInterface
{
/**
Expand Down
2 changes: 2 additions & 0 deletions src/Repository/Pdo/UserRepository.php
Expand Up @@ -14,6 +14,8 @@
use League\OAuth2\Server\Repositories\UserRepositoryInterface;
use Zend\Expressive\Authentication\OAuth2\Entity\UserEntity;

use function password_verify;

class UserRepository extends AbstractRepository implements UserRepositoryInterface
{
public function getUserEntityByUserCredentials(
Expand Down
4 changes: 4 additions & 0 deletions test/AuthorizationServerFactoryTest.php
Expand Up @@ -22,6 +22,10 @@
use Zend\Expressive\Authentication\OAuth2\AuthorizationServerFactory;
use Zend\Expressive\Authentication\OAuth2\Exception\InvalidConfigException;

use function array_merge;
use function array_slice;
use function in_array;

class AuthorizationServerFactoryTest extends TestCase
{
const REPOSITORY_CLASSES = [
Expand Down
12 changes: 12 additions & 0 deletions test/Pdo/OAuth2PdoMiddlewareTest.php
Expand Up @@ -33,6 +33,18 @@
use Zend\Expressive\Authentication\OAuth2\Repository\Pdo\ScopeRepository;
use Zend\Expressive\Authentication\OAuth2\Repository\Pdo\UserRepository;

use function bin2hex;
use function explode;
use function file_exists;
use function file_get_contents;
use function http_build_query;
use function json_decode;
use function parse_str;
use function random_bytes;
use function sprintf;
use function strtolower;
use function unlink;

class OAuth2PdoMiddlewareTest extends TestCase
{
const DB_FILE = __DIR__ . '/TestAsset/test_oauth2.sq3';
Expand Down
2 changes: 2 additions & 0 deletions test/Repository/Pdo/AccessTokenRepositoryTest.php
Expand Up @@ -21,6 +21,8 @@
use Zend\Expressive\Authentication\OAuth2\Repository\Pdo\AccessTokenRepository;
use Zend\Expressive\Authentication\OAuth2\Repository\Pdo\PdoService;

use function time;

class AccessTokenRepositoryTest extends TestCase
{
public function setUp()
Expand Down
2 changes: 2 additions & 0 deletions test/Repository/Pdo/AuthCodeRepositoryTest.php
Expand Up @@ -21,6 +21,8 @@
use Zend\Expressive\Authentication\OAuth2\Repository\Pdo\AuthCodeRepository;
use Zend\Expressive\Authentication\OAuth2\Repository\Pdo\PdoService;

use function time;

class AuthCodeRepositoryTest extends TestCase
{
public function setUp()
Expand Down
2 changes: 2 additions & 0 deletions test/Repository/Pdo/RefreshTokenRepositoryTest.php
Expand Up @@ -20,6 +20,8 @@
use Zend\Expressive\Authentication\OAuth2\Repository\Pdo\PdoService;
use Zend\Expressive\Authentication\OAuth2\Repository\Pdo\RefreshTokenRepository;

use function time;

class RefreshTokenRepositoryTest extends TestCase
{
public function setUp()
Expand Down

0 comments on commit f441c30

Please sign in to comment.