@@ -6,50 +6,50 @@ |
||
| 6 | 6 | use Psr\Http\Message\UriInterface; |
| 7 | 7 | |
| 8 | 8 | class Photo extends Model { |
| 9 | - const RATIO_SQUARE = '1:1'; |
|
| 10 | - const RATIO_RECTANGLE = '2:1'; |
|
| 11 | - const RATIO_HEADLINE = '3:2'; |
|
| 12 | - const RATIO_VERTICAL = '9:16'; |
|
| 13 | - const RATIO_COVER = 'cover'; |
|
| 14 | - |
|
| 15 | - /** |
|
| 16 | - * constructor |
|
| 17 | - * |
|
| 18 | - * @param \Psr\Http\Message\UriInterface|string $url |
|
| 19 | - * @param string $ratio |
|
| 20 | - * @param string $description |
|
| 21 | - * @param string $information |
|
| 22 | - */ |
|
| 23 | - public function __construct( |
|
| 24 | - $url, |
|
| 25 | - $ratio, |
|
| 26 | - $description = '', |
|
| 27 | - $information = '' |
|
| 28 | - ) { |
|
| 29 | - $url = $this->filterUriInstance($url); |
|
| 30 | - |
|
| 31 | - $allowedRatio = array( |
|
| 32 | - self::RATIO_SQUARE, |
|
| 33 | - self::RATIO_RECTANGLE, |
|
| 34 | - self::RATIO_HEADLINE, |
|
| 35 | - self::RATIO_VERTICAL, |
|
| 36 | - self::RATIO_COVER, |
|
| 37 | - ); |
|
| 38 | - |
|
| 39 | - if (!in_array($ratio, $allowedRatio)) { |
|
| 40 | - throw new \Exception("ratio $ratio not allowed, allowed ratio are " . implode(', ', $allowedRatio)); |
|
| 41 | - } |
|
| 42 | - |
|
| 43 | - $description = $this->filterStringInstance($description); |
|
| 44 | - $information = $this->filterStringInstance($information); |
|
| 45 | - |
|
| 46 | - $this->collection = new Collection( |
|
| 47 | - array( |
|
| 48 | - 'url' => $url, |
|
| 49 | - 'ratio' => $ratio, |
|
| 50 | - 'description' => $description, |
|
| 51 | - 'information' => $information, |
|
| 52 | - ) |
|
| 53 | - ); |
|
| 54 | - } |
|
| 9 | + const RATIO_SQUARE = '1:1'; |
|
| 10 | + const RATIO_RECTANGLE = '2:1'; |
|
| 11 | + const RATIO_HEADLINE = '3:2'; |
|
| 12 | + const RATIO_VERTICAL = '9:16'; |
|
| 13 | + const RATIO_COVER = 'cover'; |
|
| 14 | + |
|
| 15 | + /** |
|
| 16 | + * constructor |
|
| 17 | + * |
|
| 18 | + * @param \Psr\Http\Message\UriInterface|string $url |
|
| 19 | + * @param string $ratio |
|
| 20 | + * @param string $description |
|
| 21 | + * @param string $information |
|
| 22 | + */ |
|
| 23 | + public function __construct( |
|
| 24 | + $url, |
|
| 25 | + $ratio, |
|
| 26 | + $description = '', |
|
| 27 | + $information = '' |
|
| 28 | + ) { |
|
| 29 | + $url = $this->filterUriInstance($url); |
|
| 30 | + |
|
| 31 | + $allowedRatio = array( |
|
| 32 | + self::RATIO_SQUARE, |
|
| 33 | + self::RATIO_RECTANGLE, |
|
| 34 | + self::RATIO_HEADLINE, |
|
| 35 | + self::RATIO_VERTICAL, |
|
| 36 | + self::RATIO_COVER, |
|
| 37 | + ); |
|
| 38 | + |
|
| 39 | + if (!in_array($ratio, $allowedRatio)) { |
|
| 40 | + throw new \Exception("ratio $ratio not allowed, allowed ratio are " . implode(', ', $allowedRatio)); |
|
| 41 | + } |
|
| 42 | + |
|
| 43 | + $description = $this->filterStringInstance($description); |
|
| 44 | + $information = $this->filterStringInstance($information); |
|
| 45 | + |
|
| 46 | + $this->collection = new Collection( |
|
| 47 | + array( |
|
| 48 | + 'url' => $url, |
|
| 49 | + 'ratio' => $ratio, |
|
| 50 | + 'description' => $description, |
|
| 51 | + 'information' => $information, |
|
| 52 | + ) |
|
| 53 | + ); |
|
| 54 | + } |
|
| 55 | 55 | } |
@@ -5,7 +5,8 @@ |
||
| 5 | 5 | use One\Collection; |
| 6 | 6 | use Psr\Http\Message\UriInterface; |
| 7 | 7 | |
| 8 | -class Photo extends Model { |
|
| 8 | +class Photo extends Model |
|
| 9 | +{ |
|
| 9 | 10 | const RATIO_SQUARE = '1:1'; |
| 10 | 11 | const RATIO_RECTANGLE = '2:1'; |
| 11 | 12 | const RATIO_HEADLINE = '3:2'; |