-
-
Notifications
You must be signed in to change notification settings - Fork 729
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
29 changed files
with
761 additions
and
423 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/Bundle/DependencyInjection/Compiler/WriterRegistryCompilerPass.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
/* | ||
* (c) Jeroen van den Enden <info@endroid.nl> | ||
* | ||
* This source file is subject to the MIT license that is bundled | ||
* with this source code in the file LICENSE. | ||
*/ | ||
|
||
namespace Endroid\QrCode\Bundle\DependencyInjection\Compiler; | ||
|
||
use Endroid\QrCode\ErrorCorrectionLevel; | ||
use Endroid\QrCode\LabelAlignment; | ||
use Endroid\QrCode\QrCode; | ||
use Predis\Response\Error; | ||
use Symfony\Component\Config\Definition\Builder\TreeBuilder; | ||
use Symfony\Component\Config\Definition\ConfigurationInterface; | ||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\DependencyInjection\Reference; | ||
|
||
class WriterRegistryCompilerPass implements CompilerPassInterface | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function process(ContainerBuilder $container) | ||
{ | ||
if (!$container->has('endroid.qrcode.writer_registry')) { | ||
return; | ||
} | ||
|
||
$writerRegistryDefinition = $container->findDefinition('endroid.qrcode.writer_registry'); | ||
|
||
$taggedServices = $container->findTaggedServiceIds('endroid.qrcode.writer'); | ||
foreach ($taggedServices as $id => $tags) { | ||
foreach ($tags as $attributes) { | ||
$writerRegistryDefinition->addMethodCall('addWriter', [new Reference($id), isset($attributes['set_as_default']) && $attributes['set_as_default']]); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,31 @@ | ||
services: | ||
endroid.qrcode.factory: | ||
class: Endroid\QrCode\Factory\QrCodeFactory | ||
|
||
arguments: [ null, '@endroid.qrcode.writer_registry' ] | ||
endroid.qrcode.twig.extension: | ||
class: Endroid\QrCode\Twig\Extension\QrCodeExtension | ||
arguments: [ '@endroid.qrcode.factory', '@router'] | ||
tags: | ||
- { name: twig.extension } | ||
endroid.qrcode.writer_registry: | ||
class: Endroid\QrCode\WriterRegistry | ||
endroid.qrcode.writer.binary_writer: | ||
class: Endroid\QrCode\Writer\BinaryWriter | ||
tags: | ||
- { name: endroid.qrcode.writer } | ||
endroid.qrcode.writer.debug_writer: | ||
class: Endroid\QrCode\Writer\DebugWriter | ||
tags: | ||
- { name: endroid.qrcode.writer } | ||
endroid.qrcode.writer.eps_writer: | ||
class: Endroid\QrCode\Writer\EpsWriter | ||
tags: | ||
- { name: endroid.qrcode.writer } | ||
endroid.qrcode.writer.png_writer: | ||
class: Endroid\QrCode\Writer\PngWriter | ||
tags: | ||
- { name: endroid.qrcode.writer, set_as_default: true } | ||
endroid.qrcode.writer.svg_writer: | ||
class: Endroid\QrCode\Writer\SvgWriter | ||
tags: | ||
- { name: endroid.qrcode.writer } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<img src="{{ qrcode_path(message) }}" /> | ||
<img src="{{ qrcode_url(message, { writer: 'svg' }) }}" /> | ||
<img src="{{ qrcode_data_uri(message, { writer: 'svg', size: 150 }) }}" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.