public function __construct(array $config, Build $builder) { $collections = new Generate\Collections($config['files'], $this); self::$cdir = $config['loader']; $namespace = "ActiveMongo2\\Namspace" . uniqid(true); $rnd = uniqid(); $valns = $collections->getValidatorNS(); $validator = $collections->getValidator(); class_exists("crodas\\FileUtil\\File"); // preload class $args = compact('docs', 'namespace', 'mapper', 'indexes', 'self', 'collections', 'valns', 'rnd', 'validator'); $code = Template\Templates::get('documents')->render($args, true); if (strlen($code) >= 1024 * 1024 || !class_exists('crodas\\SimpleView\\FixCode')) { File::write($config['loader'], $code); } else { File::write($config['loader'], FixCode::fix($code)); } $this->writeFileWatch($builder, $collections); }
public function getCode() { $code = Templates::get('body')->render($this->getVariables(), true); if (class_exists('crodas\\SimpleView\\FixCode')) { return FixCode::fix($code); } return $code; }
protected function compile() { $this->readFilters(); $this->createUrlObjects(); $groups = $this->groupByApps($this->urls); $groups->iterate(array($this, 'groupByMethod')); $groups->iterate(array($this, 'groupByPartsSize')); $groups->iterate(array($this, 'groupByPatterns')); $self = $this; $groups->sort(function ($obj1, $obj2) use($self) { return $obj1->getWeight($self) - $obj2->getWeight($self); }); $config = $this->config; $output = $this->config->getOutput(); $self = $this; $args = compact('self', 'groups', 'config', 'complex'); $this->output = Templates::get('main')->render($args, true); $this->output = FixCode::fix($this->output); }