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 Rx\Disposable; use RuntimeException; use Rx\DisposableInterface; class ..

Decoded Output download

<?php

namespace Rx\Disposable;

use RuntimeException;
use Rx\DisposableInterface;

class SingleAssignmentDisposable implements DisposableInterface
{
    private $current;
    private $isDisposed = false;

    public function dispose()
    {
        $old = null;

        if (!$this->isDisposed) {
            $this->isDisposed = true;
            $old              = $this->current;
            $this->current    = null;
        }

        if ($old) {
            $old->dispose();
        }
    }

    public function setDisposable(DisposableInterface $disposable = null)
    {
        if ($this->current) {
            throw new RuntimeException('Disposable has already been assigned.');
        }

        if (!$this->isDisposed) {
            $this->current = $disposable;
        }

        if ($this->isDisposed && $disposable) {
            $disposable->dispose();
        }
    }

    public function getDisposable()
    {
        return $this->current;
    }

    public function isDisposed()
    {
        return $this->isDisposed;
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php

namespace Rx\Disposable;

use RuntimeException;
use Rx\DisposableInterface;

class SingleAssignmentDisposable implements DisposableInterface
{
    private $current;
    private $isDisposed = false;

    public function dispose()
    {
        $old = null;

        if (!$this->isDisposed) {
            $this->isDisposed = true;
            $old              = $this->current;
            $this->current    = null;
        }

        if ($old) {
            $old->dispose();
        }
    }

    public function setDisposable(DisposableInterface $disposable = null)
    {
        if ($this->current) {
            throw new RuntimeException('Disposable has already been assigned.');
        }

        if (!$this->isDisposed) {
            $this->current = $disposable;
        }

        if ($this->isDisposed && $disposable) {
            $disposable->dispose();
        }
    }

    public function getDisposable()
    {
        return $this->current;
    }

    public function isDisposed()
    {
        return $this->isDisposed;
    }
}

Function Calls

None

Variables

None

Stats

MD5 a7aa1ad67d370dc59cb730a597edc2ff
Eval Count 0
Decode Time 97 ms