public function __construct()
 {
     $this->createSPLAutoloaders();
     $this->loadConfigs();
     $this->uri = URIHelper::getURIArray();
     $this->prepareURI();
     $this->buildCMA();
     //Controller, method and arguments
     $this->instantiateController();
     define('BASEPATH', Configuration::read('basepath'));
     define('HOST', $_SERVER['SERVER_NAME']);
 }
 /**
  * Set the URI port.
  *
  * @param int|string|null $port The URI port number as an integer or string. Or an URI instance to copy the URI port.
  *
  * @return bool True on success, false on failure.
  */
 public function setPort($port)
 {
     // Get the port form an URI instance
     if ($port instanceof URI) {
         $port = $port->getPort();
     }
     // Try to convert the port into an integer if it's a string
     if (is_string($port)) {
         // Cast the port number,
         $port = intval($port);
         // Make sure the port number is valid
         if (!URIHelper::isValidPort($port)) {
             return false;
         }
     }
     // Make sure the port number is an integer or null
     if (!is_int($port) && $port !== null) {
         return false;
     }
     // Set the port number, return the result
     $this->port = $port;
     return true;
 }