/** * zGravaFile * Grava os dados no diretorio das NFe * @param string $tpAmb ambiente * @param string $filename nome do arquivo * @param string $data dados a serem salvos * @param string $subFolder * @param string $anomes * @throws Exception\RuntimeException */ protected function zGravaFile($tipo = '', $tpAmb = '2', $filename = '', $data = '', $subFolder = 'temporarias', $anomes = '') { if ($anomes == '') { $anomes = date('Ym'); } $path = ''; if ($tipo == 'nfe') { $path = $this->aConfig['pathNFeFiles']; } elseif ($tipo == 'cte') { $path = $this->aConfig['pathCTeFiles']; } elseif ($tipo == 'mdfe') { $path = $this->aConfig['pathMDFeFiles']; } $pathTemp = Files\FilesFolders::getFilePath($tpAmb, $path, $subFolder) . DIRECTORY_SEPARATOR . $anomes; if (!Files\FilesFolders::saveFile($pathTemp, $filename, $data)) { $msg = 'Falha na gravação no diretório. ' . $pathTemp; throw new Exception\RuntimeException($msg); } }