public function onAdd(AbstractMetaSpec $spec, MetaSpecMatcher $matcher) { // depends on PhpModule $present = false; foreach ($matcher->getModules() as $module) { if ($module instanceof PhpModule) { $this->phpModule = $module; $this->phpModule->addDefaultGroup("json:" . JsonProperty::DEFAULT_GROUP); $present = true; break; } } if (!$present) { throw new MetaException("JsonModule depends on PhpModule. Please add PhpModule first."); } }
/** * @param string $pattern * @return MetaSpecMatcher */ public function match($pattern) { $this->matchers[] = $matcher = new MetaSpecMatcher($this); return $matcher->match($pattern); }