From 444022efa7c5a4ac46ca1a5c82b3acda0895daf5 Mon Sep 17 00:00:00 2001 From: Emmanuel ROY Date: Tue, 8 Dec 2020 09:28:12 +0100 Subject: [PATCH] update console bin update composer.json for autoload of Command update in order to make it usefull --- .idea/codeStyles/codeStyleConfig.xml | 5 +++ application/class/Dumper.php | 17 +++++++ application/class/Logger.php | 19 ++++++++ composer.json | 5 ++- console/bin.php | 21 ++++++--- .../command/{cache.class.php => Cache.php} | 3 +- .../command/{module.class.php => Module.php} | 45 ++++++++++--------- console/command/{page.class.php => Page.php} | 3 +- .../{symfony.class.php => Symfony.php} | 3 +- .../objets => domain}/phantom.gitkeep | 0 10 files changed, 88 insertions(+), 33 deletions(-) create mode 100644 .idea/codeStyles/codeStyleConfig.xml rename console/command/{cache.class.php => Cache.php} (94%) rename console/command/{module.class.php => Module.php} (96%) rename console/command/{page.class.php => Page.php} (98%) rename console/command/{symfony.class.php => Symfony.php} (88%) rename {application/objets => domain}/phantom.gitkeep (100%) diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000..a55e7a1 --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/application/class/Dumper.php b/application/class/Dumper.php index 922a63b..87dcfd0 100644 --- a/application/class/Dumper.php +++ b/application/class/Dumper.php @@ -14,5 +14,22 @@ class Dumper{ } echo ""; } + /** + * Fonction Statique permettant d'initialiser les valeurs de php lors du script courant + * + * @return void + */ + public static function setPHPvalues() + { + ini_set('display_errors', 1); + ini_set('display_startup_errors', 1); + ini_set('memory_limit', -1); + ini_set('max_execution_time', 0); + ini_set('default_socket_timeout', -1); + + error_reporting(E_ALL); + + return; + } } \ No newline at end of file diff --git a/application/class/Logger.php b/application/class/Logger.php index 79334eb..aa05216 100644 --- a/application/class/Logger.php +++ b/application/class/Logger.php @@ -22,5 +22,24 @@ class Logger file_put_contents($file, $what); } } + /** + * Fonction courante permettant de logger les erreurs obtenues dans un fichier + * + * @param array $errors + * @return void + */ + public static function logCommandErrors(array $errors) + { + // log connection errors to the web service + ob_start(); + foreach ($errors as $key => $value) { + echo "\n\n$key : \n"; + print_r($value); + } + $write_string = ob_get_clean(); + file_put_contents(dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . "logs" . DIRECTORY_SEPARATOR . "errors_command.log", $write_string); + + return; + } } \ No newline at end of file diff --git a/composer.json b/composer.json index a15090e..eb87393 100644 --- a/composer.json +++ b/composer.json @@ -5,8 +5,9 @@ ], "psr-4": { - "MVC\\Classe\\":"./application/class", - "MVC\\Objets\\":"./application/objets" + "MVC\\Classe\\" : "./application/class", + "MVC\\Domain\\" : "./domain", + "MVC\\Command\\": "./console/command" } }, "require": { diff --git a/console/bin.php b/console/bin.php index 83564dd..0ca8caa 100644 --- a/console/bin.php +++ b/console/bin.php @@ -1,18 +1,27 @@ #!/usr/bin/php