Skip to content

Commit

Permalink
Coding style
Browse files Browse the repository at this point in the history
  • Loading branch information
mlazze committed Feb 25, 2021
1 parent b20861e commit 0dd257b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
9 changes: 6 additions & 3 deletions src/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ class Server
protected $presets = [];
/**
* Custom cache path callable.
*
* @var callable|null
*/
protected $cachePathCallable;
Expand Down Expand Up @@ -325,7 +326,8 @@ public function getCacheWithFileExtensions()
}

/**
* Set a custom cachePathCallable
* Set a custom cachePathCallable.
*
* @param callable|null $cachePathCallable The custom cache path callable. It receives the same arguments as @see getCachePath
*/
public function setCachePathCallable($cachePathCallable)
Expand All @@ -334,7 +336,8 @@ public function setCachePathCallable($cachePathCallable)
}

/**
* Gets the custom cachePathCallable
* Gets the custom cachePathCallable.
*
* @return callable|null The custom cache path callable. It receives the same arguments as @see getCachePath
*/
public function getCachePathCallable()
Expand All @@ -355,6 +358,7 @@ public function getCachePath($path, array $params = [])
$customCallable = $this->getCachePathCallable();
if (is_callable($customCallable)) {
$boundCallable = \Closure::bind($customCallable, $this, self::class);

return $boundCallable(...func_get_args());
}
$sourcePath = $this->getSourcePath($path);
Expand Down Expand Up @@ -650,4 +654,3 @@ public function makeImage($path, array $params)
return $cachedPath;
}
}

1 change: 1 addition & 0 deletions src/ServerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ public function getTempDir()

/**
* Get cache path callable.
*
* @return callable|null Cache path callable.
*/
public function getCachePathCallable()
Expand Down
8 changes: 4 additions & 4 deletions tests/ServerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public function testSetInvalidTempDir()
public function testSetGetTempDir()
{
$this->server->setTempDir(__DIR__);
$this->assertSame(__DIR__ . DIRECTORY_SEPARATOR, $this->server->getTempDir());
$this->assertSame(__DIR__.DIRECTORY_SEPARATOR, $this->server->getTempDir());
}

public function testSetCachePathCallable()
Expand Down Expand Up @@ -179,7 +179,7 @@ public function testCachePathCallableIsCalledOnGetCachePath()

public function testSetCachePathCallableIsBoundClosure()
{
$server = $this->server;
$server = $this->server;
$phpUnit = $this;
$this->server->setCachePathCallable(function () use ($phpUnit, $server) {
$phpUnit::assertEquals($server, $this);
Expand All @@ -190,8 +190,8 @@ public function testSetCachePathCallableIsBoundClosure()

public function testSetCachePathCallableArgumentsAreSameAsGetCachePath()
{
$phpUnit = $this;
$pathArgument = 'TEST';
$phpUnit = $this;
$pathArgument = 'TEST';
$optionsArgument = [
'TEST' => 'TEST',
];
Expand Down

0 comments on commit 0dd257b

Please sign in to comment.