SessionFormatter::format()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 3
1
<?php
2
3
namespace Ntb\RestAPI;
4
5
/**
6
 * The session formatter can format a session into a representation which is consumable from a IRestSerializer.
7
 * @author Christian Blank <[email protected]>
8
 */
9
class SessionFormatter implements IRestSerializeFormatter {
10
11
    /**
12
     * Returns an array with entries for `user`.
13
     *
14
     * @param ApiSession $data
15
     * @param array $access
0 ignored issues
show
Documentation introduced by
Should the type for parameter $access not be array|null?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
16
     * @param array $fields
0 ignored issues
show
Documentation introduced by
Should the type for parameter $fields not be array|null?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
17
     * @return array the user data in a serializable structure
18
     */
19
    public static function format($data, $access=null, $fields=null) {
20
        return [
21
            'user' => $data->User->URLSegment,
22
            'token' => $data->Token
23
        ];
24
    }
25
}
26