<?phpnamespace App\Model;use App\Util\Api;class ImapDir implements \JsonSerializable{ private $parent; private $name; private $path; private $originalPath; // original path in UTF7-imap private $count; private $level; // level of dir in a structure (0 for children of INBOX) private $hasSubfolders; // if this folder has subfolders public function __construct() { $this->parent = ""; $this->name = ""; $this->path = ""; $this->originalPath = ""; $this->count = 0; $this->level = 0; $this->hasSubfolders = null; } /** * @return mixed */ public function getOriginalPath() { return $this->originalPath; } /** * @param mixed $originalPath */ public function setOriginalPath($originalPath) { $this->originalPath = $originalPath; } public function getParent(): ?string { return $this->parent; } public function setParent(string $name): self { $this->parent = $name; return $this; } public function getName(): ?string { return $this->name; } public function setName(string $name): self { $this->name = $name; return $this; } public function getPath() { return $this->path; } public function setPath($path) { $this->path = $path; return $this; } public function getCount(): ?int { return $this->count; } public function setCount(string $count): self { $this->count = $count; return $this; } public function getLevel(): ?int { return $this->level; } public function setLevel(string $level): self { $this->level = $level; return $this; } public function jsonSerialize() { $vars = get_object_vars($this); return $vars; } public static function cmpObjects($o1, $o2) { if(strcasecmp($o1->getParent(), $o2->getParent()) == 0) { return strcasecmp($o1->getName(), $o2->getName()); } else { return strcasecmp($o1->getParent(), $o2->getParent()); } } public function hasSubfolders() : bool { if($this->hasSubfolders == null) { return false; } return $this->hasSubfolders; } public function setHasSubfolders($val) { $this->hasSubfolders = $val; }}