path = rtrim($path, '/\\'); $this->name = basename($path); $this->createdAt = new \DateTime('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 getPath() : string { return $this->path; } /** * {@inheritdoc} */ public function parentNode() : Directory { return new Directory(Directory::parent($this->path)); } /** * {@inheritdoc} */ public function getCreatedAt() : \DateTime { return $this->createdAt; } /** * {@inheritdoc} */ public function getChangedAt() : \DateTime { return $this->changedAt; } /** * {@inheritdoc} */ public function getOwner() : int { return $this->owner; } /** * {@inheritdoc} */ public function getPermission() : string { return $this->permission; } /** * {@inheritdoc} */ public function index() /* : void */ { $this->createdAt->setTimestamp(filemtime($this->path)); $this->changedAt->setTimestamp(filectime($this->path)); $this->owner = fileowner($this->path); $this->permission = (int) substr(sprintf('%o', fileperms($this->path)), -4); } }