src/Annotations/Discriminator.php
public function getClass(array $data)
    {
        if (!array_key_exists($this->field, $data)) {
            return $this->map[$this->getDefault()];
        }

        $type = $data[$this->field];

        // fallback to default if type not found in map
        if (!isset($this->map[$type])) {
            $type = $this->getDefault();
        }

        return $this->map[$type];
    }
public function getClass(array $data)
    {
        if (!array_key_exists($this->field, $data)) {
            return $this->map[$this->getDefault()];
        }

        $type = $data[$this->field];

        // fallback to default if type not found in map
        if (!isset($this->map[$type])) {
            $type = $this->getDefault();
        }

        return $this->map[$type];
    }
public function getClass ( array $ data ) { if ( ! array_key_exists ( $ this -> field , $ data ) ) { return $ this -> map [ $ this -> getDefault ( ) ] ; } $ type = $ data [ $ this -> field ] ; // fallback to default if type not found in map if ( ! isset ( $ this -> map [ $ type ] ) ) { $ type = $ this -> getDefault ( ) ; } return $ this -> map [ $ type ] ; }
Return the correct mapped class

@param array $data
@return mixed
Return the correct mapped class