@@ -25,8 +25,8 @@ |
||
| 25 | 25 | /** |
| 26 | 26 | * Make a new BlockingConsumer instance. |
| 27 | 27 | * |
| 28 | - * @param \Projectmentor\Quota\Stubs\PayloadInterface $data |
|
| 29 | - * @return \Projectmentor\Quota\BlockingConsumer |
|
| 28 | + * @param PayloadInterface $data |
|
| 29 | + * @return BlockingConsumer |
|
| 30 | 30 | */ |
| 31 | 31 | public function make(PayloadInterface $data) |
| 32 | 32 | { |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | * Make a new FileStorage instance. |
| 28 | 28 | * |
| 29 | 29 | * @param \Projectmentor\Quota\Stubs\PayloadInterface $data; |
| 30 | - * @return \Projectmentor\Quota\Storage\FileStorage |
|
| 30 | + * @return FileStorage |
|
| 31 | 31 | */ |
| 32 | 32 | public function make(PayloadInterface $data) |
| 33 | 33 | { |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | /** |
| 26 | 26 | * Make a new TokenBucket instance. |
| 27 | 27 | * |
| 28 | - * @param \Projectmentor\Quota\TokenBucketData $data |
|
| 28 | + * @param PayloadInterface $data |
|
| 29 | 29 | * @return \bandwidthThrottle\tokenBucket\TokenBucket |
| 30 | 30 | */ |
| 31 | 31 | public function make(PayloadInterface $data) |
@@ -65,7 +65,7 @@ |
||
| 65 | 65 | /** |
| 66 | 66 | * Implements PayloadInterface |
| 67 | 67 | * emit array payload. |
| 68 | - * @return string |
|
| 68 | + * @return string[] |
|
| 69 | 69 | */ |
| 70 | 70 | public function toArray() |
| 71 | 71 | { |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | /** |
| 84 | 84 | * Get the storage instance. |
| 85 | 85 | * |
| 86 | - * @return \bandwithThrottle\tokenBucket\storage\FileStorage |
|
| 86 | + * @return \bandwidthThrottle\tokenBucket\storage\FileStorage |
|
| 87 | 87 | */ |
| 88 | 88 | public function getStorage() |
| 89 | 89 | { |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | /** |
| 104 | 104 | * Implements PayloadInterface |
| 105 | 105 | * emit array payload. |
| 106 | - * @return string |
|
| 106 | + * @return string[] |
|
| 107 | 107 | */ |
| 108 | 108 | public function toArray() |
| 109 | 109 | { |
@@ -108,20 +108,20 @@ |
||
| 108 | 108 | public function bindInterfaces() |
| 109 | 109 | { |
| 110 | 110 | $this->app->when(RateFactory::class) |
| 111 | - ->needs('Projectmentor\Quota\Contracts\PayloadInterface') |
|
| 112 | - ->give(RateData::class); |
|
| 111 | + ->needs('Projectmentor\Quota\Contracts\PayloadInterface') |
|
| 112 | + ->give(RateData::class); |
|
| 113 | 113 | |
| 114 | 114 | $this->app->when(FileStorageFactory::class) |
| 115 | - ->needs('Projectmentor\Quota\Contracts\PayloadInterface') |
|
| 116 | - ->give(FileStorageData::class); |
|
| 115 | + ->needs('Projectmentor\Quota\Contracts\PayloadInterface') |
|
| 116 | + ->give(FileStorageData::class); |
|
| 117 | 117 | |
| 118 | 118 | $this->app->when(TokenBucketFactory::class) |
| 119 | - ->needs('Projectmentor\Quota\Contracts\PayloadInterface') |
|
| 120 | - ->give(TokenBucketData::class); |
|
| 119 | + ->needs('Projectmentor\Quota\Contracts\PayloadInterface') |
|
| 120 | + ->give(TokenBucketData::class); |
|
| 121 | 121 | |
| 122 | 122 | $this->app->when(BlockingConsumerFactory::class) |
| 123 | - ->needs('Projectmentor\Quota\Contracts\PayloadInterface') |
|
| 124 | - ->give(BlockingConsumerData::class); |
|
| 123 | + ->needs('Projectmentor\Quota\Contracts\PayloadInterface') |
|
| 124 | + ->give(BlockingConsumerData::class); |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | /** |
@@ -130,19 +130,19 @@ |
||
| 130 | 130 | */ |
| 131 | 131 | protected function registerFactories() |
| 132 | 132 | { |
| 133 | - $this->app->singleton('quota.factory.rate', function ($app) { |
|
| 133 | + $this->app->singleton('quota.factory.rate', function($app) { |
|
| 134 | 134 | return new RateFactory; |
| 135 | 135 | }); |
| 136 | 136 | |
| 137 | - $this->app->singleton('quota.factory.storage.file', function ($app) { |
|
| 137 | + $this->app->singleton('quota.factory.storage.file', function($app) { |
|
| 138 | 138 | return new FileStorageFactory; |
| 139 | 139 | }); |
| 140 | 140 | |
| 141 | - $this->app->singleton('quota.factory.tokenbucket', function ($app) { |
|
| 141 | + $this->app->singleton('quota.factory.tokenbucket', function($app) { |
|
| 142 | 142 | return new TokenBucketFactory; |
| 143 | 143 | }); |
| 144 | 144 | |
| 145 | - $this->app->singleton('quota.factory.blockingconsumer', function ($app) { |
|
| 145 | + $this->app->singleton('quota.factory.blockingconsumer', function($app) { |
|
| 146 | 146 | return new BlockingConsumerFactory; |
| 147 | 147 | }); |
| 148 | 148 | |
@@ -11,11 +11,6 @@ |
||
| 11 | 11 | |
| 12 | 12 | namespace Projectmentor\Quota; |
| 13 | 13 | |
| 14 | -use bandwidthThrottle\tokenBucket\Rate; |
|
| 15 | -use bandwidthThrottle\tokenBucket\TokenBucket; |
|
| 16 | -use bandwidthThrottle\tokenBucket\BlockingConsumer; |
|
| 17 | -use bandwidthThrottle\tokenBucket\storage\FileStorage; |
|
| 18 | - |
|
| 19 | 14 | use Illuminate\Foundation\Application as LaravelApplication; |
| 20 | 15 | use Laravel\Lumen\Application as LumenApplication; |
| 21 | 16 | |
@@ -51,8 +51,8 @@ |
||
| 51 | 51 | } else { |
| 52 | 52 | throw new \InvalidArgumentException( |
| 53 | 53 | __CLASS__.'::'.__FUNCTION__. |
| 54 | - ' Invalid constant. Got: ' . $key . |
|
| 55 | - ' Expected: ' . print_r($constants, 1) |
|
| 54 | + ' Invalid constant. Got: '.$key. |
|
| 55 | + ' Expected: '.print_r($constants, 1) |
|
| 56 | 56 | ); |
| 57 | 57 | } |
| 58 | 58 | } |
@@ -21,6 +21,13 @@ |
||
| 21 | 21 | */ |
| 22 | 22 | interface PayloadInterface |
| 23 | 23 | { |
| 24 | + /** |
|
| 25 | + * @return string |
|
| 26 | + */ |
|
| 24 | 27 | public function toJson(); |
| 28 | + |
|
| 29 | + /** |
|
| 30 | + * @return string[] |
|
| 31 | + */ |
|
| 25 | 32 | public function toArray(); |
| 26 | 33 | } |
@@ -65,7 +65,7 @@ |
||
| 65 | 65 | /** |
| 66 | 66 | * Implements PayloadInterface |
| 67 | 67 | * emit array payload. |
| 68 | - * @return string |
|
| 68 | + * @return string[] |
|
| 69 | 69 | */ |
| 70 | 70 | public function toArray() |
| 71 | 71 | { |