SubItems::getSubMenuName()   A
last analyzed

Complexity

Conditions 3
Paths 4

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 1
c 1
b 0
f 1
dl 0
loc 2
rs 10
cc 3
nc 4
nop 0
1
<?php
2
3
/*
4
 * To change this license header, choose License Headers in Project Properties.
5
 * To change this template file, choose Tools | Templates
6
 * and open the template in the editor.
7
 */
8
9
namespace FlexiPeeHP;
10
11
/**
12
 *
13
 * @author vitex
14
 */
15
trait SubItems {
16
    /**
17
     * Subitems - ex. items of invoice
18
     * 
19
     * @return array of document items or null
20
     */
21
    public function getSubItems() {
22
        return $this->getDataValue($this->getSubmenuName());
0 ignored issues
show
Bug introduced by
It seems like getDataValue() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

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

22
        return $this->/** @scrutinizer ignore-call */ getDataValue($this->getSubmenuName());
Loading history...
23
    }
24
    
25
    public function setSubitems(array $subitems) {
26
        return $this->setDataValue($this->getSubmenuName(), $subitems);    
0 ignored issues
show
Bug introduced by
It seems like setDataValue() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

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

26
        return $this->/** @scrutinizer ignore-call */ setDataValue($this->getSubmenuName(), $subitems);    
Loading history...
27
    }
28
29
    public function getSubMenuName() {
30
        return array_key_exists('polozkyFaktury', $this->getData()) ? 'polozkyFaktury' : (array_key_exists('polozkyDokladu', $this->getData()) ? 'polozkyDokladu' : null);
0 ignored issues
show
Bug introduced by
It seems like getData() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

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

30
        return array_key_exists('polozkyFaktury', $this->/** @scrutinizer ignore-call */ getData()) ? 'polozkyFaktury' : (array_key_exists('polozkyDokladu', $this->getData()) ? 'polozkyDokladu' : null);
Loading history...
31
32
    }
33
    
34
}
35