[ Index ] |
PHP Cross Reference of phpBB-3.3.14-deutsch |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * 4 * This file is part of the phpBB Forum Software package. 5 * 6 * @copyright (c) phpBB Limited <https://www.phpbb.com> 7 * @license GNU General Public License, version 2 (GPL-2.0) 8 * 9 * For full copyright and license information, please see 10 * the docs/CREDITS.txt file. 11 * 12 */ 13 14 namespace phpbb\install\helper\file_updater; 15 16 use phpbb\di\service_collection; 17 use phpbb\install\exception\file_updater_failure_exception; 18 19 /** 20 * File updater factory 21 */ 22 class factory 23 { 24 /** 25 * @var array 26 */ 27 protected $file_updaters; 28 29 /** 30 * Constructor 31 * 32 * @param service_collection $collection File updater service collection 33 */ 34 public function __construct(service_collection $collection) 35 { 36 foreach ($collection as $service) 37 { 38 $this->register($service); 39 } 40 } 41 42 /** 43 * Register updater object 44 * 45 * @param file_updater_interface $updater Updater object 46 */ 47 public function register(file_updater_interface $updater) 48 { 49 $name = $updater->get_method_name(); 50 $this->file_updaters[$name] = $updater; 51 } 52 53 /** 54 * Returns file updater object 55 * 56 * @param string $name Name of the updater method 57 * 58 * @throws file_updater_failure_exception When the specified file updater does not exist 59 */ 60 public function get($name) 61 { 62 if (!isset($this->file_updaters[$name])) 63 { 64 throw new file_updater_failure_exception(); 65 } 66 67 return $this->file_updaters[$name]; 68 } 69 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Mon Nov 25 19:05:08 2024 | Cross-referenced by PHPXref 0.7.1 |