Completed
Push — master ( dea2e2...c01b68 )
by Vítězslav
21:37
created

Evidence   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 53
rs 10
c 0
b 0
f 0
wmc 5
lcom 1
cbo 2

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getEvidenceContent() 0 11 3
A getEvidence() 0 4 1
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 FlexiBeeRO[]
46
     */
47
    public function getEvidenceContent()
48
    {
49
        $contents = [];
50
        foreach ($this->engine->getColumnsFromFlexibee(array_key_exists('detail',
51
                $this->conditions) ? $this->conditions['detail'] : 'full',
52
            $this->conditions) as $pos => $recordData) {
53
            $contents[$pos] = clone $this->engine;
54
            $contents[$pos]->setData($recordData, true);
55
        }
56
        return $contents;
57
    }
58
59
    /**
60
     * get used evidence name
61
     * 
62
     * @return string
63
     */
64
    public function getEvidence()
65
    {
66
        return $this->engine->getEvidence();
67
    }
68
}
69