Security update for Core, with self-updated composer
[yaffs-website] / web / core / modules / hal / src / Normalizer / NormalizerBase.php
index 43a5a07161f5d3db4387b73289557898a0575f1e..8b18985b8b46adc40593e6958159693fc85cac2a 100644 (file)
@@ -10,36 +10,22 @@ use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
  */
 abstract class NormalizerBase extends SerializationNormalizerBase implements DenormalizerInterface {
 
-  /**
-   * The formats that the Normalizer can handle.
-   *
-   * @var array
-   */
-  protected $formats = ['hal_json'];
-
   /**
    * {@inheritdoc}
    */
-  public function supportsNormalization($data, $format = NULL) {
-    return in_array($format, $this->formats) && parent::supportsNormalization($data, $format);
-  }
+  protected $format = ['hal_json'];
 
   /**
    * {@inheritdoc}
    */
-  public function supportsDenormalization($data, $type, $format = NULL) {
-    if (in_array($format, $this->formats) && (class_exists($this->supportedInterfaceOrClass) || interface_exists($this->supportedInterfaceOrClass))) {
-      $target = new \ReflectionClass($type);
-      $supported = new \ReflectionClass($this->supportedInterfaceOrClass);
-      if ($supported->isInterface()) {
-        return $target->implementsInterface($this->supportedInterfaceOrClass);
-      }
-      else {
-        return ($target->getName() == $this->supportedInterfaceOrClass || $target->isSubclassOf($this->supportedInterfaceOrClass));
-      }
+  protected function checkFormat($format = NULL) {
+    if (isset($this->formats)) {
+      @trigger_error('::formats is deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0. Use ::$format instead. See https://www.drupal.org/node/2868275', E_USER_DEPRECATED);
+
+      $this->format = $this->formats;
     }
 
-    return FALSE;
+    return parent::checkFormat($format);
   }
 
 }