Completed
Push — master ( a458cb...c383da )
by Peter
03:44
created

DataSorter   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A sort() 0 5 1
A _sort() 0 11 3
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 Maslosoft\Signals\Helpers;
10
11
use Maslosoft\Signals\Signal;
12
13
/**
14
 * DataSorter
15
 *
16
 * @author Piotr Maselkowski <pmaselkowski at gmail.com>
17
 */
18
class DataSorter
19
{
20
21
	public static function sort(&$data)
22
	{
23
		self::_sort($data[Signal::Signals]);
24
		self::_sort($data[Signal::Slots]);
25
	}
26
27
	private static function _sort(&$data)
28
	{
29
		ksort($data);
30
		foreach ($data as &$values)
31
		{
32
			if (is_array($values))
33
			{
34
				ksort($values);
35
			}
36
		}
37
	}
38
39
}
40