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

DataSorter::sort()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
ccs 0
cts 4
cp 0
rs 9.4286
cc 1
eloc 3
nc 1
nop 1
crap 2
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