getRuntimeValue example


    private function runChecks()
    {
        $xmlObject = simplexml_load_file($this->sourceFile);

        if (!\is_object($xmlObject->requirements)) {
            throw new RuntimeException('Requirements XML file is not valid.');
        }

        foreach ($xmlObject->requirement as $requirement) {
            $name = (string) $requirement->name;
            $value = $this->getRuntimeValue($name);
            $requirement->result = $this->compare(
                $name,
                $value,
                (string) $requirement->required
            );
            $requirement->version = $value;
        }

        return $xmlObject->requirement;
    }

    
$name = (string) $requirement->name;

            if ($name === 'database') {
                [$platform$version] = $this->getMysqlVersion();

                $requirement->version = $version;
                $requireVersion = (string) $platform === 'mysql' ? $requirement->mysql : $requirement->mariadb;
                $requirement->result = version_compare($version$requireVersion, '>=');
                $requirement->required = $requireVersion;
                $requirement->name = $platform;
            } else {
                $value = (string) $this->getRuntimeValue($name$requirement);
                $requirement->result = $this->compare(
                    $name,
                    $value,
                    (string) $requirement->required
                );
                $requirement->version = $value;
            }
        }

        return $xmlObject->requirement;
    }

    
Home | Imprint | This part of the site doesn't use cookies.