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 16namespace TYPO3\CMS\Extensionmanager\Utility\Parser; 17 18/** 19 * Abstract parser for TYPO3's mirror.xml file. 20 * @internal This class is a specific ExtensionManager implementation and is not part of the Public TYPO3 API. 21 */ 22abstract class AbstractMirrorXmlParser extends AbstractXmlParser 23{ 24 /** 25 * Keeps country of currently processed mirror. 26 * 27 * @var string 28 */ 29 protected $country; 30 31 /** 32 * Keeps hostname of currently processed mirror. 33 * 34 * @var string 35 */ 36 protected $host; 37 38 /** 39 * Keeps path to mirrored TER of currently processed mirror. 40 * 41 * @var string 42 */ 43 protected $path; 44 45 /** 46 * Keeps title of currently processed mirror. 47 * 48 * @var string 49 */ 50 protected $title; 51 52 /** 53 * Returns an associative array of all mirror properties. 54 * 55 * Valid array keys of returned array are: 56 * country, host, path, title 57 * 58 * @return array associative array of a mirror's properties 59 */ 60 public function getAll() 61 { 62 $mirrorProperties = []; 63 $mirrorProperties['title'] = $this->title; 64 $mirrorProperties['host'] = $this->host; 65 $mirrorProperties['path'] = $this->path; 66 $mirrorProperties['country'] = $this->country; 67 return $mirrorProperties; 68 } 69 70 /** 71 * Returns country of currently processed mirror. 72 * 73 * @return string name of country a mirror is located in 74 * @see getAll() 75 */ 76 public function getCountry() 77 { 78 return $this->country; 79 } 80 81 /** 82 * Returns host of currently processed mirror. 83 * 84 * @return string host name 85 * @see getAll() 86 */ 87 public function getHost() 88 { 89 return $this->host; 90 } 91 92 /** 93 * Returns path to mirrored TER of currently processed mirror. 94 * 95 * @return string path name 96 * @see getAll() 97 */ 98 public function getPath() 99 { 100 return $this->path; 101 } 102 103 /** 104 * Returns title of currently processed mirror. 105 * 106 * @return string title of mirror 107 * @see getAll() 108 */ 109 public function getTitle() 110 { 111 return $this->title; 112 } 113 114 /** 115 * Method resets version class properties. 116 */ 117 protected function resetProperties() 118 { 119 $this->title = $this->host = $this->path = $this->country = null; 120 } 121} 122