‪TYPO3CMS  10.4
XmlParserFactory.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
19 
25 {
32  protected static ‪$instance = [];
33 
42  protected static ‪$parsers = [
43  'extension' => [
44  ExtensionXmlPushParser::class => 'ExtensionXmlPushParser.php',
45  ExtensionXmlPullParser::class => 'ExtensionXmlPullParser.php',
46  ],
47  'mirror' => [
48  MirrorXmlPushParser::class => 'MirrorXmlPushParser.php',
49  MirrorXmlPullParser::class=> 'MirrorXmlPullParser.php',
50  ]
51  ];
52 
63  public static function ‪getParserInstance($parserType, $excludeClassNames = '')
64  {
65  if (!isset(self::$instance[$parserType]) || !is_object(self::$instance[$parserType]) || !empty($excludeClassNames)) {
66  // reset instance
67  self::$instance[$parserType] = ($objParser = null);
68  foreach (self::$parsers[$parserType] as $className => $file) {
69  if (!GeneralUtility::inList($excludeClassNames, $className)) {
70  $objParser = GeneralUtility::makeInstance($className);
71  if ($objParser->isAvailable()) {
72  self::$instance[$parserType] = &$objParser;
73  break;
74  }
75  $objParser = null;
76  }
77  }
78  }
79  return self::$instance[$parserType];
80  }
81 }
‪TYPO3\CMS\Extensionmanager\Utility\Parser
Definition: AbstractExtensionXmlParser.php:16
‪TYPO3\CMS\Extensionmanager\Utility\Parser\XmlParserFactory\$instance
‪static array $instance
Definition: XmlParserFactory.php:31
‪TYPO3\CMS\Extensionmanager\Utility\Parser\AbstractExtensionXmlParser
Definition: AbstractExtensionXmlParser.php:23
‪TYPO3\CMS\Extensionmanager\Utility\Parser\XmlParserFactory
Definition: XmlParserFactory.php:25
‪TYPO3\CMS\Extensionmanager\Utility\Parser\XmlParserFactory\getParserInstance
‪static AbstractExtensionXmlParser getParserInstance($parserType, $excludeClassNames='')
Definition: XmlParserFactory.php:61
‪TYPO3\CMS\Extensionmanager\Utility\Parser\XmlParserFactory\$parsers
‪static array $parsers
Definition: XmlParserFactory.php:40
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:46