1 <?php
2 /**
3 * @package Joomla.Libraries
4 * @subpackage Component
5 *
6 * @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
7 * @license GNU General Public License version 2 or later; see LICENSE.txt
8 */
9
10 defined('JPATH_PLATFORM') or die;
11
12 /**
13 * Base component routing class
14 *
15 * @since 3.3
16 */
17 abstract class JComponentRouterBase implements JComponentRouterInterface
18 {
19 /**
20 * Application object to use in the router
21 *
22 * @var JApplicationCms
23 * @since 3.4
24 */
25 public $app;
26
27 /**
28 * Menu object to use in the router
29 *
30 * @var JMenu
31 * @since 3.4
32 */
33 public $menu;
34
35 /**
36 * Class constructor.
37 *
38 * @param JApplicationCms $app Application-object that the router should use
39 * @param JMenu $menu Menu-object that the router should use
40 *
41 * @since 3.4
42 */
43 public function __construct($app = null, $menu = null)
44 {
45 if ($app)
46 {
47 $this->app = $app;
48 }
49 else
50 {
51 $this->app = JFactory::getApplication('site');
52 }
53
54 if ($menu)
55 {
56 $this->menu = $menu;
57 }
58 else
59 {
60 $this->menu = $this->app->getMenu();
61 }
62 }
63
64 /**
65 * Generic method to preprocess a URL
66 *
67 * @param array $query An associative array of URL arguments
68 *
69 * @return array The URL arguments to use to assemble the subsequent URL.
70 *
71 * @since 3.3
72 */
73 public function preprocess($query)
74 {
75 return $query;
76 }
77 }
78