CoreFiles by mySites.guru
NullObject.php54 lines, 1,312 bytes, from Joomla_4.2.2-Stable-Full_Package.zip
Raw History Compare with 4.2.1
md5
6fdf67c6aee4e5248471f6fb07b83a71
sha1
bf3e312736d96bf85576791454898fd64815c0d6
sha256
8254eb5176bfd522ae59a0e0bf94fc6ebf79026cda20d289f561da03e063e8fe
<?php
/*
 * This file is part of the PHPASN1 library.
 *
 * Copyright © Friedrich Große <[email protected]>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace FG\ASN1\Universal;

use FG\ASN1\ASNObject;
use FG\ASN1\Parsable;
use FG\ASN1\Identifier;
use FG\ASN1\Exception\ParserException;

class NullObject extends ASNObject implements Parsable
{
    public function getType()
    {
        return Identifier::NULL;
    }

    protected function calculateContentLength()
    {
        return 0;
    }

    protected function getEncodedValue()
    {
        return null;
    }

    public function getContent()
    {
        return 'NULL';
    }

    public static function fromBinary(&$binaryData, &$offsetIndex = 0)
    {
        self::parseIdentifier($binaryData[$offsetIndex], Identifier::NULL, $offsetIndex++);
        $contentLength = self::parseContentLength($binaryData, $offsetIndex);

        if ($contentLength != 0) {
            throw new ParserException("An ASN.1 Null should not have a length other than zero. Extracted length was {$contentLength}", $offsetIndex);
        }

        $parsedObject = new self();
        $parsedObject->setContentLength(0);

        return $parsedObject;
    }
}

The same content is in 137 releases, Joomla 4.0.0-beta to 5.0.0-beta2. See them all, or every version of this file.