original_string: public function onVichUploaderPostUpload(Event $event)
      {
          $object = $event->getObject();
          $mapping = $event->getMapping();
  
          $absoluteDir = $mapping->getUploadDestination().'/'.$mapping->getUploadDir($object);
          $relativeDir = substr_replace($absoluteDir, '', 0, strlen($this->projectDir) + 1);
  
          $object->setRelativeDir($relativeDir);
  
          if (false !== strpos($object->getMimeType(), 'image/')) {
              $img = $mapping->getUploadDestination().'/'.$mapping->getUploadDir($object).'/'.$object->getMedia();
              $palette = Palette::fromFilename($img, Color::fromHexToInt('#FFFFFF'));
              $extractor = new ColorExtractor($palette);
              $colors = $extractor->extract();
              $object->setMainColor(Color::fromIntToHex($colors[0]));
  
              $this->generateCache('/'.$relativeDir.'/'.$object->getMedia());
          }
      }
code: public function onVichUploaderPostUpload(Event $event)
      {
          $object = $event->getObject();
          $mapping = $event->getMapping();
  
          $absoluteDir = $mapping->getUploadDestination().'/'.$mapping->getUploadDir($object);
          $relativeDir = substr_replace($absoluteDir, '', 0, strlen($this->projectDir) + 1);
  
          $object->setRelativeDir($relativeDir);
  
          if (false !== strpos($object->getMimeType(), 'image/')) {
              $img = $mapping->getUploadDestination().'/'.$mapping->getUploadDir($object).'/'.$object->getMedia();
              $palette = Palette::fromFilename($img, Color::fromHexToInt('#FFFFFF'));
              $extractor = new ColorExtractor($palette);
              $colors = $extractor->extract();
              $object->setMainColor(Color::fromIntToHex($colors[0]));
  
              $this->generateCache('/'.$relativeDir.'/'.$object->getMedia());
          }
      }
code_tokens: public function onVichUploaderPostUpload ( Event $ event ) { $ object = $ event -> getObject ( ) ; $ mapping = $ event -> getMapping ( ) ; $ absoluteDir = $ mapping -> getUploadDestination ( ) . '/' . $ mapping -> getUploadDir ( $ object ) ; $ relativeDir = substr_replace ( $ absoluteDir , '' , 0 , strlen ( $ this -> projectDir ) + 1 ) ; $ object -> setRelativeDir ( $ relativeDir ) ; if ( false !== strpos ( $ object -> getMimeType ( ) , 'image/' ) ) { $ img = $ mapping -> getUploadDestination ( ) . '/' . $ mapping -> getUploadDir ( $ object ) . '/' . $ object -> getMedia ( ) ; $ palette = Palette :: fromFilename ( $ img , Color :: fromHexToInt ( '#FFFFFF' ) ) ; $ extractor = new ColorExtractor ( $ palette ) ; $ colors = $ extractor -> extract ( ) ; $ object -> setMainColor ( Color :: fromIntToHex ( $ colors [ 0 ] ) ) ; $ this -> generateCache ( '/' . $ relativeDir . '/' . $ object -> getMedia ( ) ) ; } }
docstring: Update RelativeDir.
docstring_tokens: Update RelativeDir .