NFePHP\Common\Files\FilesFolders::getAmbiente PHP Method

getAmbiente() public static method

getAmbiente
public static getAmbiente ( string $tpAmb = '2' ) : string
$tpAmb string
return string
    public static function getAmbiente($tpAmb = '2')
    {
        if ($tpAmb == '2') {
            return 'homologacao';
        }
        return 'producao';
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Grava as mensagens em disco
  *
  * @param string $data conteudo a ser gravado
  * @param string $filename
  * @param int $tpAmb
  * @param string $folder
  * @param string $subFolder
  * @throws RuntimeException
  */
 protected function gravaFile($data, $filename, $tpAmb = '2', $folder = '', $subFolder = '')
 {
     $anomes = date('Ym');
     $pathTemp = $folder . Files\FilesFolders::getAmbiente($tpAmb) . DIRECTORY_SEPARATOR . $subFolder . DIRECTORY_SEPARATOR . $anomes;
     if (!Files\FilesFolders::saveFile($pathTemp, $filename, $data)) {
         $msg = 'Falha na gravação no diretório. ' . $pathTemp;
         throw new RuntimeException($msg);
     }
 }
All Usage Examples Of NFePHP\Common\Files\FilesFolders::getAmbiente