added some documentation
reduced verbosity of exceptions if not in debug mode added default format for graphs
This commit is contained in:
parent
fd2daa02ff
commit
e33feb71de
2 changed files with 20 additions and 2 deletions
|
@ -61,7 +61,7 @@ class JpGraph extends View {
|
|||
* @param HTTP\Response $response
|
||||
* @param string $format one of png, jpeg, gif
|
||||
*/
|
||||
public function __construct(HTTP\Request $request, HTTP\Response $response, $format) {
|
||||
public function __construct(HTTP\Request $request, HTTP\Response $response, $format = 'png') {
|
||||
parent::__construct($request, $response);
|
||||
|
||||
$this->graph = new \Graph($this->width,$this->height);
|
||||
|
|
|
@ -47,11 +47,29 @@ interface ViewInterface {
|
|||
*
|
||||
*/
|
||||
abstract class View implements ViewInterface {
|
||||
/**
|
||||
* @var integer round all values to x decimals
|
||||
*/
|
||||
const PRECISSION = 5;
|
||||
|
||||
/**
|
||||
* @var HTTP\Request
|
||||
* @todo do we need this?
|
||||
* @todo why public? not via getter?
|
||||
*/
|
||||
public $request;
|
||||
|
||||
/**
|
||||
* @var HTTP\Response
|
||||
*/
|
||||
protected $response;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param HTTP\Request $request
|
||||
* @param HTTP\Response $response
|
||||
*/
|
||||
public function __construct(HTTP\Request $request, HTTP\Response $response) {
|
||||
$this->request = $request;
|
||||
$this->response = $response;
|
||||
|
@ -69,7 +87,7 @@ abstract class View implements ViewInterface {
|
|||
}
|
||||
|
||||
final public function exceptionHandler(\Exception $exception) {
|
||||
$this->addException($exception);
|
||||
$this->addException($exception, Util\Debug::isActivated());
|
||||
|
||||
$code = ($exception->getCode() == 0 && HTTP\Response::getCodeDescription($exception->getCode())) ? 400 : $exception->getCode();
|
||||
$this->response->setCode($code);
|
||||
|
|
Loading…
Add table
Reference in a new issue