Completed
Push — master ( c01b68...b6e790 )
by Vítězslav
23:39
created

Evidence::getEvidenceData()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

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