-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implementing unset. #7
base: master
Are you sure you want to change the base?
Conversation
@@ -146,9 +146,17 @@ public function __set($path, $value) | |||
public function __isset($name) | |||
{ | |||
$notSmart = new JsonObject("{$this->data}"); | |||
return $notSmart->get($name) ? true : false; | |||
$thing = $notSmart->get($name); |
There was a problem hiding this comment.
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.
@@ -146,9 +146,17 @@ public function __set($path, $value) | |||
public function __isset($name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add documentation
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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?
} | ||
|
||
public function __unset($name) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add documentation
No description provided.