Autodetect the payload data type using content-type value.

@return string Return the name of the formatter class.
336957
public function getFormatClass($format = '')
    {
        if ( ! empty($format)) {
            return $this->processContentType($format);
        }

        if (isset($_SERVER['CONTENT_TYPE'])) {
            $type = $this->processContentType($_SERVER['CONTENT_TYPE']);
            if ($type !== false) {
                return $type;
            }
        }

        if (isset($_SERVER['HTTP_CONTENT_TYPE'])) {
            $type = $this->processContentType($_SERVER['HTTP_CONTENT_TYPE']);
            if ($type !== false) {
                return $type;
            }
        }

        return 'Nathanmac\Utilities\Parser\Formats\JSON';
    }
261270
public function getExtendedClassName()
    {
        if ($this->getExtendedClass() === null) {
            return '';
        }

        $name = str_replace('%', ' ', $this->getExtendedClass());
        $name = str_replace('.', ' ', $name);
        $name = str_replace(':', ' pseudo-class-', $name);
        return trim($name);
    }
142748
public function getPhpType()
    {
        if (isset(self::$_phpTypesByProtobufType[$this->getType()])) {
            return self::$_phpTypesByProtobufType[$this->getType()];
        } else {
            return null;
        }
    }
1002309
public function determine_format() {
        return new text_attribute(
            $this->get_name(),
            $this->get_value(),
            $this->get_label(),
            $this->is_disabled()
        );
    }
214335
function payload()
    {
        if ( $this->IsFault )
        {
            return json_encode( array(
                'content' => null,
                'error_text' => $this->FaultString() ) );
        }
        else
        {
            return json_encode( array(
                'content' => $this->Value,
                'error_text' => null ) );
        }
    }
304820
public function determineOutputType() : string
    {
        $contentType = $this->getContentType();
        // set default
        $type = self::TYPE_HTML;
        if (is_string($contentType) && trim($contentType) !== ''
            // use regex match parameter
            // sort by priority type
            && preg_match(
                '`
                    (?P<'.self::TYPE_JSON.'>\/ja?son|js)
                    | (?P<'.self::TYPE_PLAIN.'>plain)
                    | (?P<'.self::TYPE_XML.'>application\/xml)
                    | (?P<'.self::TYPE_HTML.'>\/html)
                  `xi',
                $contentType,
                $match
            ) && !empty($match)
        ) {
            foreach ($match as $key => $value) {
                // if key is string that must be output
                if ($value && is_string($key)) {
                    return $key;
                }
            }
        } // else using default self::TYPE_HTML

        return $type;
    }
1198208
public function getAlertMessageType()
    {
        // Obtain Base Alert Class:
        
        $classes = $this->styles('alert');
        
        // Determine Message Type:
        
        switch ($this->owner->MessageType) {
            case ValidationResult::TYPE_GOOD:
                $classes[] = $this->style('alert.success');
                break;
            case ValidationResult::TYPE_INFO:
                $classes[] = $this->style('alert.info');
                break;
            case ValidationResult::TYPE_ERROR:
                $classes[] = $this->style('alert.danger');
                break;
            default:
                $classes[] = $this->style('alert.warning');
        }
        
        // Answer Classes:
        
        return ViewTools::singleton()->array2att($classes);
    }
262580
public function getServerType()
    {
        $serverSoft = $_SERVER['SERVER_SOFTWARE'];

        preg_match('/^(.*?)\//i', $serverSoft, $match);
        if (empty($match[1])) {
            preg_match('/^(.*)\/?/i', $serverSoft, $match);
        }
        $serverName = strtolower( trim($match[1]) );

        return $serverName;
    }
243331
public function getContentType() {
		if (!isset($this->contentType)) {
			$numOfMatches = preg_match('/^([^;]*)/', $this->getHeader('Content-Type'), $matches);
			if ($numOfMatches) {
				$this->contentType = trim($matches[1]);
			} else {
				$this->contentType = '';
			}
		}
		return $this->contentType;
	}
770530
protected function payload()
    {
        $buffer = "";

        # Payload
        $buffer .= $this->message;
        Debug::Log(Debug::DEBUG, 'Message PUBLISH: Message='.$this->message);

        return  $buffer;
    }
270530
protected function _getType() {
        $className = strtolower(get_class($this));
        $classNameParts = explode('_', $className);
        $type = array_pop($classNameParts);
        if (array_key_exists($type, self::$_mapping)) {
            return self::$_mapping[$type];
        }
        return self::DEFAULT_TYPE;
    }
1268720
public function getFormat()
    {
        $result = null;

        foreach (static::$_formats as $value => $media_types)
        {
            $media_type = $this->getContentType();

            if (in_array($media_type, (array)$media_types))
            {
                $result = $value;
                break;
            }
        }

        return $result;
    }
978422
public function getDocumentType()
    {
        // if the type is defined use it else return the table name
        if (isset($this->documentType) and !empty($this->documentType)) {
            return $this->documentType;
        }

        return $this->getTable();
    }
455219
function getType()
    {
        if($this->_type) {
            return $this->_type;
        }
        else {
            $myclass = get_class($this);
            return strtolower(substr($myclass, strrpos($myclass, '\\') + 1, -5));
        }
    }
616831
public function getContentType()
		{

			foreach (self::$contentTypeMap as $ct => $type) {
				if ($type == $this->type) {
					return $ct;
				}
			}
			return false;

		}
1293838
private function getFormattedValue(): string
    {
        return (string) is_numeric($this->value) ?
            $this->value :
            sprintf('"%s"', $this->value);
    }
775048
private function getClassBody()
    {

        // sort the class components by their name
        $this->classComponents->sort(
            function( PhpClassComponent $a, PhpClassComponent $b ) {
                if ($a::SORT_ORDERING == $b::SORT_ORDERING) {
                    return $a->name < $b->name ? -1 : 1;
                }
                return ($a::SORT_ORDERING < $b::SORT_ORDERING) ? -1 : 1;
            }
        );

        $output = [];
        $lastType = null;
        $lastNumLines = null;
        foreach( $this->classComponents as $component ) {

            // manage strategy for adding new lines
            $componentAsLines = $component->content->toArray();
            if( !$lastType || !$component instanceof $lastType ) {
                $output[] = "\n";
            } elseif( count($componentAsLines) > 1 or $lastNumLines > 1 ) {
                $output[] = "\n";
            }
            $lastType = get_class( $component );
            $lastNumLines = count( $componentAsLines );

            // build the output;
            $output = array_merge( $output, $componentAsLines );

        }
        $output[] = "\n";
        return new Format( $output );

    }