TYPO3  7.6
extensionmanager/Classes/Utility/Parser/AbstractXmlParser.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Extensionmanager\Utility\Parser;
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 
37 
43  protected $observers = array();
44 
52  public function attach(\SplObserver $observer)
53  {
54  $this->observers[] = $observer;
55  }
56 
64  public function detach(\SplObserver $observer)
65  {
66  $key = array_search($observer, $this->observers, true);
67  if ($key !== false) {
68  unset($this->observers[$key]);
69  }
70  }
71 
79  public function notify()
80  {
81  foreach ($this->observers as $observer) {
82  $observer->update($this);
83  }
84  }
85 
94  public function isAvailable()
95  {
96  $isAvailable = true;
97  if (!extension_loaded($this->requiredPhpExtensions)) {
98  $prefix = PHP_SHLIB_SUFFIX === 'dll' ? 'php_' : '';
99  if (!(((bool)ini_get('enable_dl') && !(bool)ini_get('safe_mode')) && function_exists('dl') && dl($prefix . $this->requiredPhpExtensions . PHP_SHLIB_SUFFIX))) {
100  $isAvailable = false;
101  }
102  }
103  return $isAvailable;
104  }
105 
112  abstract public function parseXml($file);
113 
119  abstract protected function createParser();
120 }