Completed
Push — master ( a6e986...36a29e )
by Andreas
10:44
created

SelfTestCliOsChecks::doTest()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 9
rs 9.6666
c 1
b 0
f 1
cc 2
eloc 5
nc 2
nop 0
1
<?php
2
3
/**
4
 * This file is part of tenside/core.
5
 *
6
 * (c) Christian Schiffler <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 *
11
 * This project is provided in good faith and hope to be usable by anyone.
12
 *
13
 * @package    tenside/core
14
 * @author     Christian Schiffler <[email protected]>
15
 * @copyright  2015 Christian Schiffler <[email protected]>
16
 * @license    https://github.com/tenside/core/blob/master/LICENSE MIT
17
 * @link       https://github.com/tenside/core
18
 * @filesource
19
 */
20
21
namespace Tenside\Core\SelfTest\Cli;
22
23
use Tenside\Core\SelfTest\AbstractSelfTest;
24
25
/**
26
 * This class tests for any OS specific hacks that shall get enabled.
27
 */
28
class SelfTestCliOsChecks extends AbstractSelfTest
29
{
30
    /**
31
     * Perform all checks.
32
     *
33
     * @return void
34
     */
35
    public function doTest()
36
    {
37
        $this->setMessage('Check if any OS specific workaround should be enabled.');
38
39
        $flagged = $this->checkDarwin();
40
        if (!$flagged) {
41
            $this->markSuccess('Good, no hacks in place');
42
        }
43
    }
44
45
    /**
46
     * Check if any Darwin specific hacks must get enabled.
47
     *
48
     * @return bool True if modified, false otherwise.
49
     */
50
    private function checkDarwin()
1 ignored issue
show
Coding Style introduced by
function checkDarwin() does not seem to conform to the naming convention (^(?:is|has|should|may|supports)).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
51
    {
52
        if ('Darwin' !== PHP_OS) {
53
            return false;
54
        }
55
56
        // Apply hack to force process into background as it keeps sticky on Darwin.
57
        // Dunno why but as I lack the hardware and knowledge of said OS, this hack will have to do.
58
        $this->getAutoConfig()->setForceToBackground(true);
59
        $this->markSuccess(
60
            'Mac OS X (Darwin) detected, force-to-background-workaround enabled.'
61
        );
62
63
        return true;
64
    }
65
}
66