Skip to content

Commit c04229d

Browse files
committed
Release v1.0.4
1 parent f82dfa1 commit c04229d

File tree

6 files changed

+29
-29
lines changed

6 files changed

+29
-29
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
Amazon S3 or Amazon Simple Storage Service component for Yii2.
44

5-
[![Latest Stable Version](http://poser.pugx.org/diecoding/yii2-aws-s3/v)](https://packagist.org/packages/diecoding/yii2-aws-s3)
6-
[![Total Downloads](http://poser.pugx.org/diecoding/yii2-aws-s3/downloads)](https://packagist.org/packages/diecoding/yii2-aws-s3)
7-
[![Quality Score](https://img.shields.io/scrutinizer/g/sugeng-sulistiyawan/yii2-aws-s3.svg)](https://scrutinizer-ci.com/g/sugeng-sulistiyawan/yii2-aws-s3)
8-
[![Build Status](https://app.travis-ci.com/sugeng-sulistiyawan/yii2-aws-s3.svg?branch=master)](https://app.travis-ci.com/sugeng-sulistiyawan/yii2-aws-s3)
9-
[![Latest Unstable Version](http://poser.pugx.org/diecoding/yii2-aws-s3/v/unstable)](https://packagist.org/packages/diecoding/yii2-aws-s3)
10-
[![License](http://poser.pugx.org/diecoding/yii2-aws-s3/license)](https://packagist.org/packages/diecoding/yii2-aws-s3)
11-
[![PHP Version Require](http://poser.pugx.org/diecoding/yii2-aws-s3/require/php)](https://packagist.org/packages/diecoding/yii2-aws-s3)
5+
[![Latest Stable Version](https://img.shields.io/packagist/v/diecoding/yii2-aws-s3?label=stable)](https://packagist.org/packages/diecoding/yii2-aws-s3)
6+
[![Total Downloads](https://img.shields.io/packagist/dt/diecoding/yii2-aws-s3)](https://packagist.org/packages/diecoding/yii2-aws-s3)
7+
[![Latest Stable Release Date](https://img.shields.io/github/release-date/sugeng-sulistiyawan/yii2-aws-s3)](https://github.com/sugeng-sulistiyawan/yii2-aws-s3)
8+
[![Quality Score](https://img.shields.io/scrutinizer/quality/g/sugeng-sulistiyawan/yii2-aws-s3)](https://scrutinizer-ci.com/g/sugeng-sulistiyawan/yii2-aws-s3)
9+
[![Build Status](https://img.shields.io/travis/com/sugeng-sulistiyawan/yii2-aws-s3)](https://app.travis-ci.com/sugeng-sulistiyawan/yii2-aws-s3)
10+
[![License](https://img.shields.io/github/license/sugeng-sulistiyawan/yii2-aws-s3)](https://github.com/sugeng-sulistiyawan/yii2-aws-s3)
11+
[![PHP Version Require](https://img.shields.io/packagist/dependency-v/diecoding/yii2-aws-s3/php?color=6f73a6)](https://packagist.org/packages/diecoding/yii2-aws-s3)
1212

1313
> Yii2 AWS S3 uses [SemVer](http://semver.org/).
1414

src/interfaces/Bus.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
interface Bus
1313
{
1414
/**
15-
* @param \diecoding\aws\s3\interfaces\commands\Command $command
15+
* @param Command $command
1616
*
1717
* @return mixed
1818
*/

src/interfaces/CommandBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ interface CommandBuilder
1414
/**
1515
* @param string $commandClass
1616
*
17-
* @return \diecoding\aws\s3\interfaces\commands\Command
17+
* @return Command
1818
*/
1919
public function build(string $commandClass): Command;
2020
}

src/interfaces/HandlerResolver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
interface HandlerResolver
1414
{
1515
/**
16-
* @param \diecoding\aws\s3\interfaces\commands\Command $command
16+
* @param Command $command
1717
*
18-
* @return \diecoding\aws\s3\interfaces\handlers\Handler
18+
* @return Handler
1919
*/
2020
public function resolve(Command $command): Handler;
2121

src/interfaces/Service.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
interface Service
1313
{
1414
/**
15-
* @param \diecoding\aws\s3\interfaces\commands\Command $command
15+
* @param Command $command
1616
*
1717
* @return mixed
1818
*/
@@ -21,7 +21,7 @@ public function execute(Command $command);
2121
/**
2222
* @param string $commandClass
2323
*
24-
* @return \diecoding\aws\s3\interfaces\commands\Command
24+
* @return Command
2525
*/
2626
public function create(string $commandClass): Command;
2727
}

src/traits/ModelTrait.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function saveUploadedFile(UploadedFile $file, $attribute, $fileName = '',
4141
$fileName = $file->name;
4242
}
4343
if ($autoExtension) {
44-
$_file = pathinfo($fileName, PATHINFO_FILENAME);
44+
$_file = (string) pathinfo($fileName, PATHINFO_FILENAME);
4545
$fileName = $_file . '.' . $file->extension;
4646
}
4747

@@ -139,11 +139,23 @@ public function getFilePresignedUrl($attribute)
139139
*
140140
* @return mixed URL expiration
141141
*/
142-
protected function getPresignedUrlDuration($attribute)
142+
public function getPresignedUrlDuration($attribute)
143143
{
144144
return '+30 minutes';
145145
}
146146

147+
/**
148+
* List the paths on AWS S3 to each model file attribute.
149+
* It must be a Key-Value array, where Key is the attribute name and Value is the base path for the file in S3.
150+
* Override this method for saving each attribute in its own "folder".
151+
*
152+
* @return array Key-Value of attributes and its paths.
153+
*/
154+
public function attributePaths()
155+
{
156+
return [];
157+
}
158+
147159
/**
148160
* Retrieves the base path on AWS S3 for a given attribute.
149161
* @see attributePaths()
@@ -152,7 +164,7 @@ protected function getPresignedUrlDuration($attribute)
152164
*
153165
* @return string The path where all file of that attribute should be stored. Returns empty string if the attribute isn't in the list.
154166
*/
155-
protected function getAttributePath($attribute)
167+
public function getAttributePath($attribute)
156168
{
157169
$paths = $this->attributePaths();
158170
if (array_key_exists($attribute, $paths)) {
@@ -162,18 +174,6 @@ protected function getAttributePath($attribute)
162174
return '';
163175
}
164176

165-
/**
166-
* List the paths on AWS S3 to each model file attribute.
167-
* It must be a Key-Value array, where Key is the attribute name and Value is the base path for the file in S3.
168-
* Override this method for saving each attribute in its own "folder".
169-
*
170-
* @return array Key-Value of attributes and its paths.
171-
*/
172-
protected function attributePaths()
173-
{
174-
return [];
175-
}
176-
177177
/**
178178
* Check for valid status code from the AWS S3 response.
179179
* Success responses will be considered status codes is 2**.
@@ -183,7 +183,7 @@ protected function attributePaths()
183183
*
184184
* @return bool whether this response is successful.
185185
*/
186-
protected function isSuccessResponseStatus($response)
186+
public function isSuccessResponseStatus($response)
187187
{
188188
return !empty($response->get('@metadata')['statusCode']) &&
189189
$response->get('@metadata')['statusCode'] >= 200 &&

0 commit comments

Comments
 (0)