From f6f79198b6467435fd7caccd2067eb0a29c97787 Mon Sep 17 00:00:00 2001 From: Jacek Kowalski <Jacek@jacekk.info> Date: Fri, 21 Jun 2019 22:58:16 +0000 Subject: [PATCH] Move mapping creation to a function in lib/output.php --- parse.php | 11 +---------- 1 files changed, 1 insertions(+), 10 deletions(-) diff --git a/parse.php b/parse.php index ebd18cd..8a5416e 100644 --- a/parse.php +++ b/parse.php @@ -82,16 +82,7 @@ $db->addMapping($mapping); - $jsonContent = []; - foreach($db->getAll() as $vehicle) { - $jsonContent[$vehicle['id']] = $source['mapper']($vehicle['num']); - } - - $json = json_encode($jsonContent); - if(!file_put_contents($source['result_temp'], $json)) { - throw new Exception('Result save failed'); - } - rename($source['result_temp'], $source['result']); + createMapping($db, $source['mapper'], $source); $logger->info('Creating vehicle list...'); -- Gitblit v1.9.1