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\Observable; use Rx\Observable; use Rx\ObserverInterface; use Rx\Sched..

Decoded Output download

<?php

namespace Rx\Observable;

use Rx\Observable;
use Rx\ObserverInterface;
use Rx\SchedulerInterface;

class IntervalObservable extends Observable
{
    private $interval;

    /** @var SchedulerInterface */
    private $scheduler;

    /**
     * IntervalObservable constructor.
     */
    public function __construct($interval, SchedulerInterface $scheduler = null)
    {
        $this->interval  = $interval;
        $this->scheduler = $scheduler;
    }


    public function subscribe(ObserverInterface $observer, SchedulerInterface $scheduler = null)
    {
        if ($this->scheduler !== null) {
            $scheduler = $this->scheduler;
        }
        if ($scheduler === null) {
            throw new \Exception("You must use a scheduler that support non-zero delay.");
        }

        $counter = 0;

        return $scheduler->schedulePeriodic(
            function () use (&$counter, $observer) {
                $observer->onNext($counter++);
            },
            $this->interval, // this is to match RxJS behavior which delays the first item by the interval
            $this->interval
        );
    }
} ?>

Did this file decode correctly?

Original Code

<?php

namespace Rx\Observable;

use Rx\Observable;
use Rx\ObserverInterface;
use Rx\SchedulerInterface;

class IntervalObservable extends Observable
{
    private $interval;

    /** @var SchedulerInterface */
    private $scheduler;

    /**
     * IntervalObservable constructor.
     */
    public function __construct($interval, SchedulerInterface $scheduler = null)
    {
        $this->interval  = $interval;
        $this->scheduler = $scheduler;
    }


    public function subscribe(ObserverInterface $observer, SchedulerInterface $scheduler = null)
    {
        if ($this->scheduler !== null) {
            $scheduler = $this->scheduler;
        }
        if ($scheduler === null) {
            throw new \Exception("You must use a scheduler that support non-zero delay.");
        }

        $counter = 0;

        return $scheduler->schedulePeriodic(
            function () use (&$counter, $observer) {
                $observer->onNext($counter++);
            },
            $this->interval, // this is to match RxJS behavior which delays the first item by the interval
            $this->interval
        );
    }
}

Function Calls

None

Variables

None

Stats

MD5 f4ce04d5e562bb971b70ded1b725b555
Eval Count 0
Decode Time 86 ms