public function getField($key)
    {
        if (property_exists($this, $key)) {
            if (in_array($key, self::$ARRAY_TYPES)) {
                if (!is_string($this->$key)) {
                    return;
                }

                return json_decode($this->$key, true);
            }

            return $this->$key;
        }

        $array = $this->getData();

        if (isset($array[$key])) {
            return $array[$key];
        }
    }
public function getField($key)
    {
        if (property_exists($this, $key)) {
            if (in_array($key, self::$ARRAY_TYPES)) {
                if (!is_string($this->$key)) {
                    return;
                }

                return json_decode($this->$key, true);
            }

            return $this->$key;
        }

        $array = $this->getData();

        if (isset($array[$key])) {
            return $array[$key];
        }
    }
public function getField ( $ key ) { if ( property_exists ( $ this , $ key ) ) { if ( in_array ( $ key , self :: $ ARRAY_TYPES ) ) { if ( ! is_string ( $ this -> $ key ) ) { return ; } return json_decode ( $ this -> $ key , true ) ; } return $ this -> $ key ; } $ array = $ this -> getData ( ) ; if ( isset ( $ array [ $ key ] ) ) { return $ array [ $ key ] ; } }
Get field.

@param string $key

@return string|array
Get field .