-
Notifications
You must be signed in to change notification settings - Fork 379
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added ability to inject custom drivers #1105
Changes from 3 commits
fb1e4a8
d1274a2
86bdf30
e3d1476
a3dd770
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,7 +60,7 @@ public function locate(string $path): string | |
*/ | ||
protected function generateAbsolutePath(string $root, string $path): ?string | ||
{ | ||
if (false !== $absolute = realpath($root.DIRECTORY_SEPARATOR.$path)) { | ||
if (false !== $absolute = realpath($root.\DIRECTORY_SEPARATOR.$path)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why the backslashes here? |
||
return $absolute; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the `liip/LiipImagineBundle` project. | ||
* | ||
* (c) https://github.com/liip/LiipImagineBundle/graphs/contributors | ||
* | ||
* For the full copyright and license information, please view the LICENSE.md | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Liip\ImagineBundle\DependencyInjection\Compiler; | ||
|
||
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
|
||
/** | ||
* Give a helpful exception message in case the imagine driver does not exist. | ||
* | ||
* Third parties can provide a driver, and thus we can only validate after the container has been built. | ||
*/ | ||
class DriverCompilerPass extends AbstractCompilerPass | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function process(ContainerBuilder $container) | ||
{ | ||
$liipImagineDriver = $container->getParameter('liip_imagine.driver_service'); | ||
|
||
if (!$container->hasDefinition($liipImagineDriver)) { | ||
throw new InvalidConfigurationException(sprintf( | ||
"Specified driver '%s' is not defined.", $liipImagineDriver | ||
)); | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -127,7 +127,7 @@ private function getBundleResourcePaths(ContainerBuilder $container) | |
} | ||
|
||
return array_map(function ($path) { | ||
return $path.DIRECTORY_SEPARATOR.'Resources'.DIRECTORY_SEPARATOR.'public'; | ||
return $path.\DIRECTORY_SEPARATOR.'Resources'.\DIRECTORY_SEPARATOR.'public'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why the backslashes here? |
||
}, $paths); | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,8 +50,8 @@ abstract class AbstractTest extends TestCase | |
|
||
protected function setUp() | ||
{ | ||
$this->fixturesPath = realpath(__DIR__.DIRECTORY_SEPARATOR.'Fixtures'); | ||
$this->temporaryPath = sys_get_temp_dir().DIRECTORY_SEPARATOR.'liip_imagine_test'; | ||
$this->fixturesPath = realpath(__DIR__.\DIRECTORY_SEPARATOR.'Fixtures'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why the backslashes here? |
||
$this->temporaryPath = sys_get_temp_dir().\DIRECTORY_SEPARATOR.'liip_imagine_test'; | ||
$this->filesystem = new Filesystem(); | ||
|
||
if ($this->filesystem->exists($this->temporaryPath)) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why the backslashes here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is global constant and php-cs doesn't like it without backslash
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm maybe better to disable the php-cs rule? I have never added blackslashes to such global constants and don't really see the point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was fixed in 1107.
will remove backslashes.