Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Api/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ protected function setConfigs(array $configs): self
/**
* Set debug
*/
public function setDebug(bool $debug): self
public function setDebug(bool $debug = true): self
{
$this->debug = $debug;

Expand Down
8 changes: 5 additions & 3 deletions src/Support/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public function create(array $attributes): Model
*
* This is reset to false after the request
*/
public function debug(bool $debug = true): self
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get all of the changes, but this is a rename. What are your thoughts on that?

It was debug in the Builder as that class is more about the human-readable experience, so it has the default & is used as just $builder->debug() as it reads better. Under the hood, the client is setting debug true.

public function setDebug(bool $debug = true): self
{
$this->debug = $debug;

Expand Down Expand Up @@ -187,7 +187,7 @@ public function get(array|string $properties = ['*'], ?string $extra = null): Co
->only($properties)
->toArray()
)
->setClient($this->getClient()->setDebug(false)))
->setClient($this->getClient()->setDebug($this->debug)))
->setLinks($links)
->setPagination(count: $count, page: $page, pages: $pages, pageSize: $pageSize)
// If never a collection, only return the first
Expand Down Expand Up @@ -287,9 +287,11 @@ public function newInstance(): self
->setClass($this->class)
->setClient($this->getClient())
->setParent($this->parentModel)
->setDebug($this->debug)
: (new static())
->setClient($this->getClient())
->setParent($this->parentModel);
->setParent($this->parentModel)
->setDebug($this->debug);
}

/**
Expand Down