update:
- bin.php frontal command
This commit is contained in:
parent
fe77b35dcc
commit
ae43c2e6bb
|
@ -49,8 +49,9 @@ class Error
|
|||
}
|
||||
}
|
||||
$write_string = ob_get_clean();
|
||||
file_put_contents(dirname(__DIR__) . DIRECTORY_SEPARATOR . "output" . DIRECTORY_SEPARATOR . ENV . DIRECTORY_SEPARATOR . "errors".$date->format("Y-m-d").".log", $write_string);
|
||||
file_put_contents(OUTPUT_PATH . DIRECTORY_SEPARATOR . "output" . DIRECTORY_SEPARATOR . ENV . DIRECTORY_SEPARATOR . "errors".$date->format("Y-m-d").".log", $write_string);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,38 +1,37 @@
|
|||
<?php
|
||||
|
||||
namespace MVC\Component;
|
||||
namespace MVC\Command\Component;
|
||||
|
||||
use Tests\Behat\Gherkin\Loader\DirectoryLoaderTest;
|
||||
|
||||
/**
|
||||
* Composant permettant de créér des fichiers de sortie de données
|
||||
* @package Default
|
||||
* Classe Output permettant de créér des fichiers de sortie de données
|
||||
*/
|
||||
class Output
|
||||
{
|
||||
/**
|
||||
* Fonction statique permettant d'écrire un fichier de sortie
|
||||
* Fonction statique permettant d'écrire le fichier CSV de sortie
|
||||
* en lui donnant un nom particulier
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $data
|
||||
* @param array $agents_tab
|
||||
* @param \DateTime $date_debut
|
||||
* @return void
|
||||
*/
|
||||
public static function createOutPutFile(string $name, $data)
|
||||
public static function createOutPutFile(string $name, array $agents_tab, \DateTime $date_debut)
|
||||
{
|
||||
|
||||
$date_debut = new \DateTime('now');
|
||||
$date_fin = new \DateTime('now');
|
||||
|
||||
ob_start();
|
||||
|
||||
echo "# ".$date_debut->format('d/m/Y H:i:s') . LINE_FEED;
|
||||
echo $data . LINE_FEED;
|
||||
$date_fin = new \DateTime('now');
|
||||
echo "# FIN ".$date_fin->format('d/m/Y H:i:s') . LINE_FEED;
|
||||
echo "# ".$date_debut->format('d/m/Y H:i') . LINE_FEED;
|
||||
foreach ($agents_tab as $agent) {
|
||||
echo $agent . LINE_FEED;
|
||||
}
|
||||
echo "# FIN ".$date_fin->format('d/m/Y H:i') . LINE_FEED;
|
||||
|
||||
$csv_file = ob_get_clean();
|
||||
|
||||
//on insère la date du jour au début du nom de fichier
|
||||
$name = $date_debut->format("Y-m-d-").$name;
|
||||
|
||||
file_put_contents(dirname(__DIR__) . DIRECTORY_SEPARATOR . 'output' . DIRECTORY_SEPARATOR . $name, $csv_file);
|
||||
file_put_contents(OUTPUT_PATH . DIRECTORY_SEPARATOR . $date_debut->format('Y-m-d-') . $name, $csv_file);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue