-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added services completion and type detection
- Loading branch information
Showing
4 changed files
with
169 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace Mkusher\PadawanSymfony; | ||
|
||
use Complete\Completer\CompleterInterface; | ||
use Entity\Completion\Entry; | ||
use Entity\Project; | ||
use Entity\Completion\Context; | ||
|
||
class Completer implements CompleterInterface | ||
{ | ||
public function getEntries(Project $project, Context $context) | ||
{ | ||
$services = $project->getPlugin('padawan-symfony'); | ||
return array_map(function ($serviceName) { | ||
return new Entry( | ||
sprintf('"%s"', $serviceName), | ||
"", | ||
"", | ||
$serviceName | ||
); | ||
}, array_keys($services)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace Mkusher\PadawanSymfony; | ||
|
||
class IndexGenerator | ||
{ | ||
public function handleAfterGenerationEvent($event) | ||
{ | ||
$project = $event->getProject(); | ||
$output = []; | ||
$container = []; | ||
try { | ||
exec(sprintf("%s/app/console container:debug", $project->getRootFolder()), $output); | ||
$output = array_slice($output, 2); | ||
array_pop($output); | ||
foreach ($output as $containerStr) { | ||
$service = explode(" ", $containerStr); | ||
preg_match('/^\s*(\S*)\s*(\S*)$/i', $containerStr, $matches); | ||
if ($matches && count($matches) === 3) { | ||
$container[$matches[1]] = $matches[2]; | ||
} | ||
} | ||
$project->addPlugin('padawan-symfony', $container); | ||
} catch (\Exception $e) { | ||
return; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters