Passed
Push — master ( 74c932...1b6587 )
by Vítězslav
02:09
created

getPropertiesInfo()   A

Complexity

Conditions 5
Paths 2

Size

Total Lines 16
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 16
c 0
b 0
f 0
rs 9.6111
cc 5
nc 2
nop 2
1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 5 and the first side effect is on line 8.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
3
namespace FlexiPeeHP;
4
5
define('EASE_APPNAME', 'FlexiPeehUP');
6
define('EASE_LOGGER', 'console|syslog');
7
8
require_once '../testing/bootstrap.php';
9
10
$outFile = 'Properties.php';
11
$ok      = 0;
12
13
$evidenceProps = '<?php
14
/**
15
 * FlexiPeeHP - Evidence Properties.
16
 *
17
 * @author     Vítězslav Dvořák <[email protected]>
18
 * @copyright  (C) 2015-'.date('Y').' Spoje.Net
19
 */
20
21
namespace FlexiPeeHP;
22
23
/**
24
 * Evidence Properties
25
 *
26
 * @link https://demo.flexibee.eu/c/demo/evidence-list.json vlastnosti evidence
27
 */
28
29
class Properties
30
{
31
';
32
33
$statuser = new Status();
34
35
36
$syncer = new FlexiBeeRO();
37
$syncer->setObjectName('FlexiBee Evidence Properties');
38
$syncer->addStatusMessage('Updating Evidences Properties');
39
40
$pos = 0;
41
foreach (EvidenceList::$name as $evidencePath => $evidenceName) {
42
    $pos++;
43
    if ($evidencePath == 'nastaveni') {
44
        $info      = json_decode(file_get_contents('nastaveni-properties.json'),
45
            true);
46
        $structure = $info['properties']['property'];
47
    } else {
48
        $structure = $syncer->getOnlineColumnsInfo($evidencePath);
49
    }
50
51
    if (count($structure)) {
52
        $syncer->addStatusMessage($pos.' of '.count(EvidenceList::$name).' '.$evidencePath.': structure obtained',
53
            'success');
54
        $ok++;
55
    } else {
56
        $syncer->addStatusMessage($pos.' of '.count(EvidenceList::$name).' '.$evidencePath.': structure problem',
57
            'error');
58
    }
59
    file_put_contents('Properties.'.$evidencePath.'.json',
60
        json_encode($structure));
61
}
62
63
$syncer->addStatusMessage('Updating of '.$ok.' Evidences Properties done',
64
    'success');
65