‪TYPO3CMS  9.5
AbstractXmlParser.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
21 abstract class ‪AbstractXmlParser implements \SplSubject
22 {
28  protected ‪$objXml;
29 
36  protected ‪$requiredPhpExtensions;
37 
43  protected ‪$observers = [];
44 
51  public function ‪attach(\SplObserver $observer)
52  {
53  $this->observers[] = $observer;
54  }
55 
62  public function ‪detach(\SplObserver $observer)
63  {
64  $key = array_search($observer, $this->observers, true);
65  if ($key !== false) {
66  unset($this->observers[$key]);
67  }
68  }
69 
75  public function ‪notify()
76  {
77  foreach ($this->observers as $observer) {
78  $observer->update($this);
79  }
80  }
81 
89  public function ‪isAvailable()
90  {
91  $isAvailable = true;
92  if (!extension_loaded($this->requiredPhpExtensions)) {
93  $prefix = PHP_SHLIB_SUFFIX === 'dll' ? 'php_' : '';
94  if (!(((bool)ini_get('enable_dl') && !(bool)ini_get('safe_mode')) && function_exists('dl') && dl($prefix . $this->requiredPhpExtensions . PHP_SHLIB_SUFFIX))) {
95  $isAvailable = false;
96  }
97  }
98  return $isAvailable;
99  }
100 
107  abstract public function ‪parseXml($file);
108 
112  abstract protected function ‪createParser();
113 }
‪TYPO3\CMS\Extensionmanager\Utility\Parser\AbstractXmlParser\attach
‪attach(\SplObserver $observer)
Definition: AbstractXmlParser.php:48
‪TYPO3\CMS\Extensionmanager\Utility\Parser
Definition: AbstractExtensionXmlParser.php:2
‪TYPO3\CMS\Extensionmanager\Utility\Parser\AbstractXmlParser\detach
‪detach(\SplObserver $observer)
Definition: AbstractXmlParser.php:59
‪TYPO3\CMS\Extensionmanager\Utility\Parser\AbstractXmlParser\$objXml
‪mixed $objXml
Definition: AbstractXmlParser.php:27
‪TYPO3\CMS\Extensionmanager\Utility\Parser\AbstractXmlParser\notify
‪notify()
Definition: AbstractXmlParser.php:72
‪TYPO3\CMS\Extensionmanager\Utility\Parser\AbstractXmlParser\$observers
‪SplObserver[] $observers
Definition: AbstractXmlParser.php:40
‪TYPO3\CMS\Extensionmanager\Utility\Parser\AbstractXmlParser\isAvailable
‪bool isAvailable()
Definition: AbstractXmlParser.php:86
‪TYPO3\CMS\Extensionmanager\Utility\Parser\AbstractXmlParser
Definition: AbstractXmlParser.php:22
‪TYPO3\CMS\Extensionmanager\Utility\Parser\AbstractXmlParser\createParser
‪createParser()
‪TYPO3\CMS\Extensionmanager\Utility\Parser\AbstractXmlParser\$requiredPhpExtensions
‪string $requiredPhpExtensions
Definition: AbstractXmlParser.php:34
‪TYPO3\CMS\Extensionmanager\Utility\Parser\AbstractXmlParser\parseXml
‪parseXml($file)