Completed
Push — migrate_http_cache_configurati... ( ab3b04 )
by
unknown
13:18
created

EzPublishCoreExtension::isConfigParserDisabled()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 5
nc 3
nop 1
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * File containing the EzPublishCoreExtension class.
5
 *
6
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
7
 * @license For full copyright and license information view LICENSE file distributed with this source code.
8
 */
9
namespace eZ\Bundle\EzPublishCoreBundle\DependencyInjection;
10
11
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\ConfigParser;
12
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\SiteAccessAware\ConfigurationProcessor;
13
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\Suggestion\Collector\SuggestionCollector;
14
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\Suggestion\Collector\SuggestionCollectorAwareInterface;
15
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\Suggestion\Formatter\YamlSuggestionFormatter;
16
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Security\PolicyProvider\PoliciesConfigBuilder;
17
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Security\PolicyProvider\PolicyProviderInterface;
18
use eZ\Bundle\EzPublishCoreBundle\SiteAccess\SiteAccessConfigurationFilter;
19
use Symfony\Component\Config\Resource\FileResource;
20
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
21
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
22
use Symfony\Component\DependencyInjection\ContainerBuilder;
23
use Symfony\Component\DependencyInjection\Loader;
24
use Symfony\Component\DependencyInjection\Loader\FileLoader;
25
use Symfony\Component\Config\FileLocator;
26
use InvalidArgumentException;
27
use Symfony\Component\Yaml\Yaml;
28
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\ParserInterface;
29
30
class EzPublishCoreExtension extends Extension implements PrependExtensionInterface
31
{
32
    /**
33
     * @var \eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\Suggestion\Collector\SuggestionCollector
34
     */
35
    private $suggestionCollector;
36
37
    /**
38
     * @var \eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\ParserInterface
39
     */
40
    private $mainConfigParser;
41
42
    /**
43
     * @var \eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\ParserInterface[]
44
     */
45
    private $configParsers;
46
47
    /**
48
     * @var PolicyProviderInterface[]
49
     */
50
    private $policyProviders = [];
51
52
    /**
53
     * Holds a collection of YAML files, as an array with directory path as a
54
     * key to the array of contained file names.
55
     *
56
     * @var array
57
     */
58
    private $defaultSettingsCollection = [];
59
60
    /**
61
     * @var \eZ\Bundle\EzPublishCoreBundle\SiteAccess\SiteAccessConfigurationFilter[]
62
     */
63
    private $siteaccessConfigurationFilters = [];
64
65
    /**
66
     * List of disabled ConfigParser classes.
67
     * Meant to be used by external packages to turn off parts of the system that have been splitted out
68
     * or deprecated.
69
     * @var array
70
     */
71
    private $disabledConfigParsers = [];
72
73
    public function __construct(array $configParsers = array())
74
    {
75
        $this->configParsers = $configParsers;
76
        $this->suggestionCollector = new SuggestionCollector();
77
    }
78
79
    public function getAlias()
80
    {
81
        return 'ezpublish';
82
    }
83
84
    /**
85
     * Loads a specific configuration.
86
     *
87
     * @param mixed[] $configs An array of configuration values
88
     * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container A ContainerBuilder instance
89
     *
90
     * @throws \InvalidArgumentException When provided tag is not defined in this extension
91
     *
92
     * @api
93
     */
94
    public function load(array $configs, ContainerBuilder $container)
95
    {
96
        $loader = new Loader\YamlFileLoader(
97
            $container,
98
            new FileLocator(__DIR__ . '/../Resources/config')
99
        );
100
101
        $configuration = $this->getConfiguration($configs, $container);
102
103
        // Note: this is where the transformation occurs
104
        $config = $this->processConfiguration($configuration, $configs);
105
106
        // Base services and services overrides
107
        $loader->load('services.yml');
108
        // Security services
109
        $loader->load('security.yml');
110
        // Slots
111
        $loader->load('slot.yml');
112
113
        // Default settings
114
        $this->handleDefaultSettingsLoading($container, $loader);
115
116
        $this->registerRepositoriesConfiguration($config, $container);
117
        $this->registerSiteAccessConfiguration($config, $container);
118
        $this->registerImageMagickConfiguration($config, $container);
119
        $this->registerPageConfiguration($config, $container);
120
121
        // Routing
122
        $this->handleRouting($config, $container, $loader);
123
        // Public API loading
124
        $this->handleApiLoading($container, $loader);
125
        $this->handleTemplating($container, $loader);
126
        $this->handleSessionLoading($container, $loader);
127
        $this->handleCache($config, $container, $loader);
128
        $this->handleLocale($config, $container, $loader);
129
        $this->handleHelpers($config, $container, $loader);
130
        $this->handleImage($config, $container, $loader);
131
132
        // Map settings
133
        $processor = new ConfigurationProcessor($container, 'ezsettings');
134
        $processor->mapConfig($config, $this->getMainConfigParser());
135
136
        if ($this->suggestionCollector->hasSuggestions()) {
137
            $message = '';
138
            $suggestionFormatter = new YamlSuggestionFormatter();
139
            foreach ($this->suggestionCollector->getSuggestions() as $suggestion) {
140
                $message .= $suggestionFormatter->format($suggestion) . "\n\n";
141
            }
142
143
            throw new InvalidArgumentException($message);
144
        }
145
146
        $this->handleSiteAccessesRelation($container);
147
        $this->buildPolicyMap($container);
148
    }
149
150
    /**
151
     * @param array $config
152
     * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
153
     *
154
     * @return \eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration
155
     */
156
    public function getConfiguration(array $config, ContainerBuilder $container)
157
    {
158
        $configuration = new Configuration($this->getMainConfigParser(), $this->suggestionCollector);
159
        $configuration->setSiteAccessConfigurationFilters($this->siteaccessConfigurationFilters);
160
161
        return $configuration;
162
    }
163
164
    /**
165
     * @return \eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\ParserInterface
166
     */
167
    private function getMainConfigParser()
168
    {
169
        if ($this->mainConfigParser === null) {
170
            $parsers = [];
171
            foreach ($this->configParsers as $parser) {
172
                if ($this->isConfigParserDisabled($parser)) {
173
                    continue;
174
                }
175
                if ($parser instanceof SuggestionCollectorAwareInterface) {
176
                    $parser->setSuggestionCollector($this->suggestionCollector);
177
                }
178
                $parsers[] = $parser;
179
            }
180
181
            $this->mainConfigParser = new ConfigParser($parsers);
182
        }
183
184
        return $this->mainConfigParser;
185
    }
186
187
    /**
188
     * Handle default settings.
189
     *
190
     * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
191
     * @param \Symfony\Component\DependencyInjection\Loader\FileLoader $loader
192
     */
193
    private function handleDefaultSettingsLoading(ContainerBuilder $container, FileLoader $loader)
194
    {
195
        $loader->load('default_settings.yml');
196
197
        foreach ($this->defaultSettingsCollection as $fileLocation => $files) {
198
            $externalLoader = new Loader\YamlFileLoader($container, new FileLocator($fileLocation));
199
            foreach ($files as $file) {
200
                $externalLoader->load($file);
201
            }
202
        }
203
    }
204
205
    private function registerRepositoriesConfiguration(array $config, ContainerBuilder $container)
206
    {
207
        if (!isset($config['repositories'])) {
208
            $config['repositories'] = array();
209
        }
210
211
        foreach ($config['repositories'] as $name => &$repository) {
212
            if (empty($repository['fields_groups']['list'])) {
213
                $repository['fields_groups']['list'] = $container->getParameter('ezsettings.default.content.field_groups.list');
214
            }
215
        }
216
217
        $container->setParameter('ezpublish.repositories', $config['repositories']);
218
    }
219
220
    private function registerSiteAccessConfiguration(array $config, ContainerBuilder $container)
221
    {
222
        if (!isset($config['siteaccess'])) {
223
            $config['siteaccess'] = array();
224
            $config['siteaccess']['list'] = array('setup');
225
            $config['siteaccess']['default_siteaccess'] = 'setup';
226
            $config['siteaccess']['groups'] = array();
227
            $config['siteaccess']['match'] = null;
228
        }
229
230
        $container->setParameter('ezpublish.siteaccess.list', $config['siteaccess']['list']);
231
        ConfigurationProcessor::setAvailableSiteAccesses($config['siteaccess']['list']);
232
        $container->setParameter('ezpublish.siteaccess.default', $config['siteaccess']['default_siteaccess']);
233
        $container->setParameter('ezpublish.siteaccess.match_config', $config['siteaccess']['match']);
234
235
        // Register siteaccess groups + reverse
236
        $container->setParameter('ezpublish.siteaccess.groups', $config['siteaccess']['groups']);
237
        $groupsBySiteaccess = array();
238 View Code Duplication
        foreach ($config['siteaccess']['groups'] as $groupName => $groupMembers) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
239
            foreach ($groupMembers as $member) {
240
                if (!isset($groupsBySiteaccess[$member])) {
241
                    $groupsBySiteaccess[$member] = array();
242
                }
243
244
                $groupsBySiteaccess[$member][] = $groupName;
245
            }
246
        }
247
        $container->setParameter('ezpublish.siteaccess.groups_by_siteaccess', $groupsBySiteaccess);
248
        ConfigurationProcessor::setGroupsBySiteAccess($groupsBySiteaccess);
249
    }
250
251
    private function registerImageMagickConfiguration(array $config, ContainerBuilder $container)
252
    {
253
        if (isset($config['imagemagick'])) {
254
            $container->setParameter('ezpublish.image.imagemagick.enabled', $config['imagemagick']['enabled']);
255
            if ($config['imagemagick']['enabled']) {
256
                $container->setParameter('ezpublish.image.imagemagick.executable_path', dirname($config['imagemagick']['path']));
257
                $container->setParameter('ezpublish.image.imagemagick.executable', basename($config['imagemagick']['path']));
258
            }
259
        }
260
261
        $filters = isset($config['imagemagick']['filters']) ? $config['imagemagick']['filters'] : array();
262
        $filters = $filters + $container->getParameter('ezpublish.image.imagemagick.filters');
263
        $container->setParameter('ezpublish.image.imagemagick.filters', $filters);
264
    }
265
266
    private function registerPageConfiguration(array $config, ContainerBuilder $container)
267
    {
268
        if (isset($config['ezpage']['layouts'])) {
269
            $container->setParameter(
270
                'ezpublish.ezpage.layouts',
271
                $config['ezpage']['layouts'] + $container->getParameter('ezpublish.ezpage.layouts')
272
            );
273
        }
274
        if (isset($config['ezpage']['blocks'])) {
275
            $container->setParameter(
276
                'ezpublish.ezpage.blocks',
277
                $config['ezpage']['blocks'] + $container->getParameter('ezpublish.ezpage.blocks')
278
            );
279
        }
280
        if (isset($config['ezpage']['enabledLayouts'])) {
281
            $container->setParameter(
282
                'ezpublish.ezpage.enabledLayouts',
283
                $config['ezpage']['enabledLayouts'] + $container->getParameter('ezpublish.ezpage.enabledLayouts')
284
            );
285
        }
286
        if (isset($config['ezpage']['enabledBlocks'])) {
287
            $container->setParameter(
288
                'ezpublish.ezpage.enabledBlocks',
289
                $config['ezpage']['enabledBlocks'] + $container->getParameter('ezpublish.ezpage.enabledBlocks')
290
            );
291
        }
292
    }
293
294
    /**
295
     * Handle routing parameters.
296
     *
297
     * @param array $config
298
     * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
299
     * @param \Symfony\Component\DependencyInjection\Loader\FileLoader $loader
300
     */
301
    private function handleRouting(array $config, ContainerBuilder $container, FileLoader $loader)
302
    {
303
        $loader->load('routing.yml');
304
        $container->setAlias('router', 'ezpublish.chain_router');
305
306
        if (isset($config['router']['default_router']['non_siteaccess_aware_routes'])) {
307
            $container->setParameter(
308
                'ezpublish.default_router.non_siteaccess_aware_routes',
309
                array_merge(
310
                    $container->getParameter('ezpublish.default_router.non_siteaccess_aware_routes'),
311
                    $config['router']['default_router']['non_siteaccess_aware_routes']
312
                )
313
            );
314
        }
315
    }
316
317
    /**
318
     * Handle public API loading.
319
     *
320
     * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
321
     * @param \Symfony\Component\DependencyInjection\Loader\FileLoader $loader
322
     */
323
    private function handleApiLoading(ContainerBuilder $container, FileLoader $loader)
324
    {
325
        // Loading configuration from Core/settings
326
        $coreLoader = new Loader\YamlFileLoader(
327
            $container,
328
            new FileLocator(__DIR__ . '/../../../Publish/Core/settings')
329
        );
330
        $coreLoader->load('repository.yml');
331
        $coreLoader->load('repository/inner.yml');
332
        $coreLoader->load('repository/signalslot.yml');
333
        $coreLoader->load('fieldtype_external_storages.yml');
334
        $coreLoader->load('fieldtypes.yml');
335
        $coreLoader->load('indexable_fieldtypes.yml');
336
        $coreLoader->load('roles.yml');
337
        $coreLoader->load('storage_engines/common.yml');
338
        $coreLoader->load('storage_engines/cache.yml');
339
        $coreLoader->load('storage_engines/legacy.yml');
340
        $coreLoader->load('storage_engines/shortcuts.yml');
341
        $coreLoader->load('search_engines/common.yml');
342
        $coreLoader->load('utils.yml');
343
        $coreLoader->load('io.yml');
344
345
        // Public API services
346
        $loader->load('papi.yml');
347
348
        // Built-in field types
349
        $loader->load('fieldtype_services.yml');
350
351
        // Storage engine
352
        $loader->load('storage_engines.yml');
353
    }
354
355
    /**
356
     * Handle templating parameters.
357
     *
358
     * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
359
     * @param \Symfony\Component\DependencyInjection\Loader\FileLoader $loader
360
     */
361
    private function handleTemplating(ContainerBuilder $container, FileLoader $loader)
0 ignored issues
show
Unused Code introduced by
The parameter $container is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
362
    {
363
        $loader->load('templating.yml');
364
    }
365
366
    /**
367
     * Handle session parameters.
368
     *
369
     * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
370
     * @param \Symfony\Component\DependencyInjection\Loader\FileLoader $loader
371
     */
372
    private function handleSessionLoading(ContainerBuilder $container, FileLoader $loader)
0 ignored issues
show
Unused Code introduced by
The parameter $container is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
373
    {
374
        $loader->load('session.yml');
375
    }
376
377
    /**
378
     * Handle cache parameters.
379
     *
380
     * @param array $config
381
     * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
382
     * @param \Symfony\Component\DependencyInjection\Loader\FileLoader $loader
383
     *
384
     * @throws \InvalidArgumentException
385
     */
386
    private function handleCache(array $config, ContainerBuilder $container, FileLoader $loader)
387
    {
388
        $loader->load('cache.yml');
389
390
        $purgeService = null;
0 ignored issues
show
Unused Code introduced by
$purgeService is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
391
        if (isset($config['http_cache']['purge_type'])) {
392
            $container->setParameter('ezpublish.http_cache.purge_type', $config['http_cache']['purge_type']);
393
        }
394
    }
395
396
    /**
397
     * Handle locale parameters.
398
     *
399
     * @param array $config
400
     * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
401
     * @param \Symfony\Component\DependencyInjection\Loader\FileLoader $loader
402
     */
403
    private function handleLocale(array $config, ContainerBuilder $container, FileLoader $loader)
404
    {
405
        $loader->load('locale.yml');
406
        $container->setParameter(
407
            'ezpublish.locale.conversion_map',
408
            $config['locale_conversion'] + $container->getParameter('ezpublish.locale.conversion_map')
409
        );
410
    }
411
412
    /**
413
     * Handle helpers.
414
     *
415
     * @param array $config
416
     * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
417
     * @param \Symfony\Component\DependencyInjection\Loader\FileLoader $loader
418
     */
419
    private function handleHelpers(array $config, ContainerBuilder $container, FileLoader $loader)
0 ignored issues
show
Unused Code introduced by
The parameter $config is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $container is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
420
    {
421
        $loader->load('helpers.yml');
422
    }
423
424
    /**
425
     * Handles relation between SiteAccesses.
426
     * Related SiteAccesses share the same repository and root location id.
427
     *
428
     * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
429
     */
430
    private function handleSiteAccessesRelation(ContainerBuilder $container)
431
    {
432
        $configResolver = $container->get('ezpublish.config.resolver.core');
433
        $configResolver->setContainer($container);
434
435
        $saRelationMap = array();
436
        $saList = $container->getParameter('ezpublish.siteaccess.list');
437
        // First build the SiteAccess relation map, indexed by repository and rootLocationId.
438
        foreach ($saList as $sa) {
439
            $repository = $configResolver->getParameter('repository', 'ezsettings', $sa);
440
            if (!isset($saRelationMap[$repository])) {
441
                $saRelationMap[$repository] = array();
442
            }
443
444
            $rootLocationId = $configResolver->getParameter('content.tree_root.location_id', 'ezsettings', $sa);
445
            if (!isset($saRelationMap[$repository][$rootLocationId])) {
446
                $saRelationMap[$repository][$rootLocationId] = array();
447
            }
448
            $saRelationMap[$repository][$rootLocationId][] = $sa;
449
        }
450
        $container->setParameter('ezpublish.siteaccess.relation_map', $saRelationMap);
451
452
        // Now build the related SiteAccesses list, based on the relation map.
453
        foreach ($saList as $sa) {
454
            $repository = $configResolver->getParameter('repository', 'ezsettings', $sa);
455
            $rootLocationId = $configResolver->getParameter('content.tree_root.location_id', 'ezsettings', $sa);
456
            $container->setParameter(
457
                "ezsettings.$sa.related_siteaccesses",
458
                $saRelationMap[$repository][$rootLocationId]
459
            );
460
        }
461
    }
462
463
    /**
464
     * @param array $config
465
     * @param ContainerBuilder $container
466
     * @param FileLoader $loader
467
     */
468
    private function handleImage(array $config, ContainerBuilder $container, FileLoader $loader)
0 ignored issues
show
Unused Code introduced by
The parameter $config is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $container is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
469
    {
470
        $loader->load('image.yml');
471
    }
472
473
    private function buildPolicyMap(ContainerBuilder $container)
474
    {
475
        $policiesBuilder = new PoliciesConfigBuilder($container);
476
        foreach ($this->policyProviders as $provider) {
477
            $provider->addPolicies($policiesBuilder);
478
        }
479
    }
480
481
    public function prepend(ContainerBuilder $container)
482
    {
483
        // Default settings for FOSHttpCacheBundle
484
        $configFile = __DIR__ . '/../Resources/config/fos_http_cache.yml';
485
        $config = Yaml::parse(file_get_contents($configFile));
486
        $container->prependExtensionConfig('fos_http_cache', $config);
487
        $container->addResource(new FileResource($configFile));
488
    }
489
490
    /**
491
     * Adds a new policy provider to the internal collection.
492
     * One can call this method from a bundle `build()` method.
493
     *
494
     * ```php
495
     * public function build(ContainerBuilder $container)
496
     * {
497
     *     $ezExtension = $container->getExtension('ezpublish');
498
     *     $ezExtension->addPolicyProvider($myPolicyProvider);
499
     * }
500
     * ```
501
     *
502
     * @since 6.0
503
     *
504
     * @param PolicyProviderInterface $policyProvider
505
     */
506
    public function addPolicyProvider(PolicyProviderInterface $policyProvider)
507
    {
508
        $this->policyProviders[] = $policyProvider;
509
    }
510
511
    /**
512
     * Adds a new config parser to the internal collection.
513
     * One can call this method from a bundle `build()` method.
514
     *
515
     * ```php
516
     * public function build(ContainerBuilder $container)
517
     * {
518
     *     $ezExtension = $container->getExtension('ezpublish');
519
     *     $ezExtension->addConfigParser($myConfigParser);
520
     * }
521
     * ```
522
     *
523
     * @since 6.0
524
     *
525
     * @param \eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\ParserInterface $configParser
526
     */
527
    public function addConfigParser(ParserInterface $configParser)
528
    {
529
        $this->configParsers[] = $configParser;
530
    }
531
532
    /**
533
     * Adds new default settings to the internal collection.
534
     * One can call this method from a bundle `build()` method.
535
     *
536
     * ```php
537
     * public function build(ContainerBuilder $container)
538
     * {
539
     *     $ezExtension = $container->getExtension('ezpublish');
540
     *     $ezExtension->addDefaultSettings(
541
     *         __DIR__ . '/Resources/config',
542
     *         ['default_settings.yml']
543
     *     );
544
     * }
545
     * ```
546
     *
547
     * @since 6.0
548
     *
549
     * @param string $fileLocation
550
     * @param array $files
551
     */
552
    public function addDefaultSettings($fileLocation, array $files)
553
    {
554
        $this->defaultSettingsCollection[$fileLocation] = $files;
555
    }
556
557
    public function addSiteAccessConfigurationFilter(SiteAccessConfigurationFilter $filter)
558
    {
559
        $this->siteaccessConfigurationFilters[] = $filter;
560
    }
561
562
    /**
563
     * Disables a ConfigParser class.
564
     * @param string $class The class the parser must be an instance of to be disabled.
565
     */
566
    public function disableConfigParser($class)
567
    {
568
        $this->disabledConfigParsers[$class] = true;
569
    }
570
571
    /**
572
     * @param object $configParser
573
     * @return bool
574
     */
575
    private function isConfigParserDisabled($configParser)
576
    {
577
        foreach (array_keys($this->disabledConfigParsers) as $disabledConfigParser) {
578
            if ($configParser instanceof $disabledConfigParser) {
579
                return true;
580
            }
581
        }
582
583
        return false;
584
    }
585
}
586