Skip to content

Conversation

@fmizzell
Copy link
Contributor

@fmizzell fmizzell commented Dec 2, 2020

No description provided.

@dafeder dafeder self-assigned this Dec 2, 2020
@dafeder dafeder self-requested a review December 2, 2020 04:07
{
$notSmart = new JsonObject("{$this->data}");
return $notSmart->get($name) ? true : false;
$thing = $notSmart->get($name);
Copy link
Member

Choose a reason for hiding this comment

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

Let's avoid variable names this unnecessarily vague - can we call this $value or $result? Aside from that though, I'm not sure why this is an improvement? When not using smartget, we should always get either an array or false, so I'm not clear on what edge case we're addressing here.

return $this->data->set($path, $value);
}

public function __isset($name)
Copy link
Member

Choose a reason for hiding this comment

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

Add documentation

Copy link
Member

Choose a reason for hiding this comment

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

Oh my bad, that's from my pull request! I guess I should add that in a separate PR

public function __unset($name)
{
$field = str_replace('$.', '', $name);
$this->data->remove('$', $field);
Copy link
Member

Choose a reason for hiding this comment

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

Would this work one or more levels down?

return ($thing === false) ? false : true;
}

public function __unset($name)
Copy link
Member

Choose a reason for hiding this comment

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

Seems like both here and in my __isset() method $path would be a more appropriate name than $name, doesn't it?

Copy link
Member

Choose a reason for hiding this comment

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

Add documentation

@dafeder dafeder assigned fmizzell and unassigned dafeder Dec 2, 2020
@dafeder dafeder marked this pull request as draft December 3, 2020 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants