Issues (103)

Examples/sendInvoiceByMail.php (2 issues)

Labels
Severity
1
#!/usr/bin/php -f
2
<?php
3
/**
4
 * FlexiPeeHP - Example how send Invoice by email
5
 *
6
 * @author     Vítězslav Dvořák <[email protected]>
7
 * @copyright  (G) 2017 Vitex Software
8
 */
9
10
namespace Example\FlexiPeeHP;
11
12
include_once './config.php';
13
include_once '../vendor/autoload.php';
14
15
include_once './common.php';
16
17
echo "Please recipient email addreess:";
18
$input     = fopen("php://stdin", "r");
19
$recipient = trim(fgets($input));
0 ignored issues
show
It seems like $input can also be of type false; however, parameter $handle of fgets() does only seem to accept resource, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

19
$recipient = trim(fgets(/** @scrutinizer ignore-type */ $input));
Loading history...
20
fclose($input);
0 ignored issues
show
It seems like $input can also be of type false; however, parameter $handle of fclose() does only seem to accept resource, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

20
fclose(/** @scrutinizer ignore-type */ $input);
Loading history...
21
22
$invoiceID = askForFlexiBeeID();
23
24
/*
25
 * FlexiPeeHP Classes accept this form of initial identifier:
26
 *
27
 * (int) 2588
28
 * (string) ext:ESHOP:oi1978
29
 * (array) ['varSym'=>'20080015']
30
 */
31
32
$invoice = new \FlexiPeeHP\FakturaVydana($invoiceID);
33
if ($invoice->sendByMail($recipient, 'Document sent by FlexiPeeHP ', 'Example How to sent document')) {
34
    $invoice->addStatusMessage(_('Invoice was sent'), 'success');
35
} else {
36
    $invoice->addStatusMessage(_('Mailer does not work'), 'warning');
37
}
38