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\Mechanisms; use WeakMap; class DataStore extends Mechanism { ..

Decoded Output download

<?php

namespace Livewire\Mechanisms;

use WeakMap;

class DataStore extends Mechanism
{
    protected $lookup;

    function __construct()
    {
        $this->lookup = new WeakMap;
    }

    function set($instance, $key, $value)
    {
        if (! isset($this->lookup[$instance])) {
            $this->lookup[$instance] = [];
        }

        $this->lookup[$instance][$key] = $value;
    }

    function has($instance, $key, $iKey = null) {
        if (! isset($this->lookup[$instance])) {
            return false;
        }

        if (! isset($this->lookup[$instance][$key])) {
            return false;
        }

        if ($iKey !== null) {
            return !! ($this->lookup[$instance][$key][$iKey] ?? false);
        }

        return true;
    }

    function get($instance, $key, $default = null)
    {
        if (! isset($this->lookup[$instance])) {
            return value($default);
        }

        if (! isset($this->lookup[$instance][$key])) {
            return value($default);
        }

        return $this->lookup[$instance][$key];
    }

    function find($instance, $key, $iKey = null, $default = null)
    {
        if (! isset($this->lookup[$instance])) {
            return value($default);
        }

        if (! isset($this->lookup[$instance][$key])) {
            return value($default);
        }

        if ($iKey !== null && ! isset($this->lookup[$instance][$key][$iKey])) {
            return value($default);
        }

        return $iKey !== null
            ? $this->lookup[$instance][$key][$iKey]
            : $this->lookup[$instance][$key];
    }

    function push($instance, $key, $value, $iKey = null)
    {
        if (! isset($this->lookup[$instance])) {
            $this->lookup[$instance] = [];
        }

        if (! isset($this->lookup[$instance][$key])) {
            $this->lookup[$instance][$key] = [];
        }

        if ($iKey) {
            $this->lookup[$instance][$key][$iKey] = $value;
        } else {
            $this->lookup[$instance][$key][] = $value;
        }
    }

    function unset($instance, $key, $iKey = null)
    {
        if (! isset($this->lookup[$instance])) {
            return;
        }

        if (! isset($this->lookup[$instance][$key])) {
            return;
        }

        if ($iKey !== null) {
            // Set a local variable to avoid the "indirect modification" error.
            $keyValue = $this->lookup[$instance][$key];

            unset($keyValue[$iKey]);

            $this->lookup[$instance][$key] = $keyValue;
        } else {
            // Set a local variable to avoid the "indirect modification" error.
            $instanceValue = $this->lookup[$instance];

            unset($instanceValue[$key]);

            $this->lookup[$instance] = $instanceValue;
        }
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php

namespace Livewire\Mechanisms;

use WeakMap;

class DataStore extends Mechanism
{
    protected $lookup;

    function __construct()
    {
        $this->lookup = new WeakMap;
    }

    function set($instance, $key, $value)
    {
        if (! isset($this->lookup[$instance])) {
            $this->lookup[$instance] = [];
        }

        $this->lookup[$instance][$key] = $value;
    }

    function has($instance, $key, $iKey = null) {
        if (! isset($this->lookup[$instance])) {
            return false;
        }

        if (! isset($this->lookup[$instance][$key])) {
            return false;
        }

        if ($iKey !== null) {
            return !! ($this->lookup[$instance][$key][$iKey] ?? false);
        }

        return true;
    }

    function get($instance, $key, $default = null)
    {
        if (! isset($this->lookup[$instance])) {
            return value($default);
        }

        if (! isset($this->lookup[$instance][$key])) {
            return value($default);
        }

        return $this->lookup[$instance][$key];
    }

    function find($instance, $key, $iKey = null, $default = null)
    {
        if (! isset($this->lookup[$instance])) {
            return value($default);
        }

        if (! isset($this->lookup[$instance][$key])) {
            return value($default);
        }

        if ($iKey !== null && ! isset($this->lookup[$instance][$key][$iKey])) {
            return value($default);
        }

        return $iKey !== null
            ? $this->lookup[$instance][$key][$iKey]
            : $this->lookup[$instance][$key];
    }

    function push($instance, $key, $value, $iKey = null)
    {
        if (! isset($this->lookup[$instance])) {
            $this->lookup[$instance] = [];
        }

        if (! isset($this->lookup[$instance][$key])) {
            $this->lookup[$instance][$key] = [];
        }

        if ($iKey) {
            $this->lookup[$instance][$key][$iKey] = $value;
        } else {
            $this->lookup[$instance][$key][] = $value;
        }
    }

    function unset($instance, $key, $iKey = null)
    {
        if (! isset($this->lookup[$instance])) {
            return;
        }

        if (! isset($this->lookup[$instance][$key])) {
            return;
        }

        if ($iKey !== null) {
            // Set a local variable to avoid the "indirect modification" error.
            $keyValue = $this->lookup[$instance][$key];

            unset($keyValue[$iKey]);

            $this->lookup[$instance][$key] = $keyValue;
        } else {
            // Set a local variable to avoid the "indirect modification" error.
            $instanceValue = $this->lookup[$instance];

            unset($instanceValue[$key]);

            $this->lookup[$instance] = $instanceValue;
        }
    }
}

Function Calls

None

Variables

None

Stats

MD5 e8c47f17ee920695e47b4ec751c8b32f
Eval Count 0
Decode Time 101 ms