Adds some PHP 8 ready changes to compiler classes. Adds Server and Crypt classes.
This commit is contained in:
@ -20,6 +20,8 @@ use phpseclib3\Crypt\DES;
|
||||
use VDM\Joomla\Componentbuilder\Crypt as Crypto;
|
||||
use VDM\Joomla\Componentbuilder\Crypt\KeyLoader;
|
||||
use VDM\Joomla\Componentbuilder\Crypt\Random;
|
||||
use VDM\Joomla\Componentbuilder\Crypt\Password;
|
||||
use VDM\Joomla\Componentbuilder\Crypt\FOF;
|
||||
|
||||
|
||||
/**
|
||||
@ -45,6 +47,12 @@ class Crypt implements ServiceProviderInterface
|
||||
$container->alias(Random::class, 'Crypt.Random')
|
||||
->share('Crypt.Random', [$this, 'getRandom'], true);
|
||||
|
||||
$container->alias(Password::class, 'Crypt.Password')
|
||||
->share('Crypt.Password', [$this, 'getPassword'], true);
|
||||
|
||||
$container->alias(FOF::class, 'Crypt.FOF')
|
||||
->share('Crypt.FOF', [$this, 'getFOF'], true);
|
||||
|
||||
$container->alias(KeyLoader::class, 'Crypt.Key')
|
||||
->share('Crypt.Key', [$this, 'getKeyLoader'], true);
|
||||
|
||||
@ -93,7 +101,23 @@ class Crypt implements ServiceProviderInterface
|
||||
*/
|
||||
public function getCrypt(Container $container): Crypto
|
||||
{
|
||||
return new Crypto();
|
||||
return new Crypto(
|
||||
$container->get('Crypt.FOF'),
|
||||
$container->get('Crypt.Password')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Password class
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Password
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getPassword(Container $container): Password
|
||||
{
|
||||
return new Password();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -109,6 +133,22 @@ class Crypt implements ServiceProviderInterface
|
||||
return new Random();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the FOF AES Cyper with CBC mode
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return FOF
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getFOF(Container $container): FOF
|
||||
{
|
||||
return new FOF(
|
||||
$container->get('Crypt.AES.CBC'),
|
||||
$container->get('Crypt.Random')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the KeyLoader class
|
||||
*
|
||||
|
@ -0,0 +1,114 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Service;
|
||||
|
||||
|
||||
use Joomla\DI\Container;
|
||||
use Joomla\DI\ServiceProviderInterface;
|
||||
use VDM\Joomla\Componentbuilder\Server as Client;
|
||||
use VDM\Joomla\Componentbuilder\Server\Load;
|
||||
use VDM\Joomla\Componentbuilder\Server\Ftp;
|
||||
use VDM\Joomla\Componentbuilder\Server\Sftp;
|
||||
|
||||
|
||||
/**
|
||||
* Server Service Provider
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Server implements ServiceProviderInterface
|
||||
{
|
||||
/**
|
||||
* 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')
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user