CoreFiles by mySites.guru
Accept.php46 lines, 825 bytes, from Joomla_6.2.1-Stable-Full_Package.zip
Raw History Compare with 6.2.0
md5
2c04bdb24ef50913603dcdf48cf2b056
sha1
422a0320806d512e681d9fc27f02221ce040f554
sha256
018150678672c6c845a4968a7bf9f0376303a89699d08552390b5293ca2286cd
<?php

namespace Negotiation;

use Negotiation\Exception\InvalidMediaType;

final class Accept extends BaseAccept implements AcceptHeader
{
    private $basePart;

    private $subPart;

    public function __construct($value)
    {
        parent::__construct($value);

        if ($this->type === '*') {
            $this->type = '*/*';
        }

        $parts = explode('/', $this->type);

        if (count($parts) !== 2 || !$parts[0] || !$parts[1]) {
            throw new InvalidMediaType();
        }

        $this->basePart = $parts[0];
        $this->subPart  = $parts[1];
    }

    /**
     * @return string
     */
    public function getSubPart()
    {
        return $this->subPart;
    }

    /**
     * @return string
     */
    public function getBasePart()
    {
        return $this->basePart;
    }
}

The same content is in 295 releases, Joomla 4.0.0-alpha7 to 6.3.0-alpha1. See them all, or every version of this file.