Skip to content

Commit 64f72f8

Browse files
committed
refactored IndexGenerator
1 parent 3b4145c commit 64f72f8

16 files changed

Lines changed: 463 additions & 1795 deletions

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
phpcomplete-extended
1+
phpcomplete-composer(WIP)
22
====================
33

4-
This plugin is a fork of [phpcomplete-extended](https://github.com/m2mdas/phpcomplete-extended) with refactored structure and fixed bugs.
4+
This plugin is a fork of [phpcomplete-extended by M2mdas](https://github.com/m2mdas/phpcomplete-extended) with completely rebuilt index generation part. New index generator based on [nikic/PHP-Parser](https://github.com/nikic/PHP-Parser).
55

66
Plugin
77
======

bin/src/Command/GenerateCommand.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,23 @@
44

55
class GenerateCommand extends AbstractCommand{
66
public function run(array $arguments = []){
7+
$time = microtime(true);
78
$verbose = $this->isVerbose($arguments);
89
$this->addPlugins($arguments);
910
$generator = $this->get("IndexGenerator");
1011

11-
$index = $this->prepareIndex($generator->generateIndex());
12+
$index = $generator->generateIndex($this->get("Index"));
13+
printf("Parsed: %d, time: %f\n", count($index->getClassMap()), microtime(true) - $time);
14+
$index = $this->prepareIndex($index);
15+
printf("time: %f\n", microtime(true) - $time);
16+
return;
1217
$indexWriter = $this->get('IndexWriter');
1318

1419
$indexWriter->writeIndex($index);
1520
$indexWriter->writeReport($generator->getInvalidClasses());
1621
}
1722
protected function prepareIndex($index){
18-
$jsonIndex = json_encode($index);
23+
$jsonIndex = json_encode($index->toArray());
1924
$lastJsonError = json_last_error();
2025
if($lastJsonError != JSON_ERROR_NONE) {
2126
$this->printJsonError($lastJsonError);

0 commit comments

Comments
 (0)