From f5b9872f8e955d4ecf9ee2532b6402f5b18e4fcb Mon Sep 17 00:00:00 2001 From: David Meier Date: Tue, 19 Jun 2018 12:02:16 +0200 Subject: [PATCH 1/2] header need $key and $value --- src/Formatter/Formatter.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Formatter/Formatter.php b/src/Formatter/Formatter.php index a379fb1..14c0167 100644 --- a/src/Formatter/Formatter.php +++ b/src/Formatter/Formatter.php @@ -36,8 +36,8 @@ public function addVCard(VCard $vCard): self public function download(): void { - foreach ($this->getHeaders() as $header) { - header($header); + foreach ($this->getHeaders() as $key => $value) { + header(sprintf("%s: %s", $key, $value)); } echo $this->getContent(); From e846c1c1551910ff35ea6374c2f8f1d2292e0bd8 Mon Sep 17 00:00:00 2001 From: David Meier Date: Tue, 19 Jun 2018 12:13:22 +0200 Subject: [PATCH 2/2] add Role Property --- src/Formatter/Property/RoleFormatter.php | 10 +++++++ src/Parser/Property/RoleParser.php | 16 +++++++++++ src/Property/Role.php | 34 ++++++++++++++++++++++++ src/VCard.php | 2 ++ tests/VCardTest.php | 5 +++- 5 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 src/Formatter/Property/RoleFormatter.php create mode 100644 src/Parser/Property/RoleParser.php create mode 100644 src/Property/Role.php diff --git a/src/Formatter/Property/RoleFormatter.php b/src/Formatter/Property/RoleFormatter.php new file mode 100644 index 0000000..a72d0cb --- /dev/null +++ b/src/Formatter/Property/RoleFormatter.php @@ -0,0 +1,10 @@ +thirdVCard = (new VCard(Kind::organization())) ->add(new Title('Apple')) + ->add(new Role('Fruit')) ->add(new Photo(__DIR__ . '/assets/landscape.jpeg')) ->add(new Logo(__DIR__ . '/assets/landscape.jpeg')) ->add(new Telephone('+32 486 00 00 00')); @@ -186,8 +188,9 @@ public function testVCardGetProperties(): void $this->assertCount(1, $this->secondVCard->getProperties(Name::class)); $this->assertCount(1, $this->secondVCard->getProperties(Address::class)); - $this->assertCount(4, $this->thirdVCard->getProperties()); + $this->assertCount(5, $this->thirdVCard->getProperties()); $this->assertCount(1, $this->thirdVCard->getProperties(Title::class)); + $this->assertCount(1, $this->thirdVCard->getProperties(Role::class)); $this->assertCount(1, $this->thirdVCard->getProperties(Photo::class)); $this->assertCount(1, $this->thirdVCard->getProperties(Logo::class)); $this->assertCount(1, $this->thirdVCard->getProperties(Telephone::class));