<?php

    function barCode($data, $type){

        $type == '2d' ? $barcode = 'QRCODE' : $barcode = 'C39';

        if($type ==  '2d'){
            $code  = new \Milon\Barcode\DNS2D();
        } else {
            $code  = new \Milon\Barcode\DNS1D();
        }
        return $code->getBarcodeHTML($data, $barcode);


    }
    function barCodeSvg($data, $type){

//        $type == '2d' ? $barcode = 'QRCODE' : $barcode = 'C39';
        $type == '2d' ? $barcode = 'QRCODE' : $barcode = '"C128",1.4,22';

        if($type ==  '2d'){
            $code  = new \Milon\Barcode\DNS2D();
               return $code->getBarcodeHTML($data,  $barcode);
        }
        elseif($type ==  '1d'){
            $code  = new \Milon\Barcode\DNS1D();
               return $code->getBarcodeSVG($data,  "C128",1.4,22);
        }
     


    }
