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\Operator; use Rx\ObservableInterface; use Rx\Observer\CallbackObserve..

Decoded Output download

<?php

namespace Rx\Operator;

use Rx\ObservableInterface;
use Rx\Observer\CallbackObserver;
use Rx\ObserverInterface;
use Rx\SchedulerInterface;

class CountOperator implements OperatorInterface
{
    private $count = 0;
    private $predicate;

    /**
     * Count constructor.
     * @param callable $predicate
     */
    public function __construct(callable $predicate = null)
    {
        $this->predicate = $predicate;
    }

    /**
     * @inheritDoc
     */
    public function __invoke(ObservableInterface $observable, ObserverInterface $observer, SchedulerInterface $scheduler = null)
    {
        $callbackObserver = new CallbackObserver(
            function ($x) use ($observer) {
                if ($this->predicate === null) {
                    $this->count++;

                    return;
                }
                try {
                    $predicate = $this->predicate;
                    if (call_user_func($predicate, $x)) {
                        $this->count++;
                    }
                } catch (\Exception $e) {
                    $observer->onError($e);
                }
            },
            [$observer, 'onError'],
            function () use ($observer) {
                $observer->onNext($this->count);
                $observer->onCompleted();
            }
        );

        return $observable->subscribe($callbackObserver, $scheduler);
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php

namespace Rx\Operator;

use Rx\ObservableInterface;
use Rx\Observer\CallbackObserver;
use Rx\ObserverInterface;
use Rx\SchedulerInterface;

class CountOperator implements OperatorInterface
{
    private $count = 0;
    private $predicate;

    /**
     * Count constructor.
     * @param callable $predicate
     */
    public function __construct(callable $predicate = null)
    {
        $this->predicate = $predicate;
    }

    /**
     * @inheritDoc
     */
    public function __invoke(ObservableInterface $observable, ObserverInterface $observer, SchedulerInterface $scheduler = null)
    {
        $callbackObserver = new CallbackObserver(
            function ($x) use ($observer) {
                if ($this->predicate === null) {
                    $this->count++;

                    return;
                }
                try {
                    $predicate = $this->predicate;
                    if (call_user_func($predicate, $x)) {
                        $this->count++;
                    }
                } catch (\Exception $e) {
                    $observer->onError($e);
                }
            },
            [$observer, 'onError'],
            function () use ($observer) {
                $observer->onNext($this->count);
                $observer->onCompleted();
            }
        );

        return $observable->subscribe($callbackObserver, $scheduler);
    }
}

Function Calls

None

Variables

None

Stats

MD5 f6e102f7b15b61ebbac0408c26f6df44
Eval Count 0
Decode Time 87 ms