public static function test() { // A few examples. echo "Testing CPENamingUnbind...<br>\n"; $cpenu = new CPENameUnbinder(); $wfn = $cpenu->unbindURI("cpe:/a:microsoft:internet_explorer%01%01%01%01:?:beta"); echo $wfn . "<br>\n"; $wfn = $cpenu->unbindURI("cpe:/a:microsoft:internet_explorer:8.%2a:sp%3f"); echo $wfn . "<br>\n"; $wfn = $cpenu->unbindURI("cpe:/a:microsoft:internet_explorer:8.%02:sp%01"); echo $wfn . "<br>\n"; $wfn = $cpenu->unbindURI("cpe:/a:hp:insight_diagnostics:7.4.0.1570::~~online~win2003~x64~"); echo $wfn . "<br>\n"; echo $cpenu->unbindFS("cpe:2.3:a:micr\\?osoft:internet_explorer:8.0.6001:beta:*:*:*:*:*:*") . "<br>\n"; }
public static function test() { // Examples. $wfn = new WellFormedName("a", "microsoft", "internet_explorer", "8\\.0\\.6001", "beta", new LogicalValue("ANY"), "sp2", null, null, null, null); $wfn2 = new WellFormedName("a", "microsoft", "internet_explorer", new LogicalValue("ANY"), new LogicalValue("ANY"), new LogicalValue("ANY"), new LogicalValue("ANY"), new LogicalValue("ANY"), new LogicalValue("ANY"), new LogicalValue("ANY"), new LogicalValue("ANY")); $cpenm = new CPENameMatcher(); $cpenu = new CPENameUnbinder(); $cpenb = new CPENameBinder(); $wfn = $cpenu->unbindURI($cpenb->bindToURI($wfn)); $wfn2 = $cpenu->unbindFS($cpenb->bindToFS($wfn2)); var_dump($cpenm->isDisjoint($wfn, $wfn2)); // false var_dump($cpenm->isEqual($wfn, $wfn2)); // false var_dump($cpenm->isSubset($wfn, $wfn2)); // true, $wfn2 is a subset of wfn var_dump($cpenm->isSuperset($wfn, $wfn2)); // false $wfn = $cpenu->unbindFS("cpe:2.3:a:adobe:*:9.*:*:PalmOS:*:*:*:*:*"); $wfn2 = $cpenu->unbindURI("cpe:/a::Reader:9.3.2:-:-"); var_dump($cpenm->isDisjoint($wfn, $wfn2)); // true, $wfn2 and wfn are disjoint var_dump($cpenm->isEqual($wfn, $wfn2)); // false var_dump($cpenm->isSubset($wfn, $wfn2)); // false var_dump($cpenm->isSuperset($wfn, $wfn2)); // false }