Bearsampp 2025.8.29
Loading...
Searching...
No Matches
ToolComposer Class Reference
Inheritance diagram for ToolComposer:

Public Member Functions

 __construct ($id, $type)
 getExe ()
 reload ($id=null, $type=null)
 setVersion ($version)
Public Member Functions inherited from Module
 __toString ()
 getCurrentPath ()
 getId ()
 getName ()
 getRelease ()
 getRootPath ()
 getSymlinkPath ()
 getType ()
 getVersion ()
 getVersionList ()
 isEnable ()
 update ($sub=0, $showWindow=false)

Data Fields

const LOCAL_CFG_EXE = 'composerExe'
const ROOT_CFG_VERSION = 'composerVersion'
Data Fields inherited from Module
const BUNDLE_RELEASE = 'bundleRelease'

Private Attributes

 $exe

Additional Inherited Members

Protected Member Functions inherited from Module
 __construct ()
 replace ($key, $value)
 replaceAll ($params)
 updateConfig ($version=null, $sub=0, $showWindow=false)
Protected Attributes inherited from Module
 $bearsamppConf
 $bearsamppConfRaw
 $currentPath
 $enable
 $name
 $release = 'N/A'
 $rootPath
 $symlinkPath
 $version

Detailed Description

Class ToolComposer

This class represents the Composer tool module in the Bearsampp application. It extends the abstract Module class and provides functionalities specific to Composer.

Definition at line 16 of file class.tool.composer.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( $id,
$type )

Constructor for the ToolComposer class.

Parameters
string$idThe ID of the module.
string$typeThe type of the module.

Definition at line 41 of file class.tool.composer.php.

41 {
42 Util::logInitClass($this);
43 $this->reload($id, $type);
44 }
reload($id=null, $type=null)
static logInitClass($classInstance)

References Module\$id, Module\$type, Util\logInitClass(), and reload().

Member Function Documentation

◆ getExe()

getExe ( )

Gets the path to the Composer executable.

Returns
string The path to the Composer executable.

Definition at line 100 of file class.tool.composer.php.

100 {
101 return $this->exe;
102 }

References $exe.

◆ reload()

reload ( $id = null,
$type = null )

Reloads the Composer module configuration based on the provided ID and type.

Parameters
string | null$idThe ID of the module. If null, the current ID is used.
string | null$typeThe type of the module. If null, the current type is used.

Reimplemented from Module.

Definition at line 52 of file class.tool.composer.php.

52 {
55
56 $this->name = $bearsamppLang->getValue(Lang::COMPOSER);
57 $this->version = $bearsamppConfig->getRaw(self::ROOT_CFG_VERSION);
58 parent::reload($id, $type);
59
60 if ($this->bearsamppConfRaw !== false) {
61 $this->exe = $this->symlinkPath . '/' . $this->bearsamppConfRaw[self::LOCAL_CFG_EXE];
62 }
63
64 if (!$this->enable) {
65 Util::logInfo($this->name . ' is not enabled!');
66 return;
67 }
68 if (!is_dir($this->currentPath)) {
69 Util::logError(sprintf($bearsamppLang->getValue(Lang::ERROR_FILE_NOT_FOUND), $this->name . ' ' . $this->version, $this->currentPath));
70 }
71 if (!is_dir($this->symlinkPath)) {
72 Util::logError(sprintf($bearsamppLang->getValue(Lang::ERROR_FILE_NOT_FOUND), $this->name . ' ' . $this->version, $this->symlinkPath));
73 return;
74 }
75 if (!is_file($this->bearsamppConf)) {
76 Util::logError(sprintf($bearsamppLang->getValue(Lang::ERROR_CONF_NOT_FOUND), $this->name . ' ' . $this->version, $this->bearsamppConf));
77 }
78 if (!is_file($this->exe)) {
79 Util::logError(sprintf($bearsamppLang->getValue(Lang::ERROR_EXE_NOT_FOUND), $this->name . ' ' . $this->version, $this->exe));
80 }
81 }
global $bearsamppLang
const COMPOSER
const ERROR_EXE_NOT_FOUND
const ERROR_CONF_NOT_FOUND
const ERROR_FILE_NOT_FOUND
static logError($data, $file=null)
static logInfo($data, $file=null)
static logReloadClass($classInstance)
global $bearsamppConfig
Definition homepage.php:27

References $bearsamppConfig, $bearsamppLang, Module\$id, Module\$type, Lang\COMPOSER, Lang\ERROR_CONF_NOT_FOUND, Lang\ERROR_EXE_NOT_FOUND, Lang\ERROR_FILE_NOT_FOUND, Util\logError(), Util\logInfo(), and Util\logReloadClass().

Referenced by __construct(), and setVersion().

◆ setVersion()

setVersion ( $version)

Sets the version of the Composer module and updates the configuration.

Parameters
string$versionThe version to set.

Reimplemented from Module.

Definition at line 88 of file class.tool.composer.php.

88 {
89 global $bearsamppConfig;
90 $this->version = $version;
91 $bearsamppConfig->replace(self::ROOT_CFG_VERSION, $version);
92 $this->reload();
93 }

References $bearsamppConfig, Module\$version, and reload().

Field Documentation

◆ $exe

$exe
private

Definition at line 33 of file class.tool.composer.php.

Referenced by getExe().

◆ LOCAL_CFG_EXE

const LOCAL_CFG_EXE = 'composerExe'

Configuration key for the Composer executable in the local configuration.

Definition at line 26 of file class.tool.composer.php.

◆ ROOT_CFG_VERSION

const ROOT_CFG_VERSION = 'composerVersion'

Configuration key for the Composer version in the root configuration.

Definition at line 21 of file class.tool.composer.php.


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