Update commentaries

This commit is contained in:
Yoggzo 2016-03-27 19:40:36 +02:00
parent e9c7477ff0
commit 19d84e2ae4
3 changed files with 64 additions and 10 deletions

View file

@ -1,11 +1,11 @@
<?php <?php
/** /**
* File containing the Image Class. * File containing the Automating Class.
* *
* @version 1.0 Initialisation of this file * @version 1.0 Initialisation of this file
* @since 1.0 Core application's file * @since 1.0 Core application's file
* *
* @author Yogg 'yogg at epsina . com' * @author Evan Pisani 'yogg at epsina . com'
* *
* @todo Complete the functions with errors detection and finish the descriptions * @todo Complete the functions with errors detection and finish the descriptions
*/ */
@ -48,7 +48,13 @@ class automating implements Core{
$this->{$action.""}(); $this->{$action.""}();
} }
/**
* Create a new image on a new server
*
* @param $error the error triggered
*
* @return Image the new image created
*/
private function createImageOnNewServer(){ private function createImageOnNewServer(){
try{ try{
$image = new Image($this->app); $image = new Image($this->app);
@ -87,9 +93,8 @@ class automating implements Core{
}catch(Exception $e){ }catch(Exception $e){
$this->app->getErrorInstance()->OtherException($e); $this->app->getErrorInstance()->OtherException($e);
} }
$this->app->setOutput("Auto", $res);
} }
} }
?> ?>

View file

@ -1,4 +1,13 @@
<?php <?php
/**
* File containing the Errormanagement Class.
*
* @version 1.0 Initialisation of this file
* @since 1.0 Core application's file
*
* @author Eole 'eoledev at outlook . fr', Evan Pisani 'yogg at epsina . com'
*
*/
use OpenCloud\Common\Error\BadResponseError; use OpenCloud\Common\Error\BadResponseError;
use OpenCloud\Common\Error\BaseError; use OpenCloud\Common\Error\BaseError;
@ -7,20 +16,40 @@ use OpenCloud\Common\Error\UserInputError;
Class errorManagement{ Class errorManagement{
/** @var App $app protected, contains the main app object */
protected $app; protected $app;
/**
* ErrorManagemement constructor
*
* @param App $app the main app object
*
* @return ErrorManagement
*/
public function __construct($args){ public function __construct($args){
$this->app = $args; $this->app = $args;
} }
/**
* Put an error message corresponding to a base error in the output
*
* @param $error the error triggered
*
* @return String BaseError message
*/
public function BaseErrorHandler($error){ public function BaseErrorHandler($error){
$this->app->setOutput("Error", "BaseError"); $this->app->setOutput("Error", "BaseError");
} }
/**
* Put an error message corresponding to a bad response in function of the status code in the output
*
* @param $error the error triggered
*
* @return String Error message
*/
public function BadResponseHandler($error){ public function BadResponseHandler($error){
$statusCode = $error->getResponse()->getStatusCode(); $statusCode = $error->getResponse()->getStatusCode();
switch ($statusCode) { switch ($statusCode) {
@ -54,19 +83,39 @@ Class errorManagement{
} }
} }
/**
* Put an error message corresponding to a not implemented yet error in the output
*
* @param $error the error triggered
*
* @return String internal error message
*/
public function NotImplementedHandler($error){ public function NotImplementedHandler($error){
$this->app->setOutput("Error", "Internal error (not implemented yet), please contact an administrator"); $this->app->setOutput("Error", "Internal error (not implemented yet), please contact an administrator");
} }
/**
* Put an error message corresponding to a user input error in the output
*
* @param $error the error triggered
*
* @return String User input error message
*/
public function UserInputHandler($error){ public function UserInputHandler($error){
$this->app->setOutput("Error", "UserInputError"); $this->app->setOutput("Error", "UserInputError");
} }
/**
* Put an error message corresponding to an other error in the output
*
* @param $error the error triggered
*
* @return String error message
*/
public function OtherException($error){ public function OtherException($error){
$this->app->setOutput("Error", $error->getMessage()); $this->app->setOutput("Error", $error->getMessage());
} }
} }
?> ?>

View file

@ -5,7 +5,7 @@
* @version 1.0 Initialisation of this file * @version 1.0 Initialisation of this file
* @since 1.0 Core application's file * @since 1.0 Core application's file
* *
* @author Yogg 'yogg at epsina . com' * @author Evan Pisani 'yogg at epsina . com'
* *
* @todo Complete the functions with errors detection and finish the descriptions * @todo Complete the functions with errors detection and finish the descriptions
*/ */
@ -19,7 +19,7 @@ include("CoreInterface.php");
/** /**
* Image Class of the back-end application * Image Class of the back-end application
* *
* ADD CLASS DESCRIPTION * Management of images
* *
*/ */
class image implements Core{ class image implements Core{