Skip to content

Instantly share code, notes, and snippets.

@eddieajau
Created December 13, 2012 04:33
Show Gist options
  • Save eddieajau/4274047 to your computer and use it in GitHub Desktop.
Save eddieajau/4274047 to your computer and use it in GitHub Desktop.
Joomla version compatibility class.
<?php
class JVersionCompatibility
{
/**
* Class constructor.
*
* @param SimpleXmlElement $node The compatibility node from a manifest file.
*
* @see https://github.com/joomla/joomla-cms/issues/598 for XML specification.
*/
public function __construct(SimpleXmlElement $node);
/**
* Checks a version for compatibility.
*
* @param string $version The version to check.
*
* @return boolean True if the version meets the compatibility rules, false otherwise.
*/
public function check($version);
/**
* Gets the comment, if available from the previous call to the `check` method.
*
* @return string The comment from the compatibility rule that was matched when calling `check`.
*/
public function getComment();
}
$vCheck = new JVersionCompatibility($xml->compatibility);
$vCheck->check($versionToUpdateTo);
$comment = $vCheck->getComment();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment