matecat /
simple-s3
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * This file is part of the Simple S3 package. |
||
| 4 | * |
||
| 5 | * (c) Mauro Cassani<https://github.com/mauretto78> |
||
| 6 | * |
||
| 7 | * For the full copyright and license information, please view the LICENSE |
||
| 8 | * file that was distributed with this source code. |
||
| 9 | * |
||
| 10 | */ |
||
| 11 | |||
| 12 | namespace Matecat\SimpleS3\Commands\Handlers; |
||
| 13 | |||
| 14 | use Exception; |
||
| 15 | use Matecat\SimpleS3\Commands\CommandHandler; |
||
| 16 | |||
| 17 | class GetBucketPolicy extends CommandHandler |
||
| 18 | { |
||
| 19 | /** |
||
| 20 | * Get the policy of a bucket. |
||
| 21 | * |
||
| 22 | * @param array $params |
||
| 23 | * |
||
| 24 | * @return int|mixed |
||
| 25 | * @throws Exception |
||
| 26 | */ |
||
| 27 | 1 | public function handle(array $params = []): mixed |
|
| 28 | { |
||
| 29 | 1 | $bucketName = $params[ 'bucket' ]; |
|
| 30 | |||
| 31 | 1 | $result = $this->client->getConn()->getBucketPolicy([ |
|
| 32 | 1 | 'Bucket' => $bucketName, |
|
| 33 | 1 | ]); |
|
| 34 | |||
| 35 | 1 | $this->commandHandlerLogger?->log($this, sprintf('Size of \'%s\' bucket was successfully obtained', $bucketName)); |
|
| 36 | |||
| 37 | 1 | return (isset($result[ 'Policy' ])) ? json_decode($result[ 'Policy' ]->getContents(), true) : ''; |
|
|
0 ignored issues
–
show
|
|||
| 38 | } |
||
| 39 | |||
| 40 | /** |
||
| 41 | * @param array $params |
||
| 42 | * |
||
| 43 | * @return bool |
||
| 44 | */ |
||
| 45 | 1 | public function validateParams(array $params = []): bool |
|
| 46 | { |
||
| 47 | 1 | return isset($params[ 'bucket' ]); |
|
| 48 | } |
||
| 49 | } |
||
| 50 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.