phplibrary/src/ComponentRequest.php

36 lines
749 B
PHP

<?php
namespace ctiso;
use ctiso\HttpRequest,
ctiso\Arr;
class ComponentRequest {
public $component_id;
public $component_title;
public $r;
function __construct($c, HttpRequest $r) {
$this->component_id = $c;
$this->r = $r;
}
function get($key, $default = null) {
if ($key == 'active_page') {
return $this->r->get($key);
}
$arr = $this->r->get($key);
if (!is_null($arr)) {
if (is_array($arr)) {
return Arr::get($arr, $this->component_id, $default);
} else {
return $arr;
}
}
return $default;
}
function getAction() {
return $this->r->getAction();
}
}