public static function test() { // A few examples. echo "Testing CPENamingBind...<br>\n"; $wfn = new WellFormedName("a", "microsoft", "internet_explorer", "8\\.0\\.6001", "beta", new LogicalValue("ANY"), "sp2", null, null, null, null); $wfn2 = new WellFormedName(); $wfn2->set("part", "a"); $wfn2->set("vendor", "foo\\\$bar"); $wfn2->set("product", "insight"); $wfn2->set("version", "7\\.4\\.0\\.1570"); $wfn2->set("target_sw", "win2003"); $wfn2->set("update", new LogicalValue("NA")); $wfn2->set("sw_edition", "online"); $wfn2->set("target_hw", "x64"); $cpenb = new CPENameBinder(); echo $cpenb->bindToURI($wfn) . "<br>\n"; echo $cpenb->bindToFS($wfn2) . "<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 }