Page MenuHomeIn-Portal Phabricator

AbstractReviewRouter.php
No OneTemporary

File Metadata

Created
Wed, Sep 24, 6:44 AM

AbstractReviewRouter.php

<?php
abstract class AbstractReviewRouter extends AbstractRouter
{
/**
* Builds url part.
*
* @return boolean Return true to continue to next router; return false not to rewrite given prefix.
*/
protected function build()
{
static $default_per_page = array();
$ret = '';
$build_params = $this->extractBuildParams();
if ( $build_params === false ) {
return '';
}
list ($prefix) = explode('.', $this->buildPrefix);
if ( !array_key_exists($prefix, $default_per_page) ) {
/** @var ListHelper $list_helper */
$list_helper = $this->Application->recallObject('ListHelper');
$default_per_page[$prefix] = $list_helper->getDefaultPerPage($prefix);
}
if ( $build_params[$this->buildPrefix . '_id'] ) {
return false;
}
else {
if ( $build_params[$this->buildPrefix . '_Page'] == 1 ) {
// When printing category items and we are on the 1st page -> there is no information about
// category item prefix and $params['pass_category'] will not be added automatically.
$this->setBuildParam('pass_category', true);
}
elseif ( $build_params[$this->buildPrefix . '_Page'] > 1 ) {
$this->setBuildParam('page', $build_params[$this->buildPrefix . '_Page']);
}
$per_page = $build_params[$this->buildPrefix . '_PerPage'];
if ( $per_page && ($per_page != $default_per_page[$this->buildPrefix]) ) {
$this->setBuildParam('per_page', $build_params[$this->buildPrefix . '_PerPage']);
}
}
return mb_strtolower(rtrim($ret, '/'));
}
/**
* Parses url part.
*
* @param array $url_parts Url parts to parse.
* @param array $params Parameters, that are used for url building or created during url parsing.
*
* @return boolean Return true to continue to next router; return false to stop processing at this router.
*/
public function parse(array &$url_parts, array &$params)
{
// Don't parse anything.
return true;
}
}

Event Timeline