Mercurial > hg > isophonics-drupal-site
comparison vendor/symfony/validator/Context/ExecutionContextFactory.php @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +0000 |
parents | |
children | 1fec387a4317 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4c8ae668cc8c |
---|---|
1 <?php | |
2 | |
3 /* | |
4 * This file is part of the Symfony package. | |
5 * | |
6 * (c) Fabien Potencier <fabien@symfony.com> | |
7 * | |
8 * For the full copyright and license information, please view the LICENSE | |
9 * file that was distributed with this source code. | |
10 */ | |
11 | |
12 namespace Symfony\Component\Validator\Context; | |
13 | |
14 use Symfony\Component\Translation\TranslatorInterface; | |
15 use Symfony\Component\Validator\Validator\ValidatorInterface; | |
16 | |
17 /** | |
18 * Creates new {@link ExecutionContext} instances. | |
19 * | |
20 * @author Bernhard Schussek <bschussek@gmail.com> | |
21 * | |
22 * @internal You should not instantiate or use this class. Code against | |
23 * {@link ExecutionContextFactoryInterface} instead. | |
24 */ | |
25 class ExecutionContextFactory implements ExecutionContextFactoryInterface | |
26 { | |
27 /** | |
28 * @var TranslatorInterface | |
29 */ | |
30 private $translator; | |
31 | |
32 /** | |
33 * @var string|null | |
34 */ | |
35 private $translationDomain; | |
36 | |
37 /** | |
38 * Creates a new context factory. | |
39 * | |
40 * @param TranslatorInterface $translator The translator | |
41 * @param string|null $translationDomain The translation domain to | |
42 * use for translating | |
43 * violation messages | |
44 */ | |
45 public function __construct(TranslatorInterface $translator, $translationDomain = null) | |
46 { | |
47 $this->translator = $translator; | |
48 $this->translationDomain = $translationDomain; | |
49 } | |
50 | |
51 /** | |
52 * {@inheritdoc} | |
53 */ | |
54 public function createContext(ValidatorInterface $validator, $root) | |
55 { | |
56 return new ExecutionContext( | |
57 $validator, | |
58 $root, | |
59 $this->translator, | |
60 $this->translationDomain | |
61 ); | |
62 } | |
63 } |