HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux ip-172-31-42-149 5.15.0-1084-aws #91~20.04.1-Ubuntu SMP Fri May 2 07:00:04 UTC 2025 aarch64
User: ubuntu (1000)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/vhost/disk-apps/alq-cali.bikenow.co/vendor/amphp/amp/lib/Struct.php
<?php

namespace Amp;

/**
 * A "safe" struct trait for public property aggregators.
 *
 * This trait is intended to make using public properties a little safer by throwing when
 * nonexistent property names are read or written.
 */
trait Struct
{
    /**
     * The minimum percentage [0-100] at which to recommend a similar property
     * name when generating error messages.
     */
    private $__propertySuggestThreshold = 70;

    /**
     * @param string $property
     *
     * @psalm-return no-return
     */
    public function __get(string $property)
    {
        throw new \Error(
            $this->generateStructPropertyError($property)
        );
    }

    /**
     * @param string $property
     * @param mixed  $value
     *
     * @psalm-return no-return
     */
    public function __set(string $property, $value)
    {
        throw new \Error(
            $this->generateStructPropertyError($property)
        );
    }

    private function generateStructPropertyError(string $property): string
    {
        $suggestion = $this->suggestPropertyName($property);
        $suggestStr = ($suggestion == "") ? "" : " ... did you mean \"{$suggestion}?\"";

        return \sprintf(
            "%s property \"%s\" does not exist%s",
            \str_replace("\0", "@", \get_class($this)), // Handle anonymous class names.
            $property,
            $suggestStr
        );
    }

    private function suggestPropertyName(string $badProperty): string
    {
        $badProperty = \strtolower($badProperty);
        $bestMatch = "";
        $bestMatchPercentage = 0;

        /** @psalm-suppress RawObjectIteration */
        foreach ($this as $property => $value) {
            // Never suggest properties that begin with an underscore
            if ($property[0] === "_") {
                continue;
            }
            \similar_text($badProperty, \strtolower($property), $byRefPercentage);
            if ($byRefPercentage > $bestMatchPercentage) {
                $bestMatchPercentage = $byRefPercentage;
                $bestMatch = $property;
            }
        }

        return ($bestMatchPercentage >= $this->__propertySuggestThreshold) ? $bestMatch : "";
    }
}