code: private function createConfigItem($imageSize): PictureConfigurationItem
      {
          $configItem = new PictureConfigurationItem();
          $resizeConfig = new ResizeConfiguration();
  
          if (null !== $imageSize) {
              $resizeConfig
                  ->setWidth($imageSize->width)
                  ->setHeight($imageSize->height)
                  ->setMode($imageSize->resizeMode)
                  ->setZoomLevel($imageSize->zoom)
              ;
  
              $configItem
                  ->setResizeConfig($resizeConfig)
                  ->setSizes($imageSize->sizes)
                  ->setDensities($imageSize->densities)
              ;
  
              if (isset($imageSize->media)) {
                  $configItem->setMedia($imageSize->media);
              }
          }
  
          return $configItem;
      }
docs: Creates a picture configuration item.
  
  @param ImageSizeModel|ImageSizeItemModel|null $imageSize