Commit efbe91ec authored by DamienMcKenna's avatar DamienMcKenna Committed by DamienMcKenna

Issue #2935402 by DamienMcKenna: Further improve coding standards compliance (D8)

parent c0a6615c
......@@ -9,6 +9,7 @@ Backup and Migrate 8.x-4.x-dev, xxxx-xx-xx
#2992448 by Pasqualle, riddhi.addweb: Warning after install.
#2935402 by DamienMcKenna, ikit-claw: Further improve coding standards
compliance.
#2935402 by DamienMcKenna: Further improve coding standards compliance.
Backup and Migrate 8.x-4.0, 2018-03-29
......
......@@ -26,7 +26,3 @@ If you require local file encryption support you will also need to install the p
Install the module as usual using Drush or the Drupal UI.
For more information on using composer see: https://getcomposer.org/
\ No newline at end of file
......@@ -18,7 +18,6 @@ class Config implements ConfigInterface {
*/
protected $config;
/**
* @param array $init
*/
......@@ -34,11 +33,13 @@ class Config implements ConfigInterface {
/**
* Get a setting value.
*
* @param string $key The key for the setting.
* @param string $key
* The key for the setting.
* @param mixed $default
* The default to return if the value does not exist.
* The default to return if the value does not exist.
*
* @return mixed The value of the setting.
* @return mixed
* The value of the setting.
*/
public function get($key, $default = NULL) {
return $this->keyIsSet($key) ? $this->config[$key] : $default;
......@@ -47,20 +48,23 @@ class Config implements ConfigInterface {
/**
* Set a setting value.
*
* @param string $key The key for the setting.
* @param mixed $value The value for the setting.
* @param string $key
* The key for the setting.
* @param mixed $value
* The value for the setting.
*/
public function set($key, $value) {
$this->config[$key] = $value;
}
/**
* Determine if the given key has had a value set for it.
*
* @param $key
* @param string $key
* The array key to check for.
*
* @return bool
* Whether the key is defined.
*/
public function keyIsSet($key) {
return isset($this->config[$key]);
......@@ -69,7 +73,8 @@ class Config implements ConfigInterface {
/**
* Get all settings as an associative array.
*
* @return array All of the settings in this profile
* @return array
* All of the settings in this profile.
*/
public function toArray() {
return $this->config;
......@@ -78,7 +83,8 @@ class Config implements ConfigInterface {
/**
* Set all from an array.
*
* @param array $values An associative array of settings.
* @param array $values
* An associative array of settings.
*/
public function fromArray($values) {
$this->config = $values;
......
<?php
/**
* @file
* Contains BackupMigrate\Core\Config\ValidationError.
*/
namespace BackupMigrate\Core\Config;
/**
* Class ValidationError.
*
......
<?php
/**
* @file
*/
namespace BackupMigrate\Core\Config;
/**
* Interface ValidationErrorInterface.
*
......
<?php
/**
* @file
* Contains BackupMigrate\Core\Destination\BrowserDownloadDestination.
*/
namespace BackupMigrate\Core\Destination;
use BackupMigrate\Core\Exception\DestinationNotWritableException;
use BackupMigrate\Core\File\BackupFileReadableInterface;
use BackupMigrate\Core\Plugin\PluginCallerInterface;
......
<?php
/**
* @file
* Contains BackupMigrate\Core\Destination\DebugDestination.
*/
namespace BackupMigrate\Core\Destination;
use BackupMigrate\Core\Config\Config;
use BackupMigrate\Core\File\BackupFileReadableInterface;
use BackupMigrate\Core\Plugin\PluginCallerInterface;
......
<?php
/**
* @file
* Contains \BackupMigrate\Core\Destination\DestinationBase.
*/
namespace BackupMigrate\Core\Destination;
use BackupMigrate\Core\Exception\DestinationNotWritableException;
......
<?php
/**
* @file
* Contains \BackupMigrate\Core\Destination\DestinationInterface.
*/
namespace BackupMigrate\Core\Destination;
use BackupMigrate\Core\Plugin\PluginInterface;
/**
* Provides an interface defining a backup destination (ie: a place where backup
* files are stored).
* Provides an interface defining a backup destination.
*
* ie: a place where backup files are stored).
*/
interface DestinationInterface extends PluginInterface {
......
<?php
/**
* @file
* Contains BackupMigrate\Core\Destination\ServerDirectoryDestination.
*/
namespace BackupMigrate\Core\Destination;
use BackupMigrate\Core\Config\ConfigurableInterface;
use BackupMigrate\Core\Exception\DestinationNotWritableException;
use BackupMigrate\Core\Plugin\FileProcessorInterface;
......
<?php
/**
* @file
*/
namespace BackupMigrate\Core\Destination;
use BackupMigrate\Core\File\BackupFileInterface;
/**
......@@ -14,18 +10,19 @@ use BackupMigrate\Core\File\BackupFileInterface;
* @package BackupMigrate\Core\Destination
*/
interface ListableDestinationInterface extends DestinationInterface {
/**
* Return a list of files from the destination. This list should be
* date ordered from newest to oldest.
*
* @TODO: Decide if extended metadata should ALWAYS be loaded here. Is there a use case for getting a list of files WITHOUT metadata?
* *
* @todo Decide if extended metadata should ALWAYS be loaded here. Is there
* a use case for getting a list of files WITHOUT metadata?
*
* @return BackupFileInterface[]
* An array of BackupFileInterface objects representing the files with
* the file ids as keys. The file ids are usually file names but that
* is up to the implementing destination to decide. The returned files
* may not be readable. Use loadFileForReading to get a readable file.
* An array of BackupFileInterface objects representing the files with
* the file ids as keys. The file ids are usually file names but that
* is up to the implementing destination to decide. The returned files
* may not be readable. Use loadFileForReading to get a readable file.
*/
public function listFiles();
......
<?php
/**
* @file
*/
namespace BackupMigrate\Core\Destination;
use BackupMigrate\Core\Config\ConfigurableInterface;
......@@ -27,13 +23,11 @@ class NodeSquirrelDestination extends DestinationBase implements RemoteDestinati
*/
protected $api_endpoint = [];
/**
* @var HttpClientInterface
*/
protected $http_client = NULL;
/**
* Get a definition for user-configurable settings.
*
......
<?php
/**
* @file
*/
namespace BackupMigrate\Core\Destination;
......
<?php
/**
* @file
*/
namespace BackupMigrate\Core\Destination;
/**
* Interface RemoteDestinationInterface.
*
......
<?php
/**
* @file
*/
namespace BackupMigrate\Core\Destination;
use BackupMigrate\Core\Plugin\FileProcessorTrait;
use BackupMigrate\Core\File\BackupFileInterface;
......
<?php
/**
* @file
* Contains BackupMigrate\Core\Destination\StreamDestination.
*/
namespace BackupMigrate\Core\Destination;
use BackupMigrate\Core\Config\ConfigurableInterface;
use BackupMigrate\Core\Exception\DestinationNotWritableException;
use BackupMigrate\Core\File\BackupFileInterface;
......
<?php
/**
* @file
*/
namespace BackupMigrate\Core\Destination;
use BackupMigrate\Core\File\BackupFileReadableInterface;
use BackupMigrate\Core\File\BackupFileReadableInterface;
/**
* Interface WritableDestinationInterface.
......@@ -13,11 +10,12 @@ use BackupMigrate\Core\File\BackupFileReadableInterface;
* @package BackupMigrate\Core\Destination
*/
interface WritableDestinationInterface extends DestinationInterface {
/**
* Save a file to the destination.
*
* @param \BackupMigrate\Core\File\BackupFileReadableInterface $file
* The file to save.
* The file to save.
*/
function saveFile(BackupFileReadableInterface $file);
......
<?php
/**
* @file
* Contains ${NAMESPACE}\BackupMirgateException.
*/
namespace BackupMigrate\Core\Exception;
......
<?php
/**
* @file
* Contains BackupMigrate\Core\Exception\DestinationNotWritableException.
*/
namespace BackupMigrate\Core\Exception;
/**
* Class DestinationNotWritableException.
*
* @package BackupMigrate\Core\Exception
*
* Thrown if a destination cannot be written to for any reason. May be recoverable
* if the backup operation specifies alternative destinations or fatal if not.
* Thrown if a destination cannot be written to for any reason. May be
* recoverable if the backup operation specifies alternative destinations or
* fatal if not.
*/
class DestinationNotWritableException extends BackupMigrateException {}
<?php
/**
* @file
*/
namespace BackupMigrate\Core\Exception;
/**
......
<?php
/**
* @file
* Contains BackupMigrate\Core\Exception\IgnorableException.
*/
namespace BackupMigrate\Core\Exception;
/**
* Class IgnorableException.
*
......
<?php
/**
* @file
* Contains \BackupMigrate\Core\File\BackupFile.
*/
namespace BackupMigrate\Core\File;
use BackupMigrate\Core\File\BackupFileInterface;
......@@ -15,6 +10,7 @@ use BackupMigrate\Core\File\BackupFileInterface;
* @package BackupMigrate\Core\File
*/
class BackupFile implements BackupFileInterface {
/**
* The file info (size, timestamp, etc.).
*
......
<?php
/**
* @file
* Contains \BackupMigrate\Core\File\BackupFileInterface.
*/
namespace BackupMigrate\Core\File;
/**
* Provides a metadata-only file object. If the file needs to be readable or
* writable use \BackupMigrate\Core\File\BackupFileReadableInterface or
* Provides a metadata-only file object.
*
* If the file needs to be readable or writable use
* \BackupMigrate\Core\File\BackupFileReadableInterface or
* \BackupMigrate\Core\File\BackupFileWritableInterface.
*/
interface BackupFileInterface {
......
<?php
/**
* @file
* Contains \BackupMigrate\Core\File\BackupFileReadableInterface.
*/
namespace BackupMigrate\Core\File;
/**
......
<?php
/**
* @file
* Contains \BackupMigrate\Core\File\BackupFileInterface.
*/
namespace BackupMigrate\Core\File;
/**
......
<?php
/**
* @file
* Contains BackupMigrate\Core\File\ReadableStream.
*/
namespace BackupMigrate\Core\File;
......
<?php
/**
* @file
* Contains \BackupMigrate\Core\Services\TempFileManager.
*/
namespace BackupMigrate\Core\File;
use BackupMigrate\Core\Exception\BackupMigrateException;
/**
......
<?php
/**
* @file
* Contains \BackupMigrate\Core\Services\TempFileManagerInterface.
*/
namespace BackupMigrate\Core\File;
/**
* Provides a service to provision temp files in the correct place for the environment.
*/
interface TempFileAdapterInterface {
/**
* Get a temporary file that can be written to.
*
......
<?php
/**
* @file
* Contains \BackupMigrate\Core\Services\TempFileManagerInterface.
*/
namespace BackupMigrate\Core\File;
/**
* Class TempFileManager.
*
......
<?php
/**
* @file
* Contains \BackupMigrate\Core\Services\TempFileManagerInterface.
*/
namespace BackupMigrate\Core\File;
......
<?php
/**
* @file
* Contains \BackupMigrate\Core\File\TempFile.
*/
// Must be injected:
// Temp directory.
namespace BackupMigrate\Core\File;
......
<?php
/**
* @file
*/
namespace BackupMigrate\Core\Filter;
use BackupMigrate\Core\Config\Config;
......
<?php
/**
* @file
* Contains BackupMigrate\Core\Filter\DBExcludeFilter.
*/
namespace BackupMigrate\Core\Filter;
use BackupMigrate\Core\Config\Config;
use BackupMigrate\Core\Plugin\PluginBase;
use BackupMigrate\Core\Plugin\PluginManager;
......
<?php
/**
* @file
* Contains BackupMigrate\Core\Filter\FileExcludeFilter.
*/
namespace BackupMigrate\Core\Filter;
use BackupMigrate\Core\Config\Config;
use BackupMigrate\Core\Plugin\PluginBase;
......
<?php
/**
* @file
* Contains BackupMigrate\Core\Filter\FileNamer.
*/
namespace BackupMigrate\Core\Filter;
use BackupMigrate\Core\Config\Config;
use BackupMigrate\Core\Config\ValidationError;
use BackupMigrate\Core\Plugin\FileProcessorInterface;
......
<?php
/**
* @file
* Contains BackupMigrate\Core\Filter\MetadataWriter.
*/
namespace BackupMigrate\Core\Filter;
use BackupMigrate\Core\Config\Config;
use BackupMigrate\Core\File\BackupFileWritableInterface;
use BackupMigrate\Core\Plugin\FileProcessorInterface;
......
<?php
/**
* @file
* Contains BackupMigrate\Core\Filter\Notify
*/
namespace BackupMigrate\Core\Filter;
use BackupMigrate\Core\Plugin\PluginBase;
use BackupMigrate\Core\Plugin\PluginCallerInterface;
use BackupMigrate\Core\Plugin\PluginCallerTrait;
......
<?php
/**
* @file
* Contains \BackupMigrate\Core\Services\BackupMigrate.
*/
namespace BackupMigrate\Core\Main;
use BackupMigrate\Core\Config\ConfigInterface;
......@@ -148,7 +143,7 @@ class BackupMigrate implements BackupMigrateInterface {
// Do the actual source restore.
$import_result = $source->importFromFile($file);
if(!$import_result) {
if (!$import_result) {
throw new BackupMigrateException('The file could not be imported.');
}
......
<?php
/**
* @file
* Contains \BackupMigrate\Core\Services\BackupMigrateInterface.
*/
namespace BackupMigrate\Core\Main;
use BackupMigrate\Core\Service\ServiceManager;
use BackupMigrate\Core\Plugin\PluginManagerInterface;
use BackupMigrate\Core\Plugin\PluginCallerInterface;
/**
* The core Backup and Migrate service.
*/
......
<?php
/**
* @file
*/
namespace BackupMigrate\Core\Plugin;
use BackupMigrate\Core\File\TempFileManagerInterface;
/**
......
<?php
/**
* @file
*/
namespace BackupMigrate\Core\Plugin;
use BackupMigrate\Core\File\TempFileManagerInterface;
/**
......
<?php
/**
* @file
*/
namespace BackupMigrate\Core\Plugin;
......