original_string: protected function getDocumentData($document)
      {
          if (is_array($document)) {
              $data = $document;
          } elseif ($document instanceof AbstractDocument) {
              $reflectionClass = new \ReflectionClass($document);
              $documentProperty = $reflectionClass->getParentClass()->getProperty('document');
              $documentProperty->setAccessible(true);
              $data = $documentProperty->getValue($document);
              foreach ($data as $key => &$value) {
                  if ($value instanceof DocumentSerializableInterface) {
                      $value = $value->documentSerialize()->jsonSerialize();
                  }
              }
          } else {
              throw new \Exception('Invalid data type, array or AbstractDocument expected');
          }
  
          return $data;
      }
code: protected function getDocumentData($document)
      {
          if (is_array($document)) {
              $data = $document;
          } elseif ($document instanceof AbstractDocument) {
              $reflectionClass = new \ReflectionClass($document);
              $documentProperty = $reflectionClass->getParentClass()->getProperty('document');
              $documentProperty->setAccessible(true);
              $data = $documentProperty->getValue($document);
              foreach ($data as $key => &$value) {
                  if ($value instanceof DocumentSerializableInterface) {
                      $value = $value->documentSerialize()->jsonSerialize();
                  }
              }
          } else {
              throw new \Exception('Invalid data type, array or AbstractDocument expected');
          }
  
          return $data;
      }
code_tokens: protected function getDocumentData ( $ document ) { if ( is_array ( $ document ) ) { $ data = $ document ; } elseif ( $ document instanceof AbstractDocument ) { $ reflectionClass = new \ ReflectionClass ( $ document ) ; $ documentProperty = $ reflectionClass -> getParentClass ( ) -> getProperty ( 'document' ) ; $ documentProperty -> setAccessible ( true ) ; $ data = $ documentProperty -> getValue ( $ document ) ; foreach ( $ data as $ key => & $ value ) { if ( $ value instanceof DocumentSerializableInterface ) { $ value = $ value -> documentSerialize ( ) -> jsonSerialize ( ) ; } } } else { throw new \ Exception ( 'Invalid data type, array or AbstractDocument expected' ) ; } return $ data ; }
docstring: Gets document data
  
  @param $document
  
  @return mixed
  
  @throws \Exception
docstring_tokens: Gets document data