‪TYPO3CMS  10.4
AbstractXmlParser.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 
22 abstract class ‪AbstractXmlParser implements \SplSubject
23 {
29  protected ‪$objXml;
30 
37  protected ‪$requiredPhpExtensions;
38 
44  protected ‪$observers = [];
45 
53  public function ‪attach(\SplObserver $observer)
54  {
55  $this->observers[] = $observer;
56  }
57 
65  public function ‪detach(\SplObserver $observer)
66  {
67  $key = array_search($observer, $this->observers, true);
68  if ($key !== false) {
69  unset($this->observers[$key]);
70  }
71  }
72 
79  public function ‪notify()
80  {
81  foreach ($this->observers as $observer) {
82  $observer->update($this);
83  }
84  }
85 
93  public function ‪isAvailable()
94  {
95  $isAvailable = true;
96  if (!extension_loaded($this->requiredPhpExtensions)) {
97  $prefix = PHP_SHLIB_SUFFIX === 'dll' ? 'php_' : '';
98  if (!(((bool)ini_get('enable_dl') && !(bool)ini_get('safe_mode')) && function_exists('dl') && dl($prefix . $this->requiredPhpExtensions . PHP_SHLIB_SUFFIX))) {
99  $isAvailable = false;
100  }
101  }
102  return $isAvailable;
103  }
104 
111  abstract public function ‪parseXml($file);
112 
116  abstract protected function ‪createParser();
117 }
‪TYPO3\CMS\Extensionmanager\Utility\Parser\AbstractXmlParser\attach
‪attach(\SplObserver $observer)
Definition: AbstractXmlParser.php:50
‪TYPO3\CMS\Extensionmanager\Utility\Parser
Definition: AbstractExtensionXmlParser.php:16
‪TYPO3\CMS\Extensionmanager\Utility\Parser\AbstractXmlParser\detach
‪detach(\SplObserver $observer)
Definition: AbstractXmlParser.php:62
‪TYPO3\CMS\Extensionmanager\Utility\Parser\AbstractXmlParser\$objXml
‪mixed $objXml
Definition: AbstractXmlParser.php:28
‪TYPO3\CMS\Extensionmanager\Utility\Parser\AbstractXmlParser\notify
‪notify()
Definition: AbstractXmlParser.php:76
‪TYPO3\CMS\Extensionmanager\Utility\Parser\AbstractXmlParser\$observers
‪SplObserver[] $observers
Definition: AbstractXmlParser.php:41
‪TYPO3\CMS\Extensionmanager\Utility\Parser\AbstractXmlParser\isAvailable
‪bool isAvailable()
Definition: AbstractXmlParser.php:90
‪TYPO3\CMS\Extensionmanager\Utility\Parser\AbstractXmlParser
Definition: AbstractXmlParser.php:23
‪TYPO3\CMS\Extensionmanager\Utility\Parser\AbstractXmlParser\createParser
‪createParser()
‪TYPO3\CMS\Extensionmanager\Utility\Parser\AbstractXmlParser\$requiredPhpExtensions
‪string $requiredPhpExtensions
Definition: AbstractXmlParser.php:35
‪TYPO3\CMS\Extensionmanager\Utility\Parser\AbstractXmlParser\parseXml
‪parseXml($file)