SessionFormatter   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A format() 0 6 1
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