public function testIsEmptyIfTheJsonIsNotValid() { $reader = new RuleParser(); $rule = $reader->readRules(__DIR__ . DS . "fixtures" . DS . "broken.rule"); $this->assertEmpty($rule->getSource()); $this->assertEmpty($rule->getRuleCollection()); }
public function generate(ModuleGenerateEvent $event) { $ruleReader = new RuleParser(); /** @var \SplFileInfo $rule */ foreach ($this->findInPath($event->getResourcesPath(), "/\\.rule\$/") as $rule) { $relativePath = str_replace($event->getResourcesPath(), "", $rule->getRealPath()); $completePath = $event->getModulePath() . $relativePath; $completePath = substr($completePath, 0, -5); // remove .rule extension $rule = $ruleReader->readRules($rule->getRealPath()); $this->processRule($rule, $completePath); } }