Skip to content

Commit

Permalink
feat: add getters
Browse files Browse the repository at this point in the history
  • Loading branch information
martinalbert committed Oct 28, 2024
1 parent 2bce734 commit c6adb87
Show file tree
Hide file tree
Showing 3 changed files with 115 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/ButterCMS/Model/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,36 @@ class Page extends Model
protected $status;
protected $scheduled;

public function getSlug()
{
return $this->slug;
}

public function getPageType()
{
return $this->page_type;
}

public function getPublished()
{
return $this->published;
}

public function getUpdated()
{
return $this->updated;
}

public function getStatus()
{
return $this->status;
}

public function getScheduled()
{
return $this->scheduled;
}

public function getField($fieldName, $default = null)
{
return isset($this->fields[$fieldName]) ? $this->fields[$fieldName] : $default;
Expand Down
80 changes: 80 additions & 0 deletions src/ButterCMS/Model/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,86 @@ public function __construct(array $data)
parent::__construct($data);
}

public function getSlug()
{
return $this->slug;
}

public function getUrl()
{
return $this->url;
}

public function getPublished()
{
return $this->published;
}

public function getCreated()
{
return $this->created;
}

public function getStatus()
{
return $this->status;
}

public function getScheduled()
{
return $this->scheduled;
}

public function getTitle()
{
return $this->title;
}

public function getBody()
{
return $this->body;
}

public function getSummary()
{
return $this->summary;
}

public function getSeoTitle()
{
return $this->seo_title;
}

public function getMetaDescription()
{
return $this->meta_description;
}

public function getAuthor()
{
return $this->author;
}

public function getCategories()
{
return $this->categories;
}

public function getTags()
{
return $this->tags;
}

public function getFeaturedImage()
{
return $this->featured_image;
}

public function getFeaturedImageAlt()
{
return $this->featured_image_alt;
}

public function isPublished()
{
return 'published' === $this->status;
Expand Down
5 changes: 5 additions & 0 deletions src/ButterCMS/Model/PostResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,9 @@ public function __construct(array $dataArray)

parent::__construct($dataArray);
}

public function getPost()
{
return $this->post;
}
}

0 comments on commit c6adb87

Please sign in to comment.