diff --git a/app/src/Service/Contabilidad/Cartola/withSubBancos.php b/app/src/Service/Contabilidad/Cartola/withSubBancos.php new file mode 100644 index 0000000..c49c3f9 --- /dev/null +++ b/app/src/Service/Contabilidad/Cartola/withSubBancos.php @@ -0,0 +1,36 @@ +subBancos []= $sub; + return $this; + } + public function getSubBanco(string $filename): Banco + { + foreach ($this->subBancos as $subBanco) { + if ($subBanco->is($filename)) { + return $subBanco; + } + } + return $this; + } + public function process(UploadedFileInterface $file): array + { + $filename = $this->processUploadedFile($file); + try { + $subBanco = $this->getSubBanco($filename); + $data = $subBanco->processFile($filename); + return $subBanco->mapColumns($data); + } catch (InvalidArgumentException) { + $data = parent::processFile($filename); + return $this->mapColumns($data); + } + } +}