Passed
Push — master ( 0336f4...58f541 )
by Gaetano
05:32
created

output()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 2
eloc 1
c 1
b 0
f 1
nc 1
nop 1
dl 0
loc 3
ccs 1
cts 1
cp 1
crap 2
rs 10
1
<?php
2
/**
3
 * Hackish code used to make the demos both viewable as source, runnable, and viewable as html
4
 */
5
6
if (isset($_GET['showSource']) && $_GET['showSource']) {
7
    $file = debug_backtrace()[0]['file'];
8
    highlight_file($file);
9
    die();
10
}
11
12
// Make errors visible
13
ini_set('display_errors', true);
0 ignored issues
show
Bug introduced by
true of type true is incompatible with the type string expected by parameter $value of ini_set(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

13
ini_set('display_errors', /** @scrutinizer ignore-type */ true);
Loading history...
14
error_reporting(E_ALL);
15
16
// Use the custom class autoloader. These two lines not needed when the phpxmlrpc library is installed using Composer
17
include_once __DIR__ . '/../../src/Autoloader.php';
18
PhpXmlRpc\Autoloader::register();
19
20
// Let unit tests run against localhost, 'plain' demos against a known public server
21
if (isset($_SERVER['HTTPSERVER'])) {
22
    define('XMLRPCSERVER', 'http://'.$_SERVER['HTTPSERVER'].'/demo/server/server.php');
23
} else {
24
    define('XMLRPCSERVER', 'http://gggeek.altervista.org/sw/xmlrpc/demo/server/server.php');
25
}
26
27
// Out-of-band information: let the client manipulate the page operations.
28
// We do this to help the testsuite script: do not reproduce in production!
29
if (isset($_COOKIE['PHPUNIT_SELENIUM_TEST_ID']) && extension_loaded('xdebug')) {
30
    $GLOBALS['PHPUNIT_COVERAGE_DATA_DIRECTORY'] = '/tmp/phpxmlrpc_coverage';
31
    if (!is_dir($GLOBALS['PHPUNIT_COVERAGE_DATA_DIRECTORY'])) {
32
        mkdir($GLOBALS['PHPUNIT_COVERAGE_DATA_DIRECTORY']);
33
        chmod($GLOBALS['PHPUNIT_COVERAGE_DATA_DIRECTORY'], 0777);
34
    }
35
36
    include_once __DIR__ . "/../../vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/SeleniumCommon/prepend.php";
37
}
38
39
// A helper for cli vs we output:
40
function output($text)
41
{
42 8
    echo PHP_SAPI == 'cli' ? strip_tags(str_replace('<br/>', "\n", $text)) : $text;
43
}
44