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
Unused Code
introduced
by
![]() |
|||||
20 | echo "Please enter $type ID:"; |
||||
21 | $input = fopen("php://stdin", "r"); |
||||
22 | $invoiceID = 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
![]() |
|||||
23 | 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
![]() |
|||||
24 | if (is_numeric($invoiceID)) { |
||||
25 | $invoiceID = intval($invoiceID); |
||||
26 | } |
||||
27 | return $invoiceID; |
||||
28 | } |
||||
29 |