Completed
Push — master ( 8cf173...32ae29 )
by Gareth
03:16
created

getFolderIds.php ➔ getFolderIds()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 8
nc 1
nop 1
dl 0
loc 13
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace garethp\ews\Utilities;
4
5
use garethp\ews\API\Type\BaseFolderIdType;
6
7
function getFolderIds($folderIds)
8
{
9
    $folders = ensureIsArray($folderIds);
10
11
    $folderIds = array_map(function (BaseFolderIdType $folderId) {
12
        return $folderId->toArray(true);
13
    }, $folders);
14
15
    return array_reduce($folderIds, function ($folderIds, $folderId) {
16
        $folderIds[key($folderId)][] = current($folderId);
17
        return $folderIds;
18
    }, []);
19
}
20