1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-14 18:36:58 +01:00
psalm/src/Psalm/Internal/PluginManager/PluginListFactory.php
2018-12-01 19:45:38 -05:00

22 lines
653 B
PHP

<?php
namespace Psalm\Internal\PluginManager;
class PluginListFactory
{
public function __invoke(string $current_dir, string $config_file_path = null): PluginList
{
$stub_composer_lock = (object)[
"packages" => [],
"packages-dev" => [],
];
$config_file = new ConfigFile($current_dir, $config_file_path);
$lock_file = is_readable('composer.lock') ?
'composer.lock' :
'data:application/json,' . urlencode(json_encode($stub_composer_lock));
$composer_lock = new ComposerLock($lock_file);
return new PluginList($config_file, $composer_lock);
}
}