/** * Writes the collected data to file. * @return void */ private function exportDeploymentDescriptor() { // sort events by priority uasort($this->events, function ($a, $b) { if ($a['priority'] == $b['priority']) { return 0; } return $a['priority'] > $b['priority'] ? -1 : 1; }); $deployment = ['modules' => $this->modules, 'models' => $this->models, 'components' => $this->components, 'factories' => $this->factories, 'events' => $this->events]; $deploymentScript = '<?php return ' . var_export($deployment, true) . ";\n"; $runtimeDir = new Directory(RUNTIME_PATH); $runtimeDir->create(); $deploymentDescriptor = new File(self::getDeploymentDescriptorPath()); $deploymentDescriptor->touch($deploymentScript); }