Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php declare(strict_types=1); namespace Sabre\DAV\Xml; use PHPUnit\Framework\TestCase;..

Decoded Output download

<?php

declare(strict_types=1);

namespace Sabre\DAV\Xml;

use PHPUnit\Framework\TestCase;
use Sabre\Xml\Reader;
use Sabre\Xml\Writer;

abstract class AbstractXmlTestCase extends TestCase
{
    protected $elementMap = [];
    protected $namespaceMap = ['DAV:' => 'd'];
    protected $contextUri = '/';

    public function write($input)
    {
        $writer = new Writer();
        $writer->contextUri = $this->contextUri;
        $writer->namespaceMap = $this->namespaceMap;
        $writer->openMemory();
        $writer->setIndent(true);
        $writer->write($input);

        return $writer->outputMemory();
    }

    public function parse($xml, array $elementMap = [])
    {
        $reader = new Reader();
        $reader->contextUri = $this->contextUri;
        $reader->elementMap = array_merge($this->elementMap, $elementMap);
        $reader->xml($xml);

        return $reader->parse();
    }

    public function assertParsedValue($expected, $xml, array $elementMap = [])
    {
        $result = $this->parse($xml, $elementMap);
        self::assertEquals($expected, $result['value']);
    }

    public function cleanUp()
    {
        libxml_clear_errors();
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php

declare(strict_types=1);

namespace Sabre\DAV\Xml;

use PHPUnit\Framework\TestCase;
use Sabre\Xml\Reader;
use Sabre\Xml\Writer;

abstract class AbstractXmlTestCase extends TestCase
{
    protected $elementMap = [];
    protected $namespaceMap = ['DAV:' => 'd'];
    protected $contextUri = '/';

    public function write($input)
    {
        $writer = new Writer();
        $writer->contextUri = $this->contextUri;
        $writer->namespaceMap = $this->namespaceMap;
        $writer->openMemory();
        $writer->setIndent(true);
        $writer->write($input);

        return $writer->outputMemory();
    }

    public function parse($xml, array $elementMap = [])
    {
        $reader = new Reader();
        $reader->contextUri = $this->contextUri;
        $reader->elementMap = array_merge($this->elementMap, $elementMap);
        $reader->xml($xml);

        return $reader->parse();
    }

    public function assertParsedValue($expected, $xml, array $elementMap = [])
    {
        $result = $this->parse($xml, $elementMap);
        self::assertEquals($expected, $result['value']);
    }

    public function cleanUp()
    {
        libxml_clear_errors();
    }
}

Function Calls

None

Variables

None

Stats

MD5 4cb9dd10740ea645bca6d86cf5c3a2a6
Eval Count 0
Decode Time 93 ms