本文整理汇总了PHP中Composer\Installer\LibraryInstaller::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP LibraryInstaller::__construct方法的具体用法?PHP LibraryInstaller::__construct怎么用?PHP LibraryInstaller::__construct使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Composer\Installer\LibraryInstaller
的用法示例。
在下文中一共展示了LibraryInstaller::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Initializes library installer.
*
* @param IOInterface $io The input/output handler
* @param Composer $composer The composer instance being run
* @param string $type The type
*/
public function __construct(IOInterface $io, Composer $composer, $type = 'library')
{
parent::__construct($io, $composer, $type);
//
// We can now parse our 'extra' configuration key for all our related information.
//
$extra = $this->composer->getPackage()->getExtra();
$this->mapFile = getcwd() . DIRECTORY_SEPARATOR . self::NAME . '.map';
$this->framework = $composer->getPackage()->getName();
$this->integrity = 'medium';
if (isset($extra[self::NAME]['options'])) {
$options = $extra[self::NAME]['options'];
$this->externalMapping = isset($options['external-mapping']) ? (bool) $options['external-mapping'] : FALSE;
if (isset($options['framework'])) {
$this->framework = $options['framework'];
//
// Previous versions were noted as enabled if they set a framework. This will
// re-establish that, but will get overloaded later if enabled is explicitly set.
//
$this->enabled = TRUE;
}
if (isset($options['integrity'])) {
$options['integrity'] = strtolower($options['integrity']);
$valid_levels = array('low', 'medium', 'high');
$this->integrity = in_array($options['integrity'], $valid_levels) ? $options['integrity'] : 'medium';
}
}
if (isset($extra[self::NAME]['enabled'])) {
$this->enabled = $extra[self::NAME]['enabled'];
}
}
示例2:
function __construct(IOInterface $io, Composer $composer, array $installInfo)
{
// fill in install info defaults
$installInfo += ['wordpress-path' => false, 'wp-content-path' => false, 'wpmu-plugin-dir' => false, 'path-mapping' => [], 'symlink-wp-content' => true, 'mu-plugin-autoloader' => true, 'dev-first' => false];
// wp content path - either set or default
$wpContent = $installInfo['wp-content-path'] ?: self::wp_content;
// default paths for plugins and themes
$installInfo['default-paths'] = ['wordpress-plugin' => "{$wpContent}/plugins", 'wordpress-muplugin' => "{$wpContent}/mu-plugins", 'wordpress-theme' => "{$wpContent}/themes"];
// if the wp-content path was explicitly set, add to the path mapping for plugins/themes
if ($installInfo['wp-content-path']) {
$installInfo['path-mapping'] += $installInfo['default-paths'];
} else {
// set the default wp-content path for mapping and symlinking
$installInfo['wp-content-path'] = $wpContent;
}
// add a mapping for core if wordpress path is set
if ($installInfo['wordpress-path']) {
$installInfo['path-mapping']['wordpress-core'] = $installInfo['wordpress-path'];
} else {
$installInfo['wordpress-path'] = $installInfo['default-paths']['wordpress-core'] = self::wordpress;
}
// wpmu-plugin-dir supersedes the default wp-content based path
if ($installInfo['wpmu-plugin-dir']) {
$installInfo['path-mapping']['wordpress-muplugin'] = $installInfo['wpmu-plugin-dir'];
} else {
$installInfo['wpmu-plugin-dir'] = $installInfo['default-paths']['wordpress-muplugin'];
}
$this->installInfo = $installInfo;
parent::__construct($io, $composer);
}
示例3: __construct
public function __construct(IOInterface $io, Composer $composer, $type = null)
{
if ($composer->getConfig()->has('composer-global-installer')) {
$this->_isInUse = true;
$this->_config = $composer->getConfig()->get('composer-global-installer');
if (isset($this->_config['vendor-global-dir'])) {
$this->_globalDir = $this->_config['vendor-global-dir'];
}
if (isset($this->_config['vendor-global-types'])) {
// Bad format, use default
// @todo throw exception
if (is_array($this->_config['vendor-global-types'])) {
$this->_supportedTypes = $this->_config['vendor-global-types'];
}
}
if ($composer->getConfig()->has('vendor-global-packages')) {
// Bad format, use default
// @todo throw exception
if (is_array($composer->getConfig()->get('vendor-global-packages'))) {
$this->_globalPackages = $composer->getConfig()->get('vendor-global-packages');
}
}
}
parent::__construct($io, $composer, $type);
}
示例4: __construct
public function __construct(IOInterface $io, Composer $composer, array $compound_generators, EmptyGenerator $empty_generator, ReflectionGenerator $reflection_generator)
{
parent::__construct($io, $composer);
$this->compound_generators = $compound_generators;
$this->empty_generator = $empty_generator;
$this->reflection_generator = $reflection_generator;
}
示例5: __construct
/**
* @param IOInterface $io
* @param Composer $composer
* @param string $type
* @param Filesystem $filesystem
*/
public function __construct(IOInterface $io, Composer $composer, $type = 'library', Filesystem $filesystem = null)
{
parent::__construct($io, $composer, $type, $filesystem);
if ($extra = $this->composer->getPackage()->getExtra()) {
$this->paths = isset($extra['courier-paths']) ? $extra['courier-paths'] : array();
}
}
示例6: __construct
/**
* {@inheritDoc}
*/
public function __construct(IOInterface $io, Composer $composer, $type = 'library', Filesystem $filesystem = null)
{
parent::__construct($io, $composer, $type, $filesystem);
$this->loadCommandList();
// TODO: Build this list correctly
$this->packages['firehed/plow'] = ['classes' => ['Firehed\\Plow\\Plow'], 'version' => 'dev-lol'];
}
示例7: __construct
/**
* @param IOInterface $io
* @param Composer $composer
* @param SymlinkFilesystem $filesystem
* @param PackageDataManagerInterface $dataManager
* @param SharedPackageInstallerConfig $config
*/
public function __construct(IOInterface $io, Composer $composer, SymlinkFilesystem $filesystem, PackageDataManagerInterface $dataManager, SharedPackageInstallerConfig $config)
{
$this->filesystem = $filesystem;
parent::__construct($io, $composer, 'library', $this->filesystem);
$this->config = $config;
$this->vendorDir = $this->config->getVendorDir();
$this->packageDataManager = $dataManager;
$this->packageDataManager->setVendorDir($this->vendorDir);
}
示例8: __construct
/**
* Constructor.
*
* @param IOInterface $io
* @param Composer $composer
* @param AssetTypeInterface $assetType
* @param Filesystem $filesystem
*/
public function __construct(IOInterface $io, Composer $composer, AssetTypeInterface $assetType, Filesystem $filesystem = null)
{
parent::__construct($io, $composer, $assetType->getComposerType(), $filesystem);
$extra = $composer->getPackage()->getExtra();
if (!empty($extra['asset-installer-paths'][$this->type])) {
$this->vendorDir = rtrim($extra['asset-installer-paths'][$this->type], '/');
} else {
$this->vendorDir = rtrim($this->vendorDir . '/' . $assetType->getComposerVendorName(), '/');
}
}
示例9: __construct
/**
* @param string $vendorDir relative path for packages home
* @param string $binDir relative path for binaries
* @param DownloadManager $dm download manager
* @param WritableRepositoryInterface $repository repository controller
* @param IOInterface $io io instance
*/
public function __construct($vendorDir, $binDir, DownloadManager $dm, WritableRepositoryInterface $repository, IOInterface $io, InstallationManager $im)
{
parent::__construct($vendorDir, $binDir, $dm, $repository, $io, 'composer-installer');
$this->installationManager = $im;
foreach ($repository->getPackages() as $package) {
if ('composer-installer' === $package->getType()) {
$this->registerInstaller($package);
}
}
}
示例10: __construct
public function __construct(IOInterface $io, Composer $composer)
{
parent::__construct($io, $composer);
$extra = $this->composer->getPackage()->getExtra();
$extra += array('drupal-libraries' => array(), 'drupal-modules' => array(), 'drupal-themes' => array(), 'drupal-root' => 'core');
$this->drupalLibraries = $extra['drupal-libraries'] + array('ckeditor/ckeditor' => "");
$this->drupalModules = $extra['drupal-modules'] + array('drupal/*' => 'contrib');
$this->drupalThemes = $extra['drupal-themes'] + array('drupal/*' => 'contrib');
$this->drupalRoot = $extra['drupal-root'];
$this->cached = array();
}
示例11: __construct
/**
* Initializes Installer installer.
*
* @param IOInterface $io
* @param Composer $composer
* @param string $type
*/
public function __construct(IOInterface $io, Composer $composer, $type = 'library')
{
parent::__construct($io, $composer, 'composer-installer');
$this->installationManager = $composer->getInstallationManager();
$repo = $composer->getRepositoryManager()->getLocalRepository();
foreach ($repo->getPackages() as $package) {
if ('composer-installer' === $package->getType()) {
$this->registerInstaller($package);
}
}
}
示例12: __construct
public function __construct(IOInterface $io, Composer $composer, $type, Filesystem $filesystem = null)
{
parent::__construct($io, $composer, $type, $filesystem);
switch ($type) {
case 'wordpress-plugin':
$this->vendorDir = 'wp-content/plugins';
break;
case 'wordpress-theme':
$this->vendorDir = 'wp-content/themes';
break;
}
}
示例13: __construct
public function __construct(Composer $composer, IOInterface $io, $type = 'library', Filesystem $filesystem = null)
{
$this->composer = $composer;
$this->config = $composer->getConfig();
$this->io = $io;
$this->root = realpath(dirname(Factory::getComposerFile()));
if (!file_exists($this->root . '/config/modules.php')) {
touch($this->root . '/config/modules.php');
chmod($this->root . '/config/modules.php', 0775);
}
parent::__construct($io, $composer, $type, $filesystem);
}
示例14: __construct
/**
* @param string $vendorDir relative path for packages home
* @param string $binDir relative path for binaries
* @param DownloadManager $dm download manager
* @param IOInterface $io io instance
* @param InstallationManager $im installation manager
* @param array $localRepositories array of WritableRepositoryInterface
*/
public function __construct($vendorDir, $binDir, DownloadManager $dm, IOInterface $io, InstallationManager $im, array $localRepositories)
{
parent::__construct($vendorDir, $binDir, $dm, $io, 'composer-installer');
$this->installationManager = $im;
foreach ($localRepositories as $repo) {
foreach ($repo->getPackages() as $package) {
if ('composer-installer' === $package->getType()) {
$this->registerInstaller($package);
}
}
}
}
示例15: __construct
/**
* {@inheritDoc}
*/
public function __construct(IOInterface $io, Composer $composer, $type = 'library', Filesystem $filesystem = null)
{
parent::__construct($io, $composer, $type, $filesystem);
$extra = $composer->getPackage()->getExtra();
$this->setLocalDirs(isset($extra['local-dirs']) ? $extra['local-dirs'] : dirname(getcwd()));
if (isset($extra['local-vendors'])) {
$this->setLocalVendors($extra['local-vendors']);
}
if (isset($extra['local-packages'])) {
$this->setLocalPackages($extra['local-packages']);
}
}