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 declare(strict_types=1); namespace Sabre\DAV\Mock; use Sabre\DAV\IProperties; use..

Decoded Output download

<?php

declare(strict_types=1);

namespace Sabre\DAV\Mock;

use Sabre\DAV\IProperties;
use Sabre\DAV\PropPatch;

/**
 * A node specifically for testing property-related operations.
 *
 * @copyright Copyright (C) fruux GmbH (https://fruux.com/)
 * @author Evert Pot (http://evertpot.com/)
 * @license http://sabre.io/license/ Modified BSD License
 */
class PropertiesCollection extends Collection implements IProperties
{
    public $failMode = false;

    public $properties;

    /**
     * Creates the object.
     *
     * @param string $name
     */
    public function __construct($name, array $children, array $properties = [])
    {
        parent::__construct($name, $children, null);
        $this->properties = $properties;
    }

    /**
     * Updates properties on this node.
     *
     * This method received a PropPatch object, which contains all the
     * information about the update.
     *
     * To update specific properties, call the 'handle' method on this object.
     * Read the PropPatch documentation for more information.
     */
    public function propPatch(PropPatch $proppatch)
    {
        $proppatch->handleRemaining(function ($updateProperties) {
            switch ($this->failMode) {
                case 'updatepropsfalse': return false;
                case 'updatepropsarray':
                    $r = [];
                    foreach ($updateProperties as $k => $v) {
                        $r[$k] = 402;
                    }

                    return $r;
                case 'updatepropsobj':
                    return new \STDClass();
            }
        });
    }

    /**
     * Returns a list of properties for this nodes.
     *
     * The properties list is a list of propertynames the client requested,
     * encoded in clark-notation {xmlnamespace}tagname
     *
     * If the array is empty, it means 'all properties' were requested.
     *
     * Note that it's fine to liberally give properties back, instead of
     * conforming to the list of requested properties.
     * The Server class will filter out the extra.
     *
     * @param array $requestedProperties
     *
     * @return array
     */
    public function getProperties($requestedProperties)
    {
        $returnedProperties = [];
        foreach ($requestedProperties as $requestedProperty) {
            if (isset($this->properties[$requestedProperty])) {
                $returnedProperties[$requestedProperty] =
                    $this->properties[$requestedProperty];
            }
        }

        return $returnedProperties;
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php

declare(strict_types=1);

namespace Sabre\DAV\Mock;

use Sabre\DAV\IProperties;
use Sabre\DAV\PropPatch;

/**
 * A node specifically for testing property-related operations.
 *
 * @copyright Copyright (C) fruux GmbH (https://fruux.com/)
 * @author Evert Pot (http://evertpot.com/)
 * @license http://sabre.io/license/ Modified BSD License
 */
class PropertiesCollection extends Collection implements IProperties
{
    public $failMode = false;

    public $properties;

    /**
     * Creates the object.
     *
     * @param string $name
     */
    public function __construct($name, array $children, array $properties = [])
    {
        parent::__construct($name, $children, null);
        $this->properties = $properties;
    }

    /**
     * Updates properties on this node.
     *
     * This method received a PropPatch object, which contains all the
     * information about the update.
     *
     * To update specific properties, call the 'handle' method on this object.
     * Read the PropPatch documentation for more information.
     */
    public function propPatch(PropPatch $proppatch)
    {
        $proppatch->handleRemaining(function ($updateProperties) {
            switch ($this->failMode) {
                case 'updatepropsfalse': return false;
                case 'updatepropsarray':
                    $r = [];
                    foreach ($updateProperties as $k => $v) {
                        $r[$k] = 402;
                    }

                    return $r;
                case 'updatepropsobj':
                    return new \STDClass();
            }
        });
    }

    /**
     * Returns a list of properties for this nodes.
     *
     * The properties list is a list of propertynames the client requested,
     * encoded in clark-notation {xmlnamespace}tagname
     *
     * If the array is empty, it means 'all properties' were requested.
     *
     * Note that it's fine to liberally give properties back, instead of
     * conforming to the list of requested properties.
     * The Server class will filter out the extra.
     *
     * @param array $requestedProperties
     *
     * @return array
     */
    public function getProperties($requestedProperties)
    {
        $returnedProperties = [];
        foreach ($requestedProperties as $requestedProperty) {
            if (isset($this->properties[$requestedProperty])) {
                $returnedProperties[$requestedProperty] =
                    $this->properties[$requestedProperty];
            }
        }

        return $returnedProperties;
    }
}

Function Calls

None

Variables

None

Stats

MD5 7969ea554bc0b5390b05d537bde731f9
Eval Count 0
Decode Time 106 ms