dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "Avoid negative JobRunner time stats"
[lhc/web/wiklou.git]
/
includes
/
PathRouter.php
diff --git
a/includes/PathRouter.php
b/includes/PathRouter.php
index
3be504a
..
e5979b8
100644
(file)
--- a/
includes/PathRouter.php
+++ b/
includes/PathRouter.php
@@
-27,7
+27,7
@@
*
* $router->add( "/wiki/$1" );
* - Matches /wiki/Foo style urls and extracts the title
*
* $router->add( "/wiki/$1" );
* - Matches /wiki/Foo style urls and extracts the title
- * $router->add( array( 'edit' => "/edit/$
1
" ), array( 'action' => '$key' ) );
+ * $router->add( array( 'edit' => "/edit/$
key
" ), array( 'action' => '$key' ) );
* - Matches /edit/Foo style urls and sets action=edit
* $router->add( '/$2/$1',
* array( 'variant' => '$2' ),
* - Matches /edit/Foo style urls and sets action=edit
* $router->add( '/$2/$1',
* array( 'variant' => '$2' ),
@@
-82,10
+82,10
@@
class PathRouter {
* This is in a separate method so that add() can handle the difference between
* a single string $path and an array() $path that contains multiple path
* patterns each with an associated $key to pass on.
* This is in a separate method so that add() can handle the difference between
* a single string $path and an array() $path that contains multiple path
* patterns each with an associated $key to pass on.
- * @param
$path string
- * @param
$params array
- * @param
$options array
- * @param
$key null|string
+ * @param
string $path
+ * @param
array $params
+ * @param
array $options
+ * @param
null|string $key
*/
protected function doAdd( $path, $params, $options, $key = null ) {
// Make sure all paths start with a /
*/
protected function doAdd( $path, $params, $options, $key = null ) {
// Make sure all paths start with a /
@@
-141,10
+141,10
@@
class PathRouter {
}
$pattern = (object)array(
}
$pattern = (object)array(
- 'path'
=> $path,
- 'params'
=> $params,
+ 'path' => $path,
+ 'params' => $params,
'options' => $options,
'options' => $options,
- 'key'
=> $key,
+ 'key' => $key,
);
$pattern->weight = self::makeWeight( $pattern );
$this->patterns[] = $pattern;
);
$pattern->weight = self::makeWeight( $pattern );
$this->patterns[] = $pattern;
@@
-153,9
+153,9
@@
class PathRouter {
/**
* Add a new path pattern to the path router
*
/**
* Add a new path pattern to the path router
*
- * @param
$path string|array
The path pattern to add
- * @param
$params array
The params for this path pattern
- * @param
$options array
The options for this path pattern
+ * @param
string|array $path
The path pattern to add
+ * @param
array $params
The params for this path pattern
+ * @param
array $options
The options for this path pattern
*/
public function add( $path, $params = array(), $options = array() ) {
if ( is_array( $path ) ) {
*/
public function add( $path, $params = array(), $options = array() ) {
if ( is_array( $path ) ) {
@@
-170,9
+170,9
@@
class PathRouter {
/**
* Add a new path pattern to the path router with the strict option on
* @see self::add
/**
* Add a new path pattern to the path router with the strict option on
* @see self::add
- * @param
$path string|array
- * @param
$params array
- * @param
$options array
+ * @param
string|array $path
+ * @param
array $params
+ * @param
array $options
*/
public function addStrict( $path, $params = array(), $options = array() ) {
$options['strict'] = true;
*/
public function addStrict( $path, $params = array(), $options = array() ) {
$options['strict'] = true;
@@
-185,14
+185,14
@@
class PathRouter {
*/
protected function sortByWeight() {
$weights = array();
*/
protected function sortByWeight() {
$weights = array();
- foreach( $this->patterns as $key => $pattern ) {
+ foreach
( $this->patterns as $key => $pattern ) {
$weights[$key] = $pattern->weight;
}
array_multisort( $weights, SORT_DESC, SORT_NUMERIC, $this->patterns );
}
/**
$weights[$key] = $pattern->weight;
}
array_multisort( $weights, SORT_DESC, SORT_NUMERIC, $this->patterns );
}
/**
- * @param
$pattern object
+ * @param
object $pattern
* @return float|int
*/
protected static function makeWeight( $pattern ) {
* @return float|int
*/
protected static function makeWeight( $pattern ) {
@@
-203,7
+203,7
@@
class PathRouter {
$path = explode( '/', $pattern->path );
# For each level of the path
$path = explode( '/', $pattern->path );
# For each level of the path
- foreach( $path as $piece ) {
+ foreach
( $path as $piece ) {
if ( preg_match( '/^\$(\d+|key)$/u', $piece ) ) {
# For a piece that is only a $1 variable add 1 points of weight
$weight += 1;
if ( preg_match( '/^\$(\d+|key)$/u', $piece ) ) {
# For a piece that is only a $1 variable add 1 points of weight
$weight += 1;
@@
-232,8
+232,8
@@
class PathRouter {
/**
* Parse a path and return the query matches for the path
*
/**
* Parse a path and return the query matches for the path
*
- * @param
$path string
The path to parse
- * @return
A
rray The array of matches for the path
+ * @param
string $path
The path to parse
+ * @return
a
rray The array of matches for the path
*/
public function parse( $path ) {
// Make sure our patterns are sorted by weight so the most specific
*/
public function parse( $path ) {
// Make sure our patterns are sorted by weight so the most specific
@@
-257,8
+257,8
@@
class PathRouter {
}
/**
}
/**
- * @param
$path string
- * @param
$pattern string
+ * @param
string $path
+ * @param
string $pattern
* @return array|null
*/
protected static function extractTitle( $path, $pattern ) {
* @return array|null
*/
protected static function extractTitle( $path, $pattern ) {
@@
-363,7
+363,7
@@
class PathRouterPatternReplacer {
* We do this inside of a replacement callback because after replacement we can't tell the
* difference between a $1 that was not replaced and a $1 that was part of
* the content a $1 was replaced with.
* We do this inside of a replacement callback because after replacement we can't tell the
* difference between a $1 that was not replaced and a $1 that was part of
* the content a $1 was replaced with.
- * @param
$value string
+ * @param
string $value
* @return string
*/
public function replace( $value ) {
* @return string
*/
public function replace( $value ) {
@@
-376,7
+376,7
@@
class PathRouterPatternReplacer {
}
/**
}
/**
- * @param
$m array
+ * @param
array $m
* @return string
*/
protected function callback( $m ) {
* @return string
*/
protected function callback( $m ) {