Guest User

Untitled

a guest
Mar 24th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. public function toArray()
  2. {
  3. $reflectionClass = new \ReflectionClass(get_class($this));
  4. $array = [];
  5. foreach ($reflectionClass->getProperties() as $property) {
  6. $property->setAccessible(true);
  7. $array[$property->getName()] = $property->getValue($this);
  8. $property->setAccessible(false);
  9. }
  10.  
  11. return $array;
  12. }
Add Comment
Please, Sign In to add comment