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 namespace Livewire\Features\SupportFileDownloads; use PHPUnit\Framework\Assert as ..

Decoded Output download

<?php

namespace Livewire\Features\SupportFileDownloads;

use PHPUnit\Framework\Assert as PHPUnit;

trait TestsFileDownloads
{
    public function assertFileDownloaded($filename = null, $content = null, $contentType = null)
    {
        $downloadEffect = data_get($this->effects, 'download');

        if ($filename) {
            PHPUnit::assertEquals(
                $filename,
                data_get($downloadEffect, 'name')
            );
        } else {
            PHPUnit::assertNotNull($downloadEffect);
        }

        if ($content) {
            $downloadedContent = data_get($this->effects, 'download.content');

            PHPUnit::assertEquals(
                $content,
                base64_decode($downloadedContent)
            );
        }

        if ($contentType) {
            PHPUnit::assertEquals(
                $contentType,
                data_get($this->effects, 'download.contentType')
            );
        }

        return $this;
    }

    public function assertNoFileDownloaded()
    {
        $downloadEffect = data_get($this->effects, 'download');

        PHPUnit::assertNull($downloadEffect);

        return $this;
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php

namespace Livewire\Features\SupportFileDownloads;

use PHPUnit\Framework\Assert as PHPUnit;

trait TestsFileDownloads
{
    public function assertFileDownloaded($filename = null, $content = null, $contentType = null)
    {
        $downloadEffect = data_get($this->effects, 'download');

        if ($filename) {
            PHPUnit::assertEquals(
                $filename,
                data_get($downloadEffect, 'name')
            );
        } else {
            PHPUnit::assertNotNull($downloadEffect);
        }

        if ($content) {
            $downloadedContent = data_get($this->effects, 'download.content');

            PHPUnit::assertEquals(
                $content,
                base64_decode($downloadedContent)
            );
        }

        if ($contentType) {
            PHPUnit::assertEquals(
                $contentType,
                data_get($this->effects, 'download.contentType')
            );
        }

        return $this;
    }

    public function assertNoFileDownloaded()
    {
        $downloadEffect = data_get($this->effects, 'download');

        PHPUnit::assertNull($downloadEffect);

        return $this;
    }
}

Function Calls

None

Variables

None

Stats

MD5 7a3338ade7e6761725b2e29520362a5f
Eval Count 0
Decode Time 90 ms