Issues (28)

examples/example.php (1 issue)

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');
36
37
// return vcard as a string
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 getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
42
43
// echo message
44
echo 'A personal vCard is saved in this folder: ' . __DIR__;
45
46
// or
47
48
// save the card in file in the current folder
49
// return $vcard->save();
50
51
// echo message
52
// echo 'A personal vCard is saved in this folder: ' . __DIR__;
53