GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Generator::formatArray()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 13
rs 9.8333
c 0
b 0
f 0
cc 2
nc 2
nop 1
1
<?php
2
/**
3
 * Copyright 2014 Krzysztof Magosa
4
 *
5
 * Licensed under the Apache License, Version 2.0 (the "License");
6
 * you may not use this file except in compliance with the License.
7
 * You may obtain a copy of the License at
8
 * http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16
namespace KM\Saffron;
17
18
abstract class Generator
19
{
20
    /**
21
     * Formats array into form parsable by php.
22
     * Why not just var_export? Because output is hard to read and debug.
23
     *
24
     * @param array $data Array to be formatted
25
     * @return string Formatted string
26
     */
27
    protected function formatArray(array $data)
28
    {
29
        $pairs = [];
30
        foreach ($data as $key => $value) {
31
            $pairs[] = sprintf(
32
                '%s => %s',
33
                var_export($key, true),
34
                var_export($value, true)
35
            );
36
        }
37
38
        return '['.implode(', ', $pairs).']';
39
    }
40
41
    abstract public function generate($className);
42
}
43