Skip to content

Commit

Permalink
up: format codes by php-cs-fixer
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Jun 29, 2020
1 parent 828cef6 commit 50ad0e6
Show file tree
Hide file tree
Showing 10 changed files with 91 additions and 24 deletions.
11 changes: 9 additions & 2 deletions src/Annotation/Mapping/RateLimiter.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
<?php declare(strict_types=1);

/**
* This file is part of Swoft.
*
* @link https://swoft.org
* @document https://swoft.org/docs
* @contact [email protected]
* @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/

namespace Swoft\Limiter\Annotation\Mapping;

Expand Down Expand Up @@ -157,4 +164,4 @@ public function getDefault(): int
{
return $this->default;
}
}
}
13 changes: 9 additions & 4 deletions src/Annotation/Parser/RateLimiterParser.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
<?php declare(strict_types=1);

/**
* This file is part of Swoft.
*
* @link https://swoft.org
* @document https://swoft.org/docs
* @contact [email protected]
* @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/

namespace Swoft\Limiter\Annotation\Parser;


use Swoft\Annotation\Annotation\Mapping\AnnotationParser;
use Swoft\Annotation\Annotation\Parser\Parser;
use Swoft\Limiter\Annotation\Mapping\RateLimiter;
use Swoft\Limiter\Exception\RateLImiterException;
use Swoft\Limiter\RateLimiterRegister;


/**
* Class RateLimiterParser
*
Expand All @@ -36,4 +41,4 @@ public function parse(int $type, $annotationObject): array
RateLimiterRegister::registerRateLimiter($this->className, $this->methodName, $annotationObject);
return [];
}
}
}
10 changes: 8 additions & 2 deletions src/Aspect/LimiterAspect.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
<?php declare(strict_types=1);

/**
* This file is part of Swoft.
*
* @link https://swoft.org
* @document https://swoft.org/docs
* @contact [email protected]
* @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/

namespace Swoft\Limiter\Aspect;


use Swoft\Aop\Annotation\Mapping\Around;
use Swoft\Aop\Annotation\Mapping\Aspect;
use Swoft\Aop\Annotation\Mapping\PointAnnotation;
Expand Down
8 changes: 8 additions & 0 deletions src/AutoLoader.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
<?php declare(strict_types=1);
/**
* This file is part of Swoft.
*
* @link https://swoft.org
* @document https://swoft.org/docs
* @contact [email protected]
* @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/

namespace Swoft\Limiter;

Expand Down
11 changes: 9 additions & 2 deletions src/Contract/RateLimiterInterface.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
<?php declare(strict_types=1);

/**
* This file is part of Swoft.
*
* @link https://swoft.org
* @document https://swoft.org/docs
* @contact [email protected]
* @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/

namespace Swoft\Limiter\Contract;

Expand All @@ -16,4 +23,4 @@ interface RateLimiterInterface
* @return bool
*/
public function getTicket(array $config): bool;
}
}
12 changes: 9 additions & 3 deletions src/Exception/RateLImiterException.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
<?php declare(strict_types=1);

/**
* This file is part of Swoft.
*
* @link https://swoft.org
* @document https://swoft.org/docs
* @contact [email protected]
* @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/

namespace Swoft\Limiter\Exception;

Expand All @@ -12,5 +19,4 @@
*/
class RateLImiterException extends Exception
{

}
}
13 changes: 9 additions & 4 deletions src/Rate/AbstractRateLimiter.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
<?php declare(strict_types=1);

/**
* This file is part of Swoft.
*
* @link https://swoft.org
* @document https://swoft.org/docs
* @contact [email protected]
* @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/

namespace Swoft\Limiter\Rate;


use Swoft\Limiter\Contract\RateLimiterInterface;

/**
Expand All @@ -13,5 +19,4 @@
*/
abstract class AbstractRateLimiter implements RateLimiterInterface
{

}
}
11 changes: 9 additions & 2 deletions src/Rate/RedisRateLimiter.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
<?php declare(strict_types=1);

/**
* This file is part of Swoft.
*
* @link https://swoft.org
* @document https://swoft.org/docs
* @contact [email protected]
* @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/

namespace Swoft\Limiter\Rate;

Expand Down Expand Up @@ -120,4 +127,4 @@ private function getStorekey(string $name, string $key): string
{
return sprintf('%s:%s:store', $name, $key);
}
}
}
17 changes: 13 additions & 4 deletions src/RateLimiterRegister.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
<?php declare(strict_types=1);

/**
* This file is part of Swoft.
*
* @link https://swoft.org
* @document https://swoft.org/docs
* @contact [email protected]
* @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/

namespace Swoft\Limiter;


use Swoft\Limiter\Annotation\Mapping\RateLimiter;
use Swoft\Limiter\Exception\RateLImiterException;

Expand Down Expand Up @@ -35,8 +41,11 @@ class RateLimiterRegister
public static function registerRateLimiter(string $className, string $method, RateLimiter $rateLimiter): void
{
if (isset(self::$rateLimiters[$className][$method])) {
throw new RateLImiterException(sprintf('`@RateLImiter` must be only one on method(%s->%s)!', $className,
$method));
throw new RateLImiterException(sprintf(
'`@RateLImiter` must be only one on method(%s->%s)!',
$className,
$method
));
}

$rlConfig = [];
Expand Down
9 changes: 8 additions & 1 deletion src/RateLimter.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
<?php declare(strict_types=1);

/**
* This file is part of Swoft.
*
* @link https://swoft.org
* @document https://swoft.org/docs
* @contact [email protected]
* @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/

namespace Swoft\Limiter;

Expand Down

0 comments on commit 50ad0e6

Please sign in to comment.