Evidence   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 7
eloc 15
c 1
b 0
f 0
dl 0
loc 62
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getEvidenceObjects() 0 10 3
A getEvidence() 0 3 1
A __construct() 0 4 1
A getEvidenceData() 0 4 2
1
<?php
2
3
/**
4
 * FlexiPeeHP - Evidence Full actions.
5
 *
6
 * @author     Vítězslav Dvořák <[email protected]>
7
 * @copyright  (C) 2019 Spoje.Net
8
 */
9
10
namespace FlexiPeeHP;
11
12
use Ease\Sand;
13
use FlexiPeeHP\RO;
14
15
/**
16
 * Helper class for work with multiplete documents
17
 *
18
 * @author Vítězslav Dvořák <[email protected]>
19
 */
20
class Evidence extends Sand
21
{
22
    /**
23
     *
24
     * @var RO 
25
     */
26
    public $engine = null;
27
28
    /**
29
     *
30
     * @var array 
31
     */
32
    public $conditions = [];
33
34
    /**
35
     * 
36
     * @param RO $engine
37
     * 
38
     * @param array $conditions
39
     */
40
    public function __construct(RO $engine, array $conditions = [])
41
    {
42
        $this->engine     = $engine;
43
        $this->conditions = $conditions;
44
    }
45
46
    /**
47
     * Array of objects in eveidence
48
     * 
49
     * @return array
50
     */
51
    public function getEvidenceData()
52
    {
53
        return $this->engine->getColumnsFromAbraFlexi(array_key_exists('detail',
54
                $this->conditions) ? $this->conditions['detail'] : 'full', $this->conditions);
55
    }
56
57
    /**
58
     * Array of objects in eveidence
59
     * 
60
     * @return RO[]
61
     */
62
    public function getEvidenceObjects()
63
    {
64
        $contents = [];
65
        foreach ($this->engine->getColumnsFromAbraFlexi(array_key_exists('detail',
66
                $this->conditions) ? $this->conditions['detail'] : 'full',
67
            $this->conditions) as $pos => $recordData) {
68
            $contents[$pos] = clone $this->engine;
69
            $contents[$pos]->setData($recordData, true);
70
        }
71
        return $contents;
72
    }
73
74
    /**
75
     * get used evidence name
76
     * 
77
     * @return string
78
     */
79
    public function getEvidence()
80
    {
81
        return $this->engine->getEvidence();
82
    }
83
}
84