phpseclib/src/42ceff0b-226d-42ff-9ffa-3d5.../code.power

83 lines
1.8 KiB
Plaintext

/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
* @since 3.2.0
*/
public function register(Container $container)
{
$container->alias(Client::class, 'Server')
->share('Server', [$this, 'getServer'], true);
$container->alias(Load::class, 'Server.Load')
->share('Server.Load', [$this, 'getServerLoad'], true);
$container->alias(Ftp::class, 'Server.FTP')
->share('Server.FTP', [$this, 'getServerFtp'], true);
$container->alias(Sftp::class, 'Server.SFTP')
->share('Server.SFTP', [$this, 'getServerSftp'], true);
}
/**
* Get the Server Client class
*
* @param Container $container The DI container.
*
* @return Client
* @since 3.2.0
*/
public function getServer(Container $container): Client
{
return new Client(
$container->get('Server.Load'),
$container->get('Server.FTP'),
$container->get('Server.SFTP')
);
}
/**
* Get the Server Load class
*
* @param Container $container The DI container.
*
* @return Load
* @since 3.2.0
*/
public function getServerLoad(Container $container): Load
{
return new Load(
$container->get('Load'),
$container->get('Model.Server.Load')
);
}
/**
* Get the Server Ftp class
*
* @param Container $container The DI container.
*
* @return Ftp
* @since 3.2.0
*/
public function getServerFtp(Container $container): Ftp
{
return new Ftp();
}
/**
* Get the Server Sftp class
*
* @param Container $container The DI container.
*
* @return Sftp
* @since 3.2.0
*/
public function getServerSftp(Container $container): Sftp
{
return new Sftp(
$container->get('Crypt.Key')
);
}