Completed
Push — master ( 6986c5...be73e7 )
by Vitalijs
02:50
created

DTOIteratorTrait   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
lcom 1
cbo 1
dl 0
loc 11
ccs 2
cts 2
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getIterator() 0 4 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: vlitvinovs
5
 * Date: 2/8/17
6
 * Time: 4:35 PM
7
 */
8
9
namespace CodinPro\DataTransferObject;
10
11
trait DTOIteratorTrait
12
{
13
    /**
14
     * Get custom iterator
15
     * @return DTOIterator
16
     */
17 2
    public function getIterator()
18
    {
19 2
        return new DTOIterator($this->data);
0 ignored issues
show
Bug introduced by
The property data does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
20
    }
21
}