Completed
Push — master ( f2cd13...82e8ab )
by Mihail
03:03
created

ClassTools   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 17
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A createStringClassSnapshotHash() 0 8 2
1
<?php
2
3
namespace Ffcms\Core\Traits;
4
5
/**
6
 * Assistance tools for fast using some magical things and opportunity of classic object-oriented programming
7
 */
8
trait ClassTools
9
{
10
11
    /**
12
     * Create hash string from current class properties and itself values.
13
     * This method is good stuff for caching dynamic instances
14
     * @return string|null
15
     */
16
    public function createStringClassSnapshotHash()
17
    {
18
        $hash = null;
19
        foreach ($this as $property => $value) {
0 ignored issues
show
Bug introduced by
The expression $this of type this<Ffcms\Core\Traits\ClassTools> is not traversable.
Loading history...
20
            $hash = md5($hash . $property . '=' . $value);
21
        }
22
        return $hash;
23
    }
24
}