Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 47 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| FormServiceProvider | |
0.00% |
0 / 47 |
|
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
| __invoke | |
0.00% |
0 / 47 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License |
| 6 | * as published by the Free Software Foundation; under version 2 |
| 7 | * of the License (non-upgradable). |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 17 | * |
| 18 | * Copyright (c) 2021 (original work) Open Assessment Technologies SA; |
| 19 | */ |
| 20 | |
| 21 | declare(strict_types=1); |
| 22 | |
| 23 | namespace oat\tao\helpers\form\ServiceProvider; |
| 24 | |
| 25 | use tao_helpers_form_validators_Regex; |
| 26 | use oat\tao\helpers\form\Feeder\SanitizerValidationFeeder; |
| 27 | use oat\tao\helpers\form\Factory\ElementPropertyEmptyListValuesFactory; |
| 28 | use oat\tao\helpers\form\Factory\ElementPropertyListValuesFactory; |
| 29 | use oat\tao\helpers\form\Factory\ElementPropertyTypeFactory; |
| 30 | use oat\tao\helpers\form\Specification\DependencyPropertyWidgetSpecification; |
| 31 | use oat\tao\model\featureFlag\FeatureFlagChecker; |
| 32 | use oat\generis\model\DependencyInjection\ContainerServiceProviderInterface; |
| 33 | use oat\tao\model\Lists\Business\Specification\PrimaryPropertySpecification; |
| 34 | use oat\tao\model\Lists\Business\Specification\RemoteListClassSpecification; |
| 35 | use oat\tao\model\Lists\Business\Specification\SecondaryPropertySpecification; |
| 36 | use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; |
| 37 | |
| 38 | use function Symfony\Component\DependencyInjection\Loader\Configurator\service; |
| 39 | |
| 40 | class FormServiceProvider implements ContainerServiceProviderInterface |
| 41 | { |
| 42 | public function __invoke(ContainerConfigurator $configurator): void |
| 43 | { |
| 44 | $services = $configurator->services(); |
| 45 | |
| 46 | $services |
| 47 | ->set(ElementPropertyTypeFactory::class, ElementPropertyTypeFactory::class) |
| 48 | ->public() |
| 49 | ->args( |
| 50 | [ |
| 51 | service(PrimaryPropertySpecification::class), |
| 52 | service(SecondaryPropertySpecification::class), |
| 53 | service(DependencyPropertyWidgetSpecification::class), |
| 54 | service(FeatureFlagChecker::class), |
| 55 | ] |
| 56 | ); |
| 57 | |
| 58 | $services |
| 59 | ->set(ElementPropertyEmptyListValuesFactory::class, ElementPropertyEmptyListValuesFactory::class) |
| 60 | ->public() |
| 61 | ->args( |
| 62 | [ |
| 63 | service(PrimaryPropertySpecification::class), |
| 64 | service(SecondaryPropertySpecification::class), |
| 65 | service(FeatureFlagChecker::class), |
| 66 | ] |
| 67 | ); |
| 68 | |
| 69 | $services |
| 70 | ->set(ElementPropertyListValuesFactory::class, ElementPropertyListValuesFactory::class) |
| 71 | ->public() |
| 72 | ->args( |
| 73 | [ |
| 74 | service(RemoteListClassSpecification::class) |
| 75 | ] |
| 76 | ); |
| 77 | |
| 78 | $services->set(DependencyPropertyWidgetSpecification::class, DependencyPropertyWidgetSpecification::class); |
| 79 | |
| 80 | $services |
| 81 | ->set(tao_helpers_form_validators_Regex::USER_FORM_SERVICE_ID, tao_helpers_form_validators_Regex::class) |
| 82 | ->public() |
| 83 | ->args( |
| 84 | [ |
| 85 | [ |
| 86 | 'isPreValidationRequired' => true, |
| 87 | 'format' => '/^[^<>\\\\\/;]+$/', |
| 88 | 'message' => 'This field must not include the following characters: < > \ / ;', |
| 89 | ] |
| 90 | ] |
| 91 | ); |
| 92 | |
| 93 | $services |
| 94 | ->set(SanitizerValidationFeeder::class, SanitizerValidationFeeder::class) |
| 95 | ->public() |
| 96 | ->share(false); |
| 97 | } |
| 98 | } |