403Webshell
Server IP : 93.86.61.54  /  Your IP : 216.73.216.60
Web Server : Apache/2.4.62 (Ubuntu)
System : Linux rasin.ddns.net 6.8.0-124-generic #124~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 21:05:19 UTC x86_64
User : www-data ( 33)
PHP Version : 8.4.22
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/html/projects/nextcloud/3rdparty/php-opencloud/openstack/src/Common/JsonSchema/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/projects/nextcloud/3rdparty/php-opencloud/openstack/src/Common/JsonSchema/Schema.php
<?php

declare(strict_types=1);

namespace OpenStack\Common\JsonSchema;

use JsonSchema\Validator;

class Schema
{
    /** @var object */
    private $body;

    /** @var Validator */
    private $validator;

    public function __construct($body, Validator $validator = null)
    {
        $this->body      = (object) $body;
        $this->validator = $validator ?: new Validator();
    }

    public function getPropertyPaths(): array
    {
        $paths = [];

        foreach ($this->body->properties as $propertyName => $property) {
            $paths[] = sprintf('/%s', $propertyName);
        }

        return $paths;
    }

    public function normalizeObject($subject, array $aliases): \stdClass
    {
        $out = new \stdClass();

        foreach ($this->body->properties as $propertyName => $property) {
            $name = $aliases[$propertyName] ?? $propertyName;

            if (isset($property->readOnly) && true === $property->readOnly) {
                continue;
            } elseif (property_exists($subject, $name)) {
                $out->$propertyName = $subject->$name;
            } elseif (property_exists($subject, $propertyName)) {
                $out->$propertyName = $subject->$propertyName;
            }
        }

        return $out;
    }

    public function validate($data)
    {
        $this->validator->check($data, $this->body);
    }

    public function isValid(): bool
    {
        return $this->validator->isValid();
    }

    public function getErrors(): array
    {
        return $this->validator->getErrors();
    }

    public function getErrorString(): string
    {
        $msg = "Provided values do not validate. Errors:\n";

        foreach ($this->getErrors() as $error) {
            $msg .= sprintf("[%s] %s\n", $error['property'], $error['message']);
        }

        return $msg;
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit