[ Index ] |
PHP Cross Reference of phpBB-3.1.12-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\controller; 15 16 use Symfony\Component\Routing\RouteCollection; 17 use Symfony\Component\Routing\Loader\YamlFileLoader; 18 use Symfony\Component\Config\FileLocator; 19 20 /** 21 * Controller interface 22 */ 23 class provider 24 { 25 /** 26 * YAML file(s) containing route information 27 * @var array 28 */ 29 protected $routing_files; 30 31 /** 32 * Collection of the routes in phpBB and all found extensions 33 * @var RouteCollection 34 */ 35 protected $routes; 36 37 /** 38 * Construct method 39 * 40 * @param array $routing_files Array of strings containing paths 41 * to YAML files holding route information 42 */ 43 public function __construct($routing_files = array()) 44 { 45 $this->routing_files = $routing_files; 46 } 47 48 /** 49 * Find the list of routing files 50 * 51 * @param \phpbb\finder $finder 52 * @return null 53 */ 54 public function find_routing_files(\phpbb\finder $finder) 55 { 56 // We hardcode the path to the core config directory 57 // because the finder cannot find it 58 $this->routing_files = array_merge($this->routing_files, array('config/routing.yml'), array_keys($finder 59 ->directory('/config') 60 ->suffix('routing.yml') 61 ->find() 62 )); 63 } 64 65 /** 66 * Find a list of controllers 67 * 68 * @param string $base_path Base path to prepend to file paths 69 * @return provider 70 */ 71 public function find($base_path = '') 72 { 73 $this->routes = new RouteCollection; 74 foreach ($this->routing_files as $file_path) 75 { 76 $loader = new YamlFileLoader(new FileLocator(phpbb_realpath($base_path))); 77 $this->routes->addCollection($loader->load($file_path)); 78 } 79 80 return $this; 81 } 82 83 /** 84 * Get the list of routes 85 * 86 * @return RouteCollection Get the route collection 87 */ 88 public function get_routes() 89 { 90 return $this->routes; 91 } 92 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Jan 11 00:25:41 2018 | Cross-referenced by PHPXref 0.7.1 |