Skip to content

Commit

Permalink
Some changes in Scrutinizer config + fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitaly Baev committed May 9, 2018
1 parent 2c5f1bb commit ec3fba8
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .scrutinizer.yml
Expand Up @@ -5,5 +5,7 @@ coding_style:
spaces: spaces:
around_operators: around_operators:
concatenation: true concatenation: true
ternary_operator:
in_short_version: false
other: other:
after_type_cast: true after_type_cast: true
2 changes: 1 addition & 1 deletion src/Backup/Crypter/Mcrypt.php
Expand Up @@ -112,7 +112,7 @@ public function getSuffix() : string
*/ */
protected function createExecutable(Target $target) : Executable protected function createExecutable(Target $target) : Executable
{ {
$executable = new Executable\Mcrypt((string)$this->pathToMcrypt); $executable = new Executable\Mcrypt((string) $this->pathToMcrypt);
$executable->useAlgorithm($this->algorithm) $executable->useAlgorithm($this->algorithm)
->useKey($this->key) ->useKey($this->key)
->useKeyFile($this->keyFile) ->useKeyFile($this->keyFile)
Expand Down
2 changes: 1 addition & 1 deletion src/Backup/File/OpenStack.php
Expand Up @@ -35,7 +35,7 @@ public function __construct($container, $object)
$this->container = $container; $this->container = $container;
$this->filename = basename($object->name); $this->filename = basename($object->name);
$this->pathname = $object->name; $this->pathname = $object->name;
$this->size = (int)$object->contentLength; $this->size = (int) $object->contentLength;
$this->lastModified = $object->lastModified->getTimestamp(); $this->lastModified = $object->lastModified->getTimestamp();
} }


Expand Down
2 changes: 1 addition & 1 deletion src/Backup/Sync/Ftp.php
Expand Up @@ -87,7 +87,7 @@ protected function getProtocolName()
public function sync(Target $target, Result $result) public function sync(Target $target, Result $result)
{ {
// silence ftp errors // silence ftp errors
$old = error_reporting(0); $old = error_reporting(0);
if (!$this->ftpConnection = ftp_connect($this->host)) { if (!$this->ftpConnection = ftp_connect($this->host)) {
throw new Exception( throw new Exception(
sprintf( sprintf(
Expand Down
2 changes: 1 addition & 1 deletion src/Backup/Target/Compression/Factory.php
Expand Up @@ -56,7 +56,7 @@ public static function create($name)
public static function getClassName($name) public static function getClassName($name)
{ {
if (!isset(self::$availableCompressors[$name])) { if (!isset(self::$availableCompressors[$name])) {
throw new Exception('Invalid compressor: ' .$name); throw new Exception('Invalid compressor: ' . $name);
} }
$class = self::$availableCompressors[$name]; $class = self::$availableCompressors[$name];
return '\\phpbu\\App\\Backup\\Target\\Compression\\' . $class; return '\\phpbu\\App\\Backup\\Target\\Compression\\' . $class;
Expand Down
8 changes: 4 additions & 4 deletions src/Log/Mail.php
Expand Up @@ -183,15 +183,15 @@ public function setup(array $options)
*/ */
public function onPhpbuEnd(Event\App\End $event) public function onPhpbuEnd(Event\App\End $event)
{ {
$result = $event->getResult(); $result = $event->getResult();


if ($this->shouldMailBeSend($result)) { if ($this->shouldMailBeSend($result)) {
$header = $this->getHeaderHtml(); $header = $this->getHeaderHtml();
$status = $this->getStatusHtml($result); $status = $this->getStatusHtml($result);
$errors = $this->getErrorHtml($result); $errors = $this->getErrorHtml($result);
$info = $this->getInfoHtml($result); $info = $this->getInfoHtml($result);
$footer = $this->getFooterHtml(); $footer = $this->getFooterHtml();
$body = '<html><body '. TPL::getSnippet('sBody') . '>' $body = '<html><body ' . TPL::getSnippet('sBody') . '>'
. $header . $header
. $status . $status
. $errors . $errors
Expand Down Expand Up @@ -410,7 +410,7 @@ protected function getStatusHtml(Result $result)
$this->numCleanups, $this->numCleanups,
Str::appendPluralS('cleanup', $this->numCleanups) Str::appendPluralS('cleanup', $this->numCleanups)
); );
$html = '<table ' . sprintf(TPL::getSnippet('sTableStatus'), $color) .'>' . $html = '<table ' . sprintf(TPL::getSnippet('sTableStatus'), $color) . '>' .
'<tr><td>' . '<tr><td>' .
'<span ' . TPL::getSnippet('sTableStatusText') . '>' . date('Y-m-d H:i') . '</span>' . '<span ' . TPL::getSnippet('sTableStatusText') . '>' . date('Y-m-d H:i') . '</span>' .
'<h1 ' . TPL::getSnippet('sTableStatusHead') . '>' . $status . '</h1>' . '<h1 ' . TPL::getSnippet('sTableStatusHead') . '>' . $status . '</h1>' .
Expand Down Expand Up @@ -478,7 +478,7 @@ protected function getInfoHtml(Result $result)
$html .= '<tr>' . $html .= '<tr>' .
'<td ' . sprintf(TPL::getSnippet('sTableBackupStatusColumn'), $color) . ' colspan="4">' . '<td ' . sprintf(TPL::getSnippet('sTableBackupStatusColumn'), $color) . ' colspan="4">' .
sprintf('backup <em>%s</em>', $backup->getName()) . sprintf('backup <em>%s</em>', $backup->getName()) .
' <span ' . TPL::getSnippet('sTableBackupStatusText') . '>' . $status .'</span>'. ' <span ' . TPL::getSnippet('sTableBackupStatusText') . '>' . $status . '</span>'.
'</td>' . '</td>' .
'</tr>' . '</tr>' .
'<tr>' . '<tr>' .
Expand Down
4 changes: 2 additions & 2 deletions src/Log/ResultFormatter/Template.php
Expand Up @@ -133,7 +133,7 @@ private function renderErrors(string $errorTpl, array $errors) : string
$markup = ''; $markup = '';
/* @var $e \Exception */ /* @var $e \Exception */
foreach ($errors as $e) { foreach ($errors as $e) {
$data = [ $data = [
'class' => get_class($e), 'class' => get_class($e),
'message' => $e->getMessage(), 'message' => $e->getMessage(),
'file' => $e->getFile(), 'file' => $e->getFile(),
Expand All @@ -156,7 +156,7 @@ private function renderBackups(string $backupTpl, array $backups) : string
$markup = ''; $markup = '';
/* @var $b \phpbu\App\Result\Backup */ /* @var $b \phpbu\App\Result\Backup */
foreach ($backups as $b) { foreach ($backups as $b) {
$data = [ $data = [
'name' => $b->getName(), 'name' => $b->getName(),
'status' => $b->allOk() ? 0 : 1, 'status' => $b->allOk() ? 0 : 1,
'checkCount' => $b->checkCount(), 'checkCount' => $b->checkCount(),
Expand Down

0 comments on commit ec3fba8

Please sign in to comment.