isPublished = FALSE; return $this; } public function isPublished(): self { $this->isPublished = TRUE; return $this; } public function setCreatedDate(string $time = 'now'): self { $this->created = new DrupalDateTime($time); return $this; } public function setTitle(string $title): self { $this->title = $title; return $this; } public function getPost(): NodeInterface { $post = Node::create([ 'status' => $this->isPublished, 'title' => $this->title, 'type' => 'post', ]); if ($this->created !== NULL) { $post->setCreatedTime($this->created->getTimestamp()); } $post->save(); return $post; } }