Skip to content

Commit 2025d1a

Browse files
authored
Merge pull request #1 from khorsky/php72-compatibility
fix PHP 7.2+ compatibility
2 parents ba7cd0b + b2ee695 commit 2025d1a

7 files changed

Lines changed: 34 additions & 34 deletions

File tree

src/MAPI/Item/Attachment.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
namespace Hfig\MAPI\Item;
44

5-
abstract class Attachment extends Object
5+
abstract class Attachment extends MapiObject
66
{
77
protected $embedded_msg = null;
8-
protected $embeded_ole = null;
8+
protected $embedded_ole = null;
99

1010
public function getFilename()
1111
{
@@ -14,7 +14,7 @@ public function getFilename()
1414

1515
public function getData()
1616
{
17-
return $this->embedded_msg ?? $this->embeded_ole ?? $this->properties['attach_data'] ?? null;
17+
return $this->embedded_msg ?? $this->embedded_ole ?? $this->properties['attach_data'] ?? null;
1818
}
1919

2020
public function copyToStream($stream)
@@ -30,7 +30,7 @@ protected function storeEmbeddedOle($stream)
3030
// this is very untested...
3131
//throw new \RuntimeException('Saving an OLE Compound Document is not supported');
3232

33-
$this->embeded_ole->saveToStream($stream);
33+
$this->embedded_ole->saveToStream($stream);
3434
}
3535

3636

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
<?php
2-
3-
namespace Hfig\MAPI\Item;
4-
5-
class Object
6-
{
7-
protected $properties;
8-
9-
public function __construct($properties)
10-
{
11-
$this->properties = $properties;
12-
}
13-
14-
1+
<?php
2+
3+
namespace Hfig\MAPI\Item;
4+
5+
class MapiObject
6+
{
7+
protected $properties;
8+
9+
public function __construct($properties)
10+
{
11+
$this->properties = $properties;
12+
}
13+
14+
1515
}

src/MAPI/Item/Message.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
//# IMessage essentially, but there's also stuff like IMAPIFolder etc. so, for this to form
66
//# basis for PST Item, it'd need to be more general.
77

8-
abstract class Message extends Object
8+
abstract class Message extends MapiObject
99
{
1010
abstract public function getAttachments();
1111
abstract public function getRecipients();

src/MAPI/Item/Recipient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Hfig\MAPI\Item;
44

5-
class Recipient extends Object
5+
class Recipient extends MapiObject
66
{
77
const RECIPIENT_TYPES = [
88
0 => 'From',

src/MAPI/Message/Attachment.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,16 @@ class Attachment extends AttachmentItem
2020
/** @var PropertySet */
2121
protected $properties;
2222

23-
protected $embeded_ole_type;
23+
protected $embedded_ole_type;
2424

2525
public function __construct(Element $obj, Message $parent)
2626
{
2727
$this->obj = $obj;
2828
$this->parent = $parent;
2929

3030
$this->embedded_msg = null;
31-
$this->embeded_ole = null;
32-
$this->embeded_ole_type = '';
31+
$this->embedded_ole = null;
32+
$this->embedded_ole_type = '';
3333

3434
$this->properties = new PropertySet(
3535
new PropertyStore($obj, $parent->getNameId())
@@ -42,17 +42,17 @@ public function __construct(Element $obj, Message $parent)
4242
if ($child->isDirectory() && preg_match(PropertyStore::SUBSTG_RX, $child->getName(), $matches)) {
4343
// magic numbers??
4444
if ($matches[1] == '3701' && strtolower($matches[2]) == '000d') {
45-
$this->embeded_ole = $child;
45+
$this->embedded_ole = $child;
4646
}
4747
}
4848

4949
}
5050

51-
if ($this->embeded_ole) {
51+
if ($this->embedded_ole) {
5252
$type = $this->checkEmbeddedOleType();
5353
if ($type == 'Microsoft Office Outlook Message') {
54-
$this->embedded_msg = new Message($this->embeded_ole, $parent);
55-
}
54+
$this->embedded_msg = new Message($this->embedded_ole, $parent);
55+
}
5656
}
5757

5858
}
@@ -62,7 +62,7 @@ protected function checkEmbeddedOleType()
6262
$found = 0;
6363
$type = null;
6464

65-
foreach ($this->embeded_ole->getChildren() as $child) {
65+
foreach ($this->embedded_ole->getChildren() as $child) {
6666
if (preg_match('/__(substg|properties|recip|attach|nameid)/', $child->getName())) {
6767
$found++;
6868
if ($found > 2) break;
@@ -73,7 +73,7 @@ protected function checkEmbeddedOleType()
7373
}
7474

7575
if ($type) {
76-
$this->embeded_ole_type = $type;
76+
$this->embedded_ole_type = $type;
7777
}
7878

7979
return $type;
@@ -82,9 +82,9 @@ protected function checkEmbeddedOleType()
8282

8383
public function getMimeType()
8484
{
85-
86-
$mime = $this->properties['attach_mime_tag'] ?? $this->embeded_ole_type;
87-
if (!$mime) {
85+
86+
$mime = $this->properties['attach_mime_tag'] ?? $this->embedded_ole_type;
87+
if (!$mime) {
8888
$mime = 'application/octet-stream';
8989
}
9090

src/MAPI/Message/Message.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public function getBodyHTML()
160160

161161
if (!$this->bodyHTML) {
162162
//jstewmc/rtf
163-
throw new \Exception('No HTML or Embeded RTF body. Convert from RTF not implemented');
163+
throw new \Exception('No HTML or Embedded RTF body. Convert from RTF not implemented');
164164
}
165165
}
166166

src/MAPI/Mime/Swiftmailer/Attachment.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function toMime()
4949
Message::wrap($this->embedded_msg)->toMime()
5050
);
5151
}
52-
elseif ($this->embeded_ole) {
52+
elseif ($this->embedded_ole) {
5353
// in practice this scenario doesn't seem to occur
5454
// MS Office documents are attached as files not
5555
// embedded ole objects

0 commit comments

Comments
 (0)