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 Rx\DisposableInterface; /** * Class SerialDisposabl..

Decoded Output download

<?php

namespace Rx\Disposable;

use Rx\DisposableInterface;

/**
 * Class SerialDisposable
 * @package Rx\Disposable
 */
class SerialDisposable implements DisposableInterface
{
    /** @var bool */
    private $isDisposed = false;

    /** @var DisposableInterface */
    private $disposable = null;

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

        $this->isDisposed = true;
        $old              = $this->disposable;
        $this->disposable = null;

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

    /**
     * @return DisposableInterface
     */
    public function getDisposable()
    {
        return $this->disposable;
    }

    /**
     * @param DisposableInterface $disposable
     */
    public function setDisposable(DisposableInterface $disposable)
    {
        $shouldDispose = $this->isDisposed;

        if (!$shouldDispose) {

            $old              = $this->disposable;
            $this->disposable = $disposable;

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

        if ($shouldDispose) {
            $disposable->dispose();
        }
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php

namespace Rx\Disposable;

use Rx\DisposableInterface;

/**
 * Class SerialDisposable
 * @package Rx\Disposable
 */
class SerialDisposable implements DisposableInterface
{
    /** @var bool */
    private $isDisposed = false;

    /** @var DisposableInterface */
    private $disposable = null;

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

        $this->isDisposed = true;
        $old              = $this->disposable;
        $this->disposable = null;

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

    /**
     * @return DisposableInterface
     */
    public function getDisposable()
    {
        return $this->disposable;
    }

    /**
     * @param DisposableInterface $disposable
     */
    public function setDisposable(DisposableInterface $disposable)
    {
        $shouldDispose = $this->isDisposed;

        if (!$shouldDispose) {

            $old              = $this->disposable;
            $this->disposable = $disposable;

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

        if ($shouldDispose) {
            $disposable->dispose();
        }
    }
}

Function Calls

None

Variables

None

Stats

MD5 ff9c7955a08662b7be0a72785678acf6
Eval Count 0
Decode Time 86 ms