PHP Classes

File: src/Armada.php

Recommend this page to a friend!
  Classes of Thierry Feuzeu   Jaxon Armada   src/Armada.php   Download  
File: src/Armada.php
Role: Class source
Content type: text/plain
Description: Class source
Class: Jaxon Armada
Advanced features for Jaxon applications
Author: By
Last change: Updated the Armada setup.
Date: 3 years ago
Size: 2,379 bytes
 

Contents

Class file image Download
<?php

namespace Jaxon\Armada;

class
Armada
{
    use \
Jaxon\Sentry\Traits\Armada;

   
/**
     * The config file path
     *
     * @var string
     */
   
protected $sConfigFile = '';

   
/**
     * Initialise the Jaxon module.
     *
     * @return void
     */
   
public function __construct()
    {}

   
/**
     * Set the config file path.
     *
     * @return void
     */
   
public function config($sConfigFile)
    {
       
$this->sConfigFile = $sConfigFile;
       
// Initialize the Jaxon plugin
       
$this->_jaxonSetup();
    }

   
/**
     * Set the module specific options for the Jaxon library.
     *
     * @return void
     */
   
protected function jaxonSetup()
    {
       
$jaxon = jaxon();
       
$sentry = $jaxon->sentry();

       
// Read config file
       
$this->appConfig = $jaxon->readConfigFile($this->sConfigFile, 'lib', 'app');

       
// Set the session manager
       
$sentry->setSessionManager(function () {
            return new
Session();
        });
    }

   
/**
     * Set the module specific options for the Jaxon library.
     *
     * This method needs to set at least the Jaxon request URI.
     *
     * @return void
     */
   
protected function jaxonCheck()
    {
       
// Check the mandatory options
        // Jaxon library settings
        /*$aMandatoryOptions = ['js.app.extern', 'js.app.minify', 'js.app.uri', 'js.app.dir'];
        foreach($aMandatoryOptions as $sOption)
        {
            if(!$jaxon->hasOption($sOption))
            {
                throw new \Jaxon\Exception\Config\Data(jaxon_trans('config.errors.data.missing', array('key' => 'lib:' . $sOption)));
            }
        }*/
        // Jaxon application settings
        /*$aMandatoryOptions = ['controllers.directory', 'controllers.namespace'];
        foreach($aMandatoryOptions as $sOption)
        {
            if(!$this->appConfig->hasOption($sOption))
            {
                throw new \Jaxon\Exception\Config\Data(jaxon_trans('config.errors.data.missing', array('key' => 'app:' . $sOption)));
            }
        }*/
   
}

   
/**
     * Wrap the Jaxon response into an HTTP response.
     *
     * @param $code The HTTP Response code
     *
     * @return HTTP Response
     */
   
public function httpResponse($code = '200')
    {
       
// Send HTTP Headers
       
jaxon()->sendResponse();
    }
}