code: public function getData($object)
      {
          if (!$this->validateObject($object)) {
              throw new InvalidArgumentException(
                  "Given object isn't instance of {$this->localName}"
              );
          }
          $reflection = new ReflectionObject($object);
          $data       = [];
          foreach (array_keys($this->properties) as $localProperty) {
              $property = $reflection->getProperty($localProperty);
              $property->setAccessible(true);
              $data[$localProperty] = $property->getValue($object);
          }
          return $data;
      }
docs: Extract values from a given object
  
  @param object $object
  
  @return array
  @throws InvalidArgumentException