for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Created by PhpStorm.
* User: Administrador
* Date: 20/07/2017
* Time: 04:06 PM
*/
namespace Greenter;
use Greenter\Helper\ZipHelper;
use Greenter\Security\SignedXml;
use Greenter\Ws\Services\FeSunat;
use Greenter\Xml\Generator\FeGenerator;
use Greenter\Xml\Model\Sale\Invoice;
class FeFactory
{
* @var FeGenerator
private $generator;
* @var SignedXml
private $signer;
* @var ZipHelper
private $zip;
* @var FeSunat
private $sender;
* FeFactory constructor.
public function __construct()
$this->generator = new FeGenerator();
$this->signer = new SignedXml();
$this->sender = new FeSunat('20000000001MODDATOS', 'moddatos');
$this->signer->setPrivateKey('');
}
public function sendInvoice(Invoice $invoice)
$xml = $this->generator->buildInvoice($invoice);
$xmlS = $this->signer->sign($xml);
$filename = '';
$zip = $this->zip->compress("$filename.xml", $xmlS);
$zipR = $this->sender->send("$filename.zip", $zip);
$xml = $this->zip->decompress($zipR, "R-$filename.xml");
$xml
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
$myVar = 'Value'; $higher = false; if (rand(1, 6) > 3) { $higher = true; } else { $higher = false; }
Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.
$myVar
$higher
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVarassignment in line 1 and the$higherassignment in line 2 are dead. The first because$myVaris never used and the second because$higheris always overwritten for every possible time line.