Skip to content

Commit

Permalink
Merge 6d9e8e6 into 9a5023c
Browse files Browse the repository at this point in the history
  • Loading branch information
antalaron committed Dec 25, 2019
2 parents 9a5023c + 6d9e8e6 commit 2405094
Show file tree
Hide file tree
Showing 44 changed files with 193 additions and 767 deletions.
28 changes: 10 additions & 18 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,41 +5,33 @@ sudo: false
dist: trusty

php:
- 5.5
- 7.0
- 7.1
- 7.2
- 7.3
- 7.4
- nightly

env:
- SYMFONY_VERSION="2.7.*"
- SYMFONY_VERSION="2.8.*"
- SYMFONY_VERSION="3.4.*"
- SYMFONY_VERSION="4.0.*"
- SYMFONY_VERSION="4.4.*"
- SYMFONY_VERSION="5.0.*"

matrix:
fast_finish: true
exclude:
- php: 5.5
env: SYMFONY_VERSION="4.0.*"
- php: 5.5
env: SYMFONY_VERSION="dev-master"
- php: 7.0
env: SYMFONY_VERSION="4.0.*"
- php: 7.0
env: SYMFONY_VERSION="dev-master"
- php: 7.1
env: SYMFONY_VERSION="5.0.*"
allow_failures:
- php: nightly

before_script:
- composer require symfony/symfony:${SYMFONY_VERSION} --prefer-dist --no-interaction --no-progress
- mkdir -p build/logs
- if [ "${TRAVIS_PHP_VERSION}" == '7.1' ] && [ "${SYMFONY_VERSION}" == '3.4.*' ]; then composer require doctrine/orm doctrine/doctrine-bundle doctrine/mongodb-odm-bundle alcaeus/mongo-php-adapter --ignore-platform-reqs --no-interaction --no-progress; fi;
- if [ "${TRAVIS_PHP_VERSION}" == '7.1' ] && [ "${SYMFONY_VERSION}" == '4.4.*' ]; then composer require doctrine/orm doctrine/doctrine-bundle doctrine/mongodb-odm-bundle alcaeus/mongo-php-adapter --ignore-platform-reqs --no-interaction --no-progress; fi;

script:
- if [ "${TRAVIS_PHP_VERSION}" != '7.1' ] || [ "${SYMFONY_VERSION}" != '3.4.*' ]; then vendor/bin/phpunit -v; fi;
- if [ "${TRAVIS_PHP_VERSION}" == '7.1' ] && [ "${SYMFONY_VERSION}" == '3.4.*' ]; then vendor/bin/phpunit -v --coverage-clover build/logs/clover.xml; fi;
- if [ "${TRAVIS_PHP_VERSION}" == '7.1' ] && [ "${SYMFONY_VERSION}" == '3.4.*' ]; then travis_retry wget -q https://github.com/satooshi/php-coveralls/releases/download/v1.0.1/coveralls.phar && travis_retry php coveralls.phar -v; fi;
- if [ "${TRAVIS_PHP_VERSION}" != '7.1' ] || [ "${SYMFONY_VERSION}" != '4.4.*' ]; then vendor/bin/phpunit -v; fi;
- if [ "${TRAVIS_PHP_VERSION}" == '7.1' ] && [ "${SYMFONY_VERSION}" == '4.4.*' ]; then vendor/bin/phpunit -v --coverage-clover build/logs/clover.xml; fi;
- if [ "${TRAVIS_PHP_VERSION}" == '7.1' ] && [ "${SYMFONY_VERSION}" == '4.4.*' ]; then travis_retry wget -q https://github.com/satooshi/php-coveralls/releases/download/v1.0.1/coveralls.phar && travis_retry php coveralls.phar -v; fi;

notifications:
email:
Expand Down
12 changes: 7 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,18 @@
}
],
"require": {
"php": ">=5.5.9",
"symfony/symfony": "~2.7|~3.0|~4.0",
"php": ">=7.1.3",
"ext-gd": "*",
"ext-exif": "*",
"symfony/symfony": "4.4.*|5.0.*",
"intervention/image": "^2.3",
"twig/twig": "^1.28|^2.0",
"twig/twig": "^2.0",
"sybio/gif-frame-extractor": "^1.0",
"sybio/gif-creator": "^1.0"
},
"require-dev": {
"phpunit/phpunit": "^4.0|^5.0",
"matthiasnoback/symfony-dependency-injection-test": "^1.0"
"phpunit/phpunit": "^7.0",
"matthiasnoback/symfony-dependency-injection-test": "^3.0|^4.0"
},
"autoload": {
"psr-4": {
Expand Down
20 changes: 2 additions & 18 deletions src/Controller/ImageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,38 +11,22 @@

use IngaLabs\Bundle\ImageBundle\Exception\ImageExceptionInterface;
use IngaLabs\Bundle\ImageBundle\ImageManager;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;

/**
* ImageController.
*
* @author Antal Áron <antalaron@antalaron.hu>
*/
class ImageController
{
/**
* @var ImageManager
*/
private $imageManager;

/**
* Constructor.
*
* @param ImageManager $imageManager
*/
public function __construct(ImageManager $imageManager)
{
$this->imageManager = $imageManager;
}

/**
* ShowAction.
*
* The main controller.
*
* @return Response
*/
public function showAction($hash, $size, $aspect)
public function showAction(string $hash, int $size, int $aspect): Response
{
try {
$image = $this->imageManager->getImageByHash($hash);
Expand Down
4 changes: 1 addition & 3 deletions src/DependencyInjection/Compiler/ConfigPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ public function process(ContainerBuilder $container)
} elseif ($container->hasParameter('ingalabs_image.backend_type_mongodb')) {
$doctrine = 'doctrine_mongodb';
} else {
throw new \RuntimeException(
'Either parameter "ingalabs_image.backend_type_orm" or '.
'"ingalabs_image.backend_type_mongodb" should be set.');
throw new \RuntimeException('Either parameter "ingalabs_image.backend_type_orm" or '.'"ingalabs_image.backend_type_mongodb" should be set.');
}

$config = [];
Expand Down
5 changes: 0 additions & 5 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,10 @@
use Symfony\Component\Config\Definition\ConfigurationInterface;

/**
* Configuration.
*
* @author Antal Áron <antalaron@antalaron.hu>
*/
class Configuration implements ConfigurationInterface
{
/**
* {@inheritdoc}
*/
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
Expand Down
8 changes: 0 additions & 8 deletions src/DependencyInjection/IngaLabsImageExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,10 @@
use Symfony\Component\HttpKernel\DependencyInjection\Extension;

/**
* IngaLabsImageExtension.
*
* @author Antal Áron <antalaron@antalaron.hu>
*/
class IngaLabsImageExtension extends Extension
{
/**
* {@inheritdoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();
Expand All @@ -36,9 +31,6 @@ public function load(array $configs, ContainerBuilder $container)
$loader->load('services.yml');
}

/**
* {@inheritdoc}
*/
public function getAlias()
{
return 'ingalabs_image';
Expand Down
2 changes: 0 additions & 2 deletions src/Exception/IOException.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
namespace IngaLabs\Bundle\ImageBundle\Exception;

/**
* IOException.
*
* @author Antal Áron <antalaron@antalaron.hu>
*/
class IOException extends \RuntimeException implements ImageExceptionInterface
Expand Down
2 changes: 0 additions & 2 deletions src/Exception/ImageExceptionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
namespace IngaLabs\Bundle\ImageBundle\Exception;

/**
* ImageExceptionInterface.
*
* @author Antal Áron <antalaron@antalaron.hu>
*/
interface ImageExceptionInterface
Expand Down
2 changes: 0 additions & 2 deletions src/Exception/ImageNotFoundException.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
namespace IngaLabs\Bundle\ImageBundle\Exception;

/**
* ImageNotFoundException.
*
* @author Antal Áron <antalaron@antalaron.hu>
*/
class ImageNotFoundException extends \RuntimeException implements ImageExceptionInterface
Expand Down
2 changes: 0 additions & 2 deletions src/Exception/InvalidArgumentException.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
namespace IngaLabs\Bundle\ImageBundle\Exception;

/**
* InvalidArgumentException.
*
* @author Antal Áron <antalaron@antalaron.hu>
*/
class InvalidArgumentException extends \InvalidArgumentException implements ImageExceptionInterface
Expand Down
2 changes: 0 additions & 2 deletions src/Exception/LoaderException.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
namespace IngaLabs\Bundle\ImageBundle\Exception;

/**
* LoaderException.
*
* @author Antal Áron <antalaron@antalaron.hu>
*/
class LoaderException extends \RuntimeException implements ImageExceptionInterface
Expand Down
40 changes: 5 additions & 35 deletions src/Helper/GifImage.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,67 +10,37 @@
namespace IngaLabs\Bundle\ImageBundle\Helper;

/**
* GifImage.
*
* @author Antal Áron <antalaron@antalaron.hu>
*/
class GifImage
{
const MIME_TYPE = 'image/gif';

/**
* @var string
*/
private $content;

/**
* Constructor.
*
* @param string $content
*/
public function __construct($content = '')
public function __construct(string $content = '')
{
$this->content = $content;
}

/**
* Set content.
*
* @param string $content
*/
public function setContent($content)
public function setContent(string $content): self
{
$this->content = $content;

return $this;
}

/**
* Get content.
*
* @return string
*/
public function getContent()
public function getContent(): string
{
return $this->content;
}

/**
* Get mime.
*
* @return string
*/
public function mime()
public function mime(): string
{
return static::MIME_TYPE;
}

/**
* String conversion.
*
* @return string
*/
public function __toString()
public function __toString(): string
{
return $this->getContent();
}
Expand Down
Loading

0 comments on commit 2405094

Please sign in to comment.