/usr/share/php/Horde/Routes/Matcher.php is in php-horde-routes 2.0.5-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | <?php
/**
* Helper class to generate the match dictionary for the incoming request.
*
* PHP version 5
*
* @category Horde
* @package Horde_Routes
* @author Gunnar Wrobel <wrobel@pardus.de>
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
* @link http://pear.horde.org/index.php?package=Horde_Routes
*/
/**
* Generates the match dictionary for the incoming request.
*
* Copyright 2011-2016 Horde LLC (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (LGPL). If you did not
* receive this file, see
* http://www.horde.org/licenses/lgpl21.
*
* @category Horde
* @package Horde_Routes
* @author Gunnar Wrobel <wrobel@pardus.de>
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
* @link http://pear.horde.org/index.php?package=Horde_Routes
*/
class Horde_Routes_Matcher
{
/**
* The routes mapper.
*
* @var Horde_Routes_Mapper
*/
protected $_mapper;
/**
* The incoming request.
*
* @var Horde_Controller_Request
*/
protected $_request;
/**
* The match dictionary.
*
* @var array
*/
protected $_match_dict;
/**
* Constructor
*
* @param Horde_Routes_Mapper $mapper The mapper
* @param Object $request A request object that implements a ::getPath()
* method similar to Horde_Controller_Request::
*/
public function __construct(
Horde_Routes_Mapper $mapper,
$request)
{
$this->_mapper = $mapper;
$this->_request = $request;
}
/**
* Return the match dictionary for the incoming request.
*
* @return array The match dictionary.
*/
public function getMatchDict()
{
if ($this->_match_dict === null) {
$path = $this->_request->getPath();
if (($pos = strpos($path, '?')) !== false) {
$path = substr($path, 0, $pos);
}
if (!$path) {
$path = '/';
}
$this->_match_dict = new Horde_Support_Array($this->_mapper->match($path));
}
return $this->_match_dict;
}
}
|