Issues (103)

Examples/common.php (1 issue)

1
<?php
2
/**
3
 * FlexiPeeHP - Shared functions
4
 *
5
 * @author     Vítězslav Dvořák <[email protected]>
6
 * @copyright  (G) 2017 Vitex Software
7
 */
8
9
namespace Example\FlexiPeeHP;
10
11
/**
12
 * Ask For Invoice ID
13
 *
14
 * @param string $type Requested type for documents
15
 * @return int|string id or code
16
 */
17
function askForFlexiBeeID($type = 'invoice')
18
{
19
    $invoiceID = null;
0 ignored issues
show
The assignment to $invoiceID is dead and can be removed.
Loading history...
20
    echo "Please enter $type ID:";
21
    $input     = fopen("php://stdin", "r");
22
    $invoiceID = trim(fgets($input));
23
    fclose($input);
24
    if (is_numeric($invoiceID)) {
25
        $invoiceID = intval($invoiceID);
26
    }
27
    return $invoiceID;
28
}
29