Skip to content

Commit

Permalink
Code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
GwendolenLynch committed Nov 12, 2016
1 parent 537b724 commit 9e55c0a
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 10 deletions.
7 changes: 6 additions & 1 deletion src/Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,10 @@ final class Action
const BORDER = 'border';
const FIT = 'fit';

private function __construct() { }
/**
* Singleton constructor.
*/
private function __construct()
{
}
}
1 change: 1 addition & 0 deletions src/Creator.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ protected function verifyInfo(Transaction $transaction)
{
try {
$transaction->getSrcImage()->getInfo();

return;
} catch (IOException $e) {
}
Expand Down
2 changes: 1 addition & 1 deletion src/Finder.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Finder implements FinderInterface
* Finder constructor.
*
* @param AggregateFilesystemInterface $filesystem
* @param string[] $filesystemsToCheck
* @param string[] $filesystemsToCheck
* @param Image $defaultImage
*/
public function __construct(
Expand Down
5 changes: 4 additions & 1 deletion src/ImageResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ public static function createFromString($data)
{
$info = Image\Info::createFromString($data);
$resource = imagecreatefromstring($data);

return new static($resource, null, $info);
}

Expand Down Expand Up @@ -164,6 +165,7 @@ public function getInfo()
if (!$this->info) {
$this->info = Image\Info::createFromString($this);
}

return $this->info;
}

Expand Down Expand Up @@ -374,7 +376,7 @@ public function rotate($angle)
*/
public function toFile($file)
{
switch($this->type->getId()) {
switch ($this->type->getId()) {
case IMAGETYPE_BMP:
imagewbmp($this->resource, $file);
break;
Expand Down Expand Up @@ -516,6 +518,7 @@ protected static function convertJpegQualityToPngCompression($quality)
{
$quality = (100 - $quality) / 10;
$quality = min(ceil($quality), 9);

return $quality;
}

Expand Down
1 change: 1 addition & 0 deletions src/Transaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public function __construct($file, $action = Action::CROP, Dimensions $dimension
public function getHash()
{
$path = str_replace('/', '_', $this->getFilePath());

return join('-', [$path, $this->action, $this->target->getWidth(), $this->target->getHeight()]);
}

Expand Down
4 changes: 1 addition & 3 deletions tests/ControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

use Bolt\Filesystem\Handler\Image;
use Bolt\Filesystem\Handler\Image\Dimensions;
use Bolt\Thumbs\Thumbnail;
use Bolt\Thumbs\Controller;
use Bolt\Thumbs\Thumbnail;
use Bolt\Thumbs\Transaction;
use Silex\Application;
use Silex\Provider\ServiceControllerServiceProvider;
Expand Down Expand Up @@ -63,7 +63,6 @@ public function testNotIsRestrictedWhenLoggedIn()
$controller = new Controller();
$request = Request::create('/thumbs/123x456c/herp/derp.png');


$session = $this->getMock('Symfony\Component\HttpFoundation\Session\Session');
$user = $this->getMock('stdClass', ['getEnabled']);
$user->expects($this->any())
Expand All @@ -79,7 +78,6 @@ public function testNotIsRestrictedWhenLoggedIn()
->willReturn($auth);
$request->setSession($session);


$app['thumbnails.only_aliases'] = true;
$this->assertInstanceOf('Symfony\Component\HttpFoundation\Response', $controller->thumbnail($app, $request, 'herp/derp.png', 'c', 123, 456));
}
Expand Down
2 changes: 1 addition & 1 deletion tests/CreatorTest.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php
namespace Bolt\Thumbs\Tests;

use Bolt\Filesystem\Adapter\Local;
use Bolt\Filesystem\Filesystem;
use Bolt\Filesystem\Handler\Image;
use Bolt\Filesystem\Adapter\Local;
use Bolt\Filesystem\Handler\Image\Dimensions;
use Bolt\Thumbs\Action;
use Bolt\Thumbs\Creator;
Expand Down
6 changes: 3 additions & 3 deletions tests/ImageResourceTests.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Bolt\Thumbs\Tests;

use Bolt\Filesystem\Filesystem;
use Bolt\Filesystem\Adapter\Local;
use Bolt\Filesystem\Filesystem;
use Bolt\Filesystem\Handler\Image\Dimensions;
use Bolt\Thumbs\ImageResource;
use Bolt\Thumbs\Point;
Expand All @@ -20,7 +20,7 @@ public function setup()

public function testExifOrientation()
{
$images = array(
$images = [
'1-top-left',
'2-top-right',
'3-bottom-right',
Expand All @@ -29,7 +29,7 @@ public function testExifOrientation()
'6-right-top',
'7-right-bottom',
'8-left-bottom',
);
];
$expected = new Dimensions(400, 200);

foreach ($images as $name) {
Expand Down
1 change: 1 addition & 0 deletions tests/ResponderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ class CreatorTester implements CreatorInterface
public function create(Transaction $transaction)
{
$this->transaction = $transaction;

return $transaction->getHash();
}
}
Expand Down

0 comments on commit 9e55c0a

Please sign in to comment.