Exakat\Tasks\Load::saveDefinitions PHP Method

saveDefinitions() private method

private saveDefinitions ( )
    private function saveDefinitions()
    {
        $begin = microtime(true);
        // Fallback to global if local namespace function doesn't exists
        if (isset($this->calls['function'])) {
            $this->fallbackToGlobal('function');
        }
        if (isset($this->calls['constant'])) {
            $this->fallbackToGlobal('constant');
        }
        // Saving the function / class definitions
        foreach ($this->calls as $type => $paths) {
            foreach ($paths as $path) {
                foreach ($path['calls'] as $origin => $origins) {
                    foreach ($path['definitions'] as $destination => $destinations) {
                        $csv = 'DEFINITION.' . $destination . '.' . $origin;
                        $filePath = $this->exakatDir . '/rels.g3.' . $csv . '.csv';
                        if (file_exists($filePath)) {
                            $fp = fopen($this->exakatDir . '/rels.g3.' . $csv . '.csv', 'a');
                        } else {
                            $fp = fopen($this->exakatDir . '/rels.g3.' . $csv . '.csv', 'w+');
                            fputcsv($fp, array('start', 'end'));
                        }
                        foreach ($origins as $o) {
                            foreach ($destinations as $d) {
                                fputcsv($fp, array($d, $o), ',', '"', '\\');
                            }
                        }
                    }
                }
            }
        }
        $end = microtime(true);
        $this->log->log("saveDefinitions\t" . ($end - $begin) * 1000 . "\t" . count($this->calls) . "\n");
    }
Load