- sprintf: documentation ( source)
<?php
interface IRouteBuilder
{
public function __construct($culture, $brand, $country);
public function getRoute(sfWebRequest $request);
}
abstract class AbstractRouteBuilder implements IRouteBuilder
{
protected $culture;
protected $brand;
protected $country;
public function __construct($culture, $brand, $country)
{
$this->culture = $culture;
$this->brand = $brand;
$this->country = $country;
echo 'toto';
}
abstract public function getRoute(sfWebRequest $request);
protected function assertMandatoryParameters(array $parameters, sfWebRequest $request)
{
foreach ($parameters as $parameter)
{
if (is_null($request->getGetParameter($parameter)))
{
throw new Exception(sprintf('Missing parameter "%s"', $parameter));
}
}
}
protected function generateUrl($route, $params)
{
return sfContext::getInstance()->getRouting()->generate($route, $params, true);
}
}