Skip to content

Commit

Permalink
Merge pull request #9 from NigelCunningham/master
Browse files Browse the repository at this point in the history
Provide a way to set and unset a dynamic property.
  • Loading branch information
josh-gaby authored Nov 5, 2024
2 parents 4982587 + dd55fb1 commit b7eca19
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Ratchet/Traits/DynamicPropertiesTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ trait DynamicPropertiesTrait
* @return void
*/
public function __set($key, $value) {
if (property_exists($this, $key)) {
$this->_dynamic_properties[$key] = $value;
}
$this->_dynamic_properties[$key] = $value;
}

/**
Expand All @@ -46,4 +44,8 @@ public function __get($key) {
public function __isset($key) {
return isset($this->_dynamic_properties[$key]);
}

public function __unset($key) {
unset($this->_dynamic_properties[$key]);
}
}

0 comments on commit b7eca19

Please sign in to comment.