original_string: protected function getAttributes($object, $format = null, array $context)
      {
          $class = $this->objectClassResolver ? ($this->objectClassResolver)($object) : \get_class($object);
          $key = $class.'-'.$context['cache_key'];
  
          if (isset($this->attributesCache[$key])) {
              return $this->attributesCache[$key];
          }
  
          $allowedAttributes = $this->getAllowedAttributes($object, $context, true);
  
          if (false !== $allowedAttributes) {
              if ($context['cache_key']) {
                  $this->attributesCache[$key] = $allowedAttributes;
              }
  
              return $allowedAttributes;
          }
  
          $attributes = $this->extractAttributes($object, $format, $context);
  
          if ($this->classDiscriminatorResolver && $mapping = $this->classDiscriminatorResolver->getMappingForMappedObject($object)) {
              array_unshift($attributes, $mapping->getTypeProperty());
          }
  
          if ($context['cache_key']) {
              $this->attributesCache[$key] = $attributes;
          }
  
          return $attributes;
      }
code: protected function getAttributes($object, $format = null, array $context)
      {
          $class = $this->objectClassResolver ? ($this->objectClassResolver)($object) : \get_class($object);
          $key = $class.'-'.$context['cache_key'];
  
          if (isset($this->attributesCache[$key])) {
              return $this->attributesCache[$key];
          }
  
          $allowedAttributes = $this->getAllowedAttributes($object, $context, true);
  
          if (false !== $allowedAttributes) {
              if ($context['cache_key']) {
                  $this->attributesCache[$key] = $allowedAttributes;
              }
  
              return $allowedAttributes;
          }
  
          $attributes = $this->extractAttributes($object, $format, $context);
  
          if ($this->classDiscriminatorResolver && $mapping = $this->classDiscriminatorResolver->getMappingForMappedObject($object)) {
              array_unshift($attributes, $mapping->getTypeProperty());
          }
  
          if ($context['cache_key']) {
              $this->attributesCache[$key] = $attributes;
          }
  
          return $attributes;
      }
code_tokens: protected function getAttributes ( $ object , $ format = null , array $ context ) { $ class = $ this -> objectClassResolver ? ( $ this -> objectClassResolver ) ( $ object ) : \ get_class ( $ object ) ; $ key = $ class . '-' . $ context [ 'cache_key' ] ; if ( isset ( $ this -> attributesCache [ $ key ] ) ) { return $ this -> attributesCache [ $ key ] ; } $ allowedAttributes = $ this -> getAllowedAttributes ( $ object , $ context , true ) ; if ( false !== $ allowedAttributes ) { if ( $ context [ 'cache_key' ] ) { $ this -> attributesCache [ $ key ] = $ allowedAttributes ; } return $ allowedAttributes ; } $ attributes = $ this -> extractAttributes ( $ object , $ format , $ context ) ; if ( $ this -> classDiscriminatorResolver && $ mapping = $ this -> classDiscriminatorResolver -> getMappingForMappedObject ( $ object ) ) { array_unshift ( $ attributes , $ mapping -> getTypeProperty ( ) ) ; } if ( $ context [ 'cache_key' ] ) { $ this -> attributesCache [ $ key ] = $ attributes ; } return $ attributes ; }
docstring: Gets and caches attributes for the given object, format and context.
  
  @param object      $object
  @param string|null $format
  @param array       $context
  
  @return string[]
docstring_tokens: Gets and caches attributes for the given object format and context .