original_string: public function getParentNode(MediaInterface $media) {
      if (!$media->hasField(self::MEDIA_OF_FIELD)) {
        return NULL;
      }
      $field = $media->get(self::MEDIA_OF_FIELD);
      if ($field->isEmpty()) {
        return NULL;
      }
      $parent = $field->first()
        ->get('entity')
        ->getTarget();
      if (!is_null($parent)) {
        return $parent->getValue();
      }
      return NULL;
    }
code: public function getParentNode(MediaInterface $media) {
      if (!$media->hasField(self::MEDIA_OF_FIELD)) {
        return NULL;
      }
      $field = $media->get(self::MEDIA_OF_FIELD);
      if ($field->isEmpty()) {
        return NULL;
      }
      $parent = $field->first()
        ->get('entity')
        ->getTarget();
      if (!is_null($parent)) {
        return $parent->getValue();
      }
      return NULL;
    }
code_tokens: public function getParentNode ( MediaInterface $ media ) { if ( ! $ media -> hasField ( self :: MEDIA_OF_FIELD ) ) { return NULL ; } $ field = $ media -> get ( self :: MEDIA_OF_FIELD ) ; if ( $ field -> isEmpty ( ) ) { return NULL ; } $ parent = $ field -> first ( ) -> get ( 'entity' ) -> getTarget ( ) ; if ( ! is_null ( $ parent ) ) { return $ parent -> getValue ( ) ; } return NULL ; }
docstring: Gets nodes that a media belongs to.
  
  @param \Drupal\media\MediaInterface $media
  The Media whose node you are searching for.
  
  @return \Drupal\node\NodeInterface
  Parent node.
  
  @throws \Drupal\Core\TypedData\Exception\MissingDataException
  Method $field->first() throws if data structure is unset and no item can
  be created.
docstring_tokens: Gets nodes that a media belongs to .