<?php

namespace App\Mvc;

abstract class View_RemoteDataInfoBoxAbstract extends \App\Mvc\ViewAbstract
{

	/**
	 * (non-PHPdoc)
	 * @see \App\Mvc\ViewAbstract::render()
	 */
	public function render()
	{

		// call the getRemoteDetails method and throw specific exceptions if it is the case

		// get the output
		$output = $this->getRemoteDetails(); // may throw \Engine\RemoteData\InfoBox\Exception exceptions

		// check the output of the entity collected data
		if ( !($output instanceof \Engine\RemoteData\InfoBox\Container_Main) ) {
			throw new \Exception('getRemoteDetails() should return class \Engine\RemoteData\InfoBox\Container_Main. Please check class '.get_called_class().'.');
		}

		return $output->exportAsArray();
	}

	/**
	 * Returns the output to be json-rendered.
	 * @return \Engine\RemoteData\InfoBox\Container_Main
	 */
	abstract protected function getRemoteDetails();

}
