ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ComponentInstaller\Process\Process Class Reference

The base Process type. More...

+ Inheritance diagram for ComponentInstaller\Process\Process:
+ Collaboration diagram for ComponentInstaller\Process\Process:

Public Member Functions

 __construct (Composer $composer=null, IOInterface $io=null)
 {Create a new Process.
Parameters
Composer$composerThe Composer object to act on.
IOInterface$ioInput/Output object to act on.
} More...
 
 process ()
 {Called when running through the process.
Returns
boolean True or false depending on whether the process was successful.
} More...
 
 getComponentName ($prettyName, array $extra=array())
 Retrieves the component name for the component. More...
 
 getComponentDir ()
 Retrieves the component directory. More...
 
 setComponentDir ($dir)
 Sets the component directory. More...
 
 getVendorDir (array $package)
 Retrieves the given package's vendor directory, where it's installed. More...
 
- Public Member Functions inherited from ComponentInstaller\Process\ProcessInterface
 init ()
 Initialize the process before its run. More...
 

Protected Attributes

 $composer
 
 $io
 
 $config
 
 $packages = array()
 
 $componentDir = 'components'
 
 $fs
 
 $installationManager
 

Detailed Description

The base Process type.

Processes are initialized, and then run during installation.

Definition at line 26 of file Process.php.

Constructor & Destructor Documentation

◆ __construct()

ComponentInstaller\Process\Process::__construct ( Composer  $composer = null,
IOInterface  $io = null 
)

{Create a new Process.

Parameters
Composer$composerThe Composer object to act on.
IOInterface$ioInput/Output object to act on.
}

Implements ComponentInstaller\Process\ProcessInterface.

Definition at line 67 of file Process.php.

References ComponentInstaller\Process\Process\$composer, ComponentInstaller\Process\Process\$io, array, and ComponentInstaller\Process\ProcessInterface\init().

68  {
69  $this->composer = isset($composer) ? $composer : new Composer();
70  $this->io = isset($io) ? $io : new NullIO();
71  $this->fs = new Filesystem();
72  $this->installationManager = $this->composer->getInstallationManager();
73  }
+ Here is the call graph for this function:

Member Function Documentation

◆ getComponentDir()

ComponentInstaller\Process\Process::getComponentDir ( )

Retrieves the component directory.

Definition at line 177 of file Process.php.

References ComponentInstaller\Process\Process\$componentDir.

178  {
179  return $this->componentDir;
180  }

◆ getComponentName()

ComponentInstaller\Process\Process::getComponentName (   $prettyName,
array  $extra = array() 
)

Retrieves the component name for the component.

Parameters
string$prettyNameThe Composer package name.
array$extraThe extra config options sent from Composer.
Returns
string The name of the component, without its vendor name.

Definition at line 154 of file Process.php.

References array.

Referenced by ComponentInstaller\Process\BuildJsProcess\compile(), ComponentInstaller\Process\CopyProcess\copy(), ComponentInstaller\Process\RequireCssProcess\packageStyles(), and ComponentInstaller\Process\RequireJsProcess\requireJson().

155  {
156  // Parse the pretty name for the vendor and name.
157  if (strpos($prettyName, '/') !== false) {
158  list($vendor, $name) = explode('/', $prettyName);
159  unset($vendor);
160  } else {
161  // Vendor wasn't found, so default to the pretty name instead.
162  $name = $prettyName;
163  }
164 
165  // Allow the component to define its own name.
166  $component = isset($extra['component']) ? $extra['component'] : array();
167  if (isset($component['name'])) {
168  $name = $component['name'];
169  }
170 
171  return $name;
172  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ getVendorDir()

ComponentInstaller\Process\Process::getVendorDir ( array  $package)

Retrieves the given package's vendor directory, where it's installed.

Parameters
array$packageThe package to retrieve the vendor directory for.
Returns
string

Definition at line 199 of file Process.php.

References $loader, and $path.

Referenced by ComponentInstaller\Process\RequireJsProcess\aggregateScripts(), ComponentInstaller\Process\CopyProcess\copy(), and ComponentInstaller\Process\RequireCssProcess\packageStyles().

200  {
201  // The root package vendor directory is not handled by getInstallPath().
202  if (isset($package['is-root']) && $package['is-root'] === true) {
203  $path = getcwd();
204 
205  if (!file_exists($path.DIRECTORY_SEPARATOR.'composer.json')) {
206  for ($temp = __DIR__; strlen($temp) > 3; $temp = dirname($temp)) {
207  if (file_exists($temp.DIRECTORY_SEPARATOR.'composer.json')) {
208  $path = $temp;
209  }
210  }
211  }
212 
213  return $path;
214  }
215 
216  if (!isset($package['version'])) {
217  $package['version'] = '1.0.0';
218  }
219  $loader = new ArrayLoader();
220  $completePackage = $loader->load($package);
221 
222  return $this->installationManager->getInstallPath($completePackage);
223  }
$path
Definition: aliased.php:25
+ Here is the caller graph for this function:

◆ process()

ComponentInstaller\Process\Process::process ( )

{Called when running through the process.

Returns
boolean True or false depending on whether the process was successful.
}

Implements ComponentInstaller\Process\ProcessInterface.

Definition at line 138 of file Process.php.

139  {
140  return false;
141  }

◆ setComponentDir()

ComponentInstaller\Process\Process::setComponentDir (   $dir)

Sets the component directory.

Parameters
string$dir
Returns
string

Definition at line 187 of file Process.php.

188  {
189  return $this->componentDir = $dir;
190  }

Field Documentation

◆ $componentDir

ComponentInstaller\Process\Process::$componentDir = 'components'
protected

◆ $composer

ComponentInstaller\Process\Process::$composer
protected

Definition at line 31 of file Process.php.

Referenced by ComponentInstaller\Process\Process\__construct().

◆ $config

ComponentInstaller\Process\Process::$config
protected

Definition at line 41 of file Process.php.

Referenced by ComponentInstaller\Process\RequireJsProcess\requireJson().

◆ $fs

ComponentInstaller\Process\Process::$fs
protected

Definition at line 56 of file Process.php.

◆ $installationManager

ComponentInstaller\Process\Process::$installationManager
protected

Definition at line 62 of file Process.php.

◆ $io

ComponentInstaller\Process\Process::$io
protected

Definition at line 36 of file Process.php.

Referenced by ComponentInstaller\Process\Process\__construct().

◆ $packages

ComponentInstaller\Process\Process::$packages = array()
protected

The documentation for this class was generated from the following file: