public function load_inherited_group($name) { $sampleName = $name . '.sample'; $file = $this->pixie->find_file('config', $sampleName); $this->load_group($sampleName, $file); $file = $this->pixie->find_file('config', $name); $this->load_group($name, $file); $this->groups[$name] = ArraysHelper::arrayMergeRecursiveDistinct($this->groups[$sampleName], $this->groups[$name]); }
/** * @param Request $request * @return \App\Installation\Result|array|void * @throws \LogicException */ public function runWizard(Request $request) { if (!$this->initialized) { throw new \LogicException('Installator must be initialized before running'); } $this->request = $request; $this->checkSessionStarted(); $step = $request->param('id'); $result = new Result(); if (!$step) { $step = $this->firstStep->getName(); } // Traverse all steps until current $stepObj = $this->firstStep; $lastStartedStep = $stepObj; while ($stepObj) { // Forbid executing not started steps. if (!$stepObj->isStarted()) { break; } $lastStartedStep = $stepObj; // Execute current step and stop. if ($step == $stepObj->getName()) { $result = $stepObj->execute(strtoupper($this->request->method), $this->request->getRequestData()); if ($stepObj->getCompleted()) { if ($nextStep = $stepObj->getNextStep()) { $nextStep->start(); } else { $result->setCompleted(true); } } break; } // If invalid step is before current one, stop propagation, and ask user to fix it. if (!$stepObj->isValid()) { $result->setStep($stepObj); $result->redirectToStep(); break; } $stepObj = $stepObj->getNextStep(); } $this->stepsData['steps'][$stepObj->getName()]['current'] = true; $this->stepsData = ArraysHelper::arrayMergeRecursiveDistinct($this->stepsData, $stepObj->getViewData()); $result->setViewData($this->stepsData); $result->setLastStartedStep($lastStartedStep); return $result; }
/** * Sets vulnerabilities of this context. * @param array $vulnerabilities * @return $this * @throws \InvalidArgumentException */ public function setVulnerabilities($vulnerabilities = []) { // Clear current vulnerabilities $this->vulnerabilities = []; if (!is_array($vulnerabilities)) { $vulnerabilities = (array) $vulnerabilities; } foreach ($vulnerabilities as $type => $vulnerability) { $this->checkValidType($type); $this->vulnerabilities[$type] = $vulnerability; } $parentVulns = $this->parent ? $this->parent->getVulnerabilities() : []; $this->vulnerabilities = ArraysHelper::arrayMergeRecursiveDistinct($parentVulns, $this->vulnerabilities); return $this; }