path = \rtrim($path, '/\\'); $this->name = \basename($path); $this->createdAt = new \DateTimeImmutable('now'); $this->changedAt = new \DateTime('now'); } /** * {@inheritdoc} */ public function getCount(bool $recursive = true) : int { return $this->count; } /** * {@inheritdoc} */ public function getSize(bool $recursive = true) : int { return $this->size; } /** * {@inheritdoc} */ public function getName() : string { return $this->name; } /** * {@inheritdoc} */ public function getBasename() : string { return \basename($this->path); } /** * {@inheritdoc} */ public function getPath() : string { return $this->path; } /** * {@inheritdoc} */ public function getCreatedAt() : \DateTimeImmutable { return $this->createdAt; } /** * {@inheritdoc} */ public function getChangedAt() : \DateTime { return $this->changedAt; } /** * {@inheritdoc} */ public function getOwner() : string { return $this->owner; } /** * {@inheritdoc} */ public function getPermission() : int { return $this->permission; } /** * {@inheritdoc} */ public function index() : void { if ($this->con === null) { return; } $mtime = \ftp_mdtm($this->con, $this->path); $ctime = \ftp_mdtm($this->con, $this->path); $this->createdAt = (new \DateTimeImmutable())->setTimestamp($mtime === false ? 0 : $mtime); $this->changedAt->setTimestamp($ctime === false ? 0 : $ctime); $this->owner = ''; $this->permission = 0; $this->isInitialized = true; } }