for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* App.php
*
* Jaxon application
* @package jaxon-core
* @author Thierry Feuzeu <[email protected]>
* @copyright 2019 Thierry Feuzeu <[email protected]>
* @license https://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License
* @link https://github.com/jaxon-php/jaxon-core
*/
namespace Jaxon\App\Ajax;
use Jaxon\Exception\RequestException;
use Jaxon\Exception\SetupException;
use function file_exists;
use function is_array;
class App extends AbstractApp
{
use SendTrait;
* @inheritDoc
* @throws SetupException
public function setup(string $sConfigFile = '')
if(!file_exists($sConfigFile))
$sMessage = $this->xTranslator->trans('errors.file.access', ['path' => $sConfigFile]);
throw new SetupException($sMessage);
}
// Read the config options.
$aOptions = $this->xConfigManager->read($sConfigFile);
$aLibOptions = $aOptions['lib'] ?? [];
$aAppOptions = $aOptions['app'] ?? [];
if(!is_array($aLibOptions) || !is_array($aAppOptions))
$sMessage = $this->xTranslator->trans('errors.file.content', ['path' => $sConfigFile]);
// The bootstrap set this to false. It needs to be changed.
if(!isset($aLibOptions['core']['response']['send']))
$aLibOptions['core']['response']['send'] = true;
$this->bootstrap()
->lib($aLibOptions)
->app($aAppOptions)
->setup();
* @throws RequestException
public function httpResponse(string $sCode = '200')
// Send the response
$this->sendResponse($sCode);