1 | <?php |
||
2 | |||
3 | /** |
||
4 | * VCard generator test - can save to file or output as a download |
||
5 | */ |
||
6 | |||
7 | require_once __DIR__ . '/../vendor/autoload.php'; |
||
8 | require_once __DIR__ . '/../src/VCard.php'; |
||
9 | |||
10 | use JeroenDesloovere\VCard\VCard; |
||
11 | |||
12 | // define vcard |
||
13 | $vcard = new VCard(); |
||
14 | |||
15 | // define variables |
||
16 | $firstname = 'Jeroen'; |
||
17 | $lastname = 'Desloovere'; |
||
18 | $additional = ''; |
||
19 | $prefix = ''; |
||
20 | $suffix = ''; |
||
21 | |||
22 | // add personal data |
||
23 | $vcard->addName($lastname, $firstname, $additional, $prefix, $suffix); |
||
24 | |||
25 | // add work data |
||
26 | $vcard->addCompany('Siesqo'); |
||
27 | $vcard->addJobtitle('Web Developer'); |
||
28 | $vcard->addEmail('[email protected]'); |
||
29 | $vcard->addPhoneNumber(1234121212, 'PREF;WORK'); |
||
30 | $vcard->addPhoneNumber(123456789, 'WORK'); |
||
31 | $vcard->addAddress(null, null, 'street', 'worktown', null, 'workpostcode', 'Belgium'); |
||
32 | $vcard->addURL('http://www.jeroendesloovere.be'); |
||
33 | |||
34 | $vcard->addPhoto(__DIR__ . '/assets/landscape.jpeg'); |
||
35 | //$vcard->addPhoto('https://raw.githubusercontent.com/jeroendesloovere/vcard/master/tests/image.jpg'); |
||
0 ignored issues
–
show
|
|||
36 | |||
37 | // return vcard as a string |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
43% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
38 | //return $vcard->getOutput(); |
||
39 | |||
40 | // return vcard as a download |
||
41 | return $vcard->download(); |
||
0 ignored issues
–
show
Are you sure the usage of
$vcard->download() targeting JeroenDesloovere\VCard\VCard::download() seems to always return null.
This check looks for function or method calls that always return null and whose return value is used. class A
{
function getObject()
{
return null;
}
}
$a = new A();
if ($a->getObject()) {
The method The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes. ![]() |
|||
42 | |||
43 | // echo message |
||
44 | echo 'A personal vCard is saved in this folder: ' . __DIR__; |
||
45 | |||
46 | // or |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
50% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
47 | |||
48 | // save the card in file in the current folder |
||
49 | // return $vcard->save(); |
||
50 | |||
51 | // echo message |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
36% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
52 | // echo 'A personal vCard is saved in this folder: ' . __DIR__; |
||
53 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.