Skip to content
This repository was archived by the owner on Dec 7, 2019. It is now read-only.

Commit d89b662

Browse files
committed
CS Fixes.
1 parent 182f1f8 commit d89b662

11 files changed

+25
-44
lines changed

docs/DIAGNOSTICS.md

+1-17
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,7 @@
1212

1313
## Available checks
1414

15-
* All checks from [ZendDiagnostics](https://github.com/zendframework/ZendDiagnostics#zenddiagnostics):
16-
* [ApcFragmentation](https://github.com/zendframework/ZendDiagnostics#apcfragmentation) - check if APC memory fragmentation is below given threshold,
17-
* [ApcMemory](https://github.com/zendframework/ZendDiagnostics#apcmemory) - check available APC memory,
18-
* [Callback](https://github.com/zendframework/ZendDiagnostics#callback) - call a user-defined diagnostic function,
19-
* [ClassExists](https://github.com/zendframework/ZendDiagnostics#classexists) - make sure class exists in current environment,
20-
* [CpuPerformance](https://github.com/zendframework/ZendDiagnostics#cpuperformance) - check server CPU performance is above baseline,
21-
* [DirReadable](https://github.com/zendframework/ZendDiagnostics#dirreadable) - make sure given path is readable,
22-
* [DirWritable](https://github.com/zendframework/ZendDiagnostics#dirwritable) - make sure given path is writable,
23-
* [DiskFree](https://github.com/zendframework/ZendDiagnostics#diskfree) - check there's enough free space on given path,
24-
* [ExtensionLoaded](https://github.com/zendframework/ZendDiagnostics#extensionloaded) - make sure extension is loaded,
25-
* [HttpService](https://github.com/zendframework/ZendDiagnostics#httpservice) - check if given http host is responding,
26-
* [Memcache](https://github.com/zendframework/ZendDiagnostics#memcache) - check if memcache extension is loaded and given server is reachable,
27-
* [PhpVersion](https://github.com/zendframework/ZendDiagnostics#phpversion) - make sure that PHP version matches constraint,
28-
* [PhpFlag](https://github.com/zendframework/ZendDiagnostics#phpflag) - make sure that given PHP flag (feature) is turned on or off.
29-
* [ProcessRunning](https://github.com/zendframework/ZendDiagnostics#processrunning) - check if a process with given name or ID is currently running,
30-
* [SecurityAdvisory](https://github.com/zendframework/ZendDiagnostics#securityadvisory) - check installed composer dependencies against SensioLabs SA database,
31-
* [SteamWrapperExists](https://github.com/zendframework/ZendDiagnostics#streamwrapperexists) - make sure given stream wrapper is available.
15+
* All checks from [ZendDiagnostics](https://github.com/zendframework/ZendDiagnostics#zenddiagnostics)
3216

3317
## Running diagnostics in console
3418

src/ZFTool/Controller/DiagnosticsController.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -56,20 +56,21 @@ public function runAction()
5656
if ($checkGroupName) {
5757
$config = array_intersect_ukey($config, array($checkGroupName => 1), 'strcasecmp');
5858

59-
if(empty($config)) {
59+
if (empty($config)) {
6060
$m = new ConsoleModel();
6161
$m->setResult($console->colorize(sprintf(
6262
"Unable to find a group of diagnostic checks called \"%s\". Try to use module name (i.e. \"%s\").\n",
6363
$checkGroupName,
6464
'Application'
6565
), ColorInterface::YELLOW));
6666
$m->setErrorLevel(1);
67+
6768
return $m;
6869
}
6970
}
7071

7172
// Check if there are any diagnostic checks defined
72-
if(empty($config)) {
73+
if (empty($config)) {
7374
$m = new ConsoleModel();
7475
$m->setResult(
7576
$console->colorize(
@@ -80,6 +81,7 @@ public function runAction()
8081
, ColorInterface::YELLOW)
8182
);
8283
$m->setErrorLevel(1);
84+
8385
return $m;
8486
}
8587

src/ZFTool/Diagnostics/Config.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
namespace ZFTool\Diagnostics;
33

44
use Zend\Stdlib\AbstractOptions;
5-
use \Traversable;
65

76
class Config extends AbstractOptions implements ConfigInterface
87
{
@@ -45,7 +44,7 @@ public function getBreakOnFailure()
4544
*/
4645
public function setCatchErrorSeverity($catchErrorSeverity)
4746
{
48-
$this->catchErrorSeverity = (int)$catchErrorSeverity;
47+
$this->catchErrorSeverity = (int) $catchErrorSeverity;
4948
}
5049

5150
/**
@@ -58,5 +57,4 @@ public function getCatchErrorSeverity()
5857
return $this->catchErrorSeverity;
5958
}
6059

61-
6260
}

src/ZFTool/Diagnostics/ConfigInterface.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ interface ConfigInterface
66
/**
77
* Should diagnostics stop on first failure.
88
*
9-
* @param bool $break
9+
* @param bool $break
1010
* @return void
1111
*/
1212
public function setBreakOnFailure($break);

src/ZFTool/Diagnostics/Reporter/BasicConsole.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ public function __construct(Console $console)
4141
/**
4242
* This method is called right after Reporter starts running, via Runner::run()
4343
*
44-
* @param ArrayObject $checks
45-
* @param array $runnerConfig
44+
* @param ArrayObject $checks
45+
* @param array $runnerConfig
4646
* @return void
4747
*/
4848
public function onStart(ArrayObject $checks, $runnerConfig)

src/ZFTool/Diagnostics/Reporter/VerboseConsole.php

+4-5
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,6 @@ public function onFinish(ResultsCollection $results)
202202
$this->console->writeLine('Diagnostics aborted because of a failure.', Color::RED);
203203
}
204204

205-
206205
// Display a summary line
207206
if ($results->getFailureCount() == 0 && $results->getWarningCount() == 0 && $results->getUnknownCount() == 0) {
208207
$line = 'OK (' . $this->total . ' diagnostic checks)';
@@ -283,7 +282,7 @@ public function getConsole()
283282
*/
284283
public function setDisplayData($displayData)
285284
{
286-
$this->displayData = (bool)$displayData;
285+
$this->displayData = (bool) $displayData;
287286
}
288287

289288
/**
@@ -298,9 +297,9 @@ public function getDisplayData()
298297
/**
299298
* Apply padding and word-wrapping for a string.
300299
*
301-
* @param string $string The string to transform
302-
* @param int $width Maximum width at which the string should be wrapped to the next line
303-
* @param int $padding The left-side padding to apply
300+
* @param string $string The string to transform
301+
* @param int $width Maximum width at which the string should be wrapped to the next line
302+
* @param int $padding The left-side padding to apply
304303
* @return string The padded and wrapped string
305304
*/
306305
protected function strColPad($string, $width, $padding)

src/ZFTool/Diagnostics/Runner.php

+5-4
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,19 @@ public function __construct($config = null, $checks = null, ReporterInterface $r
3232
/**
3333
* Run all Checks and return a Result\Collection for every check.
3434
*
35-
* @param string|null $checkAlias An alias of Check instance to run, or null to run all checks.
35+
* @param string|null $checkAlias An alias of Check instance to run, or null to run all checks.
3636
* @return ResultsCollection The result of running Checks
3737
*/
3838
public function run($checkAlias = null)
3939
{
4040
$this->breakOnFailure = $this->config->getBreakOnFailure();
4141
$this->catchErrorSeverity = $this->config->getBreakOnFailure();
42+
4243
return parent::run($checkAlias);
4344
}
4445

4546
/**
46-
* @param ConfigInterface|array $config
47+
* @param ConfigInterface|array $config
4748
* @throws Exception\InvalidArgumentException
4849
* @return void
4950
*/
@@ -75,7 +76,7 @@ public function getConfig()
7576
*/
7677
public function setBreakOnFailure($breakOnFailure)
7778
{
78-
$this->config->setBreakOnFailure((bool)$breakOnFailure);
79+
$this->config->setBreakOnFailure((bool) $breakOnFailure);
7980
}
8081

8182
/**
@@ -94,7 +95,7 @@ public function getBreakOnFailure()
9495
*/
9596
public function setCatchErrorSeverity($catchErrorSeverity)
9697
{
97-
$this->config->setCatchErrorSeverity((int)$catchErrorSeverity);
98+
$this->config->setCatchErrorSeverity((int) $catchErrorSeverity);
9899
}
99100

100101
/**

tests/ZFToolTest/Diagnostics/DiagnosticsControllerTest.php

+5-3
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ public function testModuleProvidedDefinitions()
409409
);
410410

411411
$x = 0;
412-
foreach($results as $check){
412+
foreach ($results as $check) {
413413
$result = $results[$check];
414414
list($label, $class, $message) = $expected[$x++];
415415
error_reporting(E_ERROR);
@@ -548,10 +548,11 @@ public function testIgnoreNumericLabel()
548548
public function testInvalidDefinitions($definition, $exceptionMessage)
549549
{
550550
$this->config['diagnostics']['group']['foo'] = $definition;
551-
try{
551+
try {
552552
$res = $this->controller->dispatch(new ConsoleRequest());
553-
}catch(RuntimeException $e){
553+
} catch (RuntimeException $e) {
554554
$this->assertStringMatchesFormat($exceptionMessage, $e->getMessage());
555+
555556
return;
556557
}
557558
$this->fail('Definition is invalid!');
@@ -723,6 +724,7 @@ public function testErrorCodes()
723724
public static function staticTestMethod($message = 'bar', $data = null)
724725
{
725726
static::$staticTestMethodCalled = true;
727+
726728
return new Success($message, $data);
727729
}
728730

tests/ZFToolTest/Diagnostics/RunnerTest.php

-4
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,7 @@
22
namespace ZFToolTest\Diagnostics;
33

44
use ZFTool\Diagnostics\Config;
5-
use ZFToolTest\Diagnostics\TestAsset\UnknownResult as Unknown;
65
use ZFTool\Diagnostics\Runner;
7-
use ZendDiagnostics\Result\Success;
8-
use ZendDiagnostics\Result\Failure;
9-
use ZendDiagnostics\Result\Warning;
106

117
require_once __DIR__.'/TestAsset/UnknownResult.php';
128

tests/ZFToolTest/Diagnostics/TestAsset/DummyModule.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function __construct(ServiceLocatorInterface $sm)
2323
public function getDiagnostics()
2424
{
2525
return array(
26-
'test1' => function() {return new Success('test1 success');},
26+
'test1' => function () {return new Success('test1 success');},
2727
'test2' => array('is_string', 'a'),
2828
'test3' => array('stristr', 'abc','d'),
2929
'test4' => array(__CLASS__,'staticTestMethod'),

tests/ZFToolTest/Diagnostics/TestAsset/InjectableModuleManager.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@
22

33
namespace ZFToolTest\TestAsset;
44

5-
use Zend\EventManager\EventManager;
65
use Zend\ModuleManager\ModuleManager;
76

87
/**
98
* Module manager
109
*/
1110
class InjectableModuleManager extends ModuleManager
1211
{
13-
public function __construct(){}
12+
public function __construct() {}
1413

1514
public function injectModule($name, $module)
1615
{

0 commit comments

Comments
 (0)