Elgg\Database\Plugins::checkProvides PHP Method

checkProvides() public method

Checks if a plugin is currently providing $type and $name, and optionally checking a version.
public checkProvides ( string $type, string $name, string $version = null, string $comparison = 'ge' ) : array
$type string The type of the provide
$name string The name of the provide
$version string A version to check against
$comparison string The comparison operator to use in version_compare()
return array An array in the form array( 'status' => bool Does the provide exist?, 'value' => string The version provided )
    function checkProvides($type, $name, $version = null, $comparison = 'ge')
    {
        $provided = $this->getProvides($type, $name);
        if (!$provided) {
            return array('status' => false, 'value' => '');
        }
        if ($version) {
            $status = version_compare($provided['version'], $version, $comparison);
        } else {
            $status = true;
        }
        return array('status' => $status, 'value' => $provided['version']);
    }