Skip to content

Commit 36a7a7a

Browse files
committed
Folder delimiter check added #137
1 parent 40f9f94 commit 36a7a7a

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

src/IMAP/Folder.php

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,17 +111,17 @@ class Folder {
111111
*
112112
* @param \Webklex\IMAP\Client $client
113113
*
114-
* @param object $folder
114+
* @param object $structure
115115
*/
116-
public function __construct(Client $client, $folder) {
116+
public function __construct(Client $client, $structure) {
117117
$this->client = $client;
118118

119-
$this->delimiter = $folder->delimiter;
120-
$this->path = $folder->name;
121-
$this->fullName = $this->decodeName($folder->name);
119+
$this->setDelimiter($structure->delimiter);
120+
$this->path = $structure->name;
121+
$this->fullName = $this->decodeName($structure->name);
122122
$this->name = $this->getSimpleName($this->delimiter, $this->fullName);
123123

124-
$this->parseAttributes($folder->attributes);
124+
$this->parseAttributes($structure->attributes);
125125
}
126126

127127
/**
@@ -438,4 +438,15 @@ public function appendMessage($message, $options = null, $internal_date = null)
438438
public function getClient() {
439439
return $this->client;
440440
}
441+
442+
/**
443+
* @param $delimiter
444+
*/
445+
public function setDelimiter($delimiter){
446+
if(in_array($delimiter, [null, '', ' ', false]) === true) {
447+
$delimiter = config('imap.options.delimiter', '/');
448+
}
449+
450+
$this->delimiter = $delimiter;
451+
}
441452
}

0 commit comments

Comments
 (0)