. */ namespace Volkszaehler\Controller; use Volkszaehler\Model; use Volkszaehler\Util; /** * Capabilities controller * * @author Steffen Vogel * @package default */ class CapabilitiesController extends Controller { /** * @todo * @param string $capabilities * @param string $sub */ public function get($capabilities, $sub) { switch ($capabilities) { case 'definition': if (in_array($sub, array('property', 'entity'))) { $class = 'Volkszaehler\Definition\\' . ucfirst($sub) . 'Definition'; $json = $class::getJSON(); $this->view->setCaching('expires', time()+2*7*24*60*60); // cache for 2 weeks $this->view->add(array('definition' => array($sub => $json))); } else { throw new Exception('Unkown definition information'); } break; case 'version': // TODO implement break; default: throw new \Exception('Unknown capability information: ' . implode('/', func_get_args())); } } } ?>