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.
Completed
Push — 2.9 ( 0e03d0...5a2d69 )
by Thorsten
17:00
created

PMF_Export::create()   B

Complexity

Conditions 5
Paths 5

Size

Total Lines 19
Code Lines 16

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 19
rs 8.8571
cc 5
eloc 16
nc 5
nop 4
1
<?php
2
3
/**
4
 * XML, XHTML and PDF export - Classes and Functions.
5
 *
6
 * PHP Version 5.5
7
 *
8
 * This Source Code Form is subject to the terms of the Mozilla Public License,
9
 * v. 2.0. If a copy of the MPL was not distributed with this file, You can
10
 * obtain one at http://mozilla.org/MPL/2.0/.
11
 *
12
 * @category  phpMyFAQ
13
 *
14
 * @author    Thorsten Rinne <[email protected]>
15
 * @author    Matteo Scaramuccia <[email protected]>
16
 * @license   http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0
17
 * @copyright 2005-2015 phpMyFAQ Team
18
 *
19
 * @link      http://www.phpmyfaq.de
20
 * @since     2005-11-02
21
 */
22
if (!defined('IS_VALID_PHPMYFAQ')) {
23
    exit();
24
}
25
26
require_once PMF_CONFIG_DIR.'/constants.php';
27
28
/**
29
 * Export Class.
30
 *
31
 * This class manages the export formats supported by phpMyFAQ:
32
 * - PDF
33
 * - XHTML
34
 * - XML
35
 *
36
 * @category  phpMyFAQ
37
 *
38
 * @author    Thorsten Rinne <[email protected]>
39
 * @author    Matteo Scaramuccia <[email protected]>
40
 * @license   http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0
41
 * @copyright 2005-2015 phpMyFAQ Team
42
 *
43
 * @link      http://www.phpmyfaq.de
44
 * @since     2005-11-02
45
 */
46
class PMF_Export
47
{
48
    /**
49
     * Faq object.
50
     *
51
     * @var PMF_Faq
52
     */
53
    protected $faq = null;
54
55
    /**
56
     * Category object.
57
     *
58
     * @var PMF_Category
59
     */
60
    protected $category = null;
61
62
    /**
63
     * Configuration.
64
     *
65
     * @var PMF_Configuration
66
     */
67
    protected $_config = null;
68
69
    /**
70
     * Factory.
71
     *
72
     * @param PMF_Faq           $faq      Faq object
73
     * @param PMF_Category      $category Category object
74
     * @param PMF_Configuration $config   Configuration object
75
     * @param string            $mode     Export
76
     *
77
     * @return mixed
78
     *
79
     * @throws PMF_Exception
80
     */
81
    public static function create(PMF_Faq $faq, PMF_Category $category, PMF_Configuration $config, $mode = 'pdf')
82
    {
83
        switch ($mode) {
84
            case 'json':
85
                return new PMF_Export_Json($faq, $category, $config);
86
                break;
0 ignored issues
show
Unused Code introduced by
break is not strictly necessary here and could be removed.

The break statement is not necessary if it is preceded for example by a return statement:

switch ($x) {
    case 1:
        return 'foo';
        break; // This break is not necessary and can be left off.
}

If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.

Loading history...
87
            case 'pdf':
88
                return new PMF_Export_Pdf($faq, $category, $config);
89
                break;
0 ignored issues
show
Unused Code introduced by
break is not strictly necessary here and could be removed.

The break statement is not necessary if it is preceded for example by a return statement:

switch ($x) {
    case 1:
        return 'foo';
        break; // This break is not necessary and can be left off.
}

If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.

Loading history...
90
            case 'xml':
91
                return new PMF_Export_Xml($faq, $category, $config);
92
                break;
0 ignored issues
show
Unused Code introduced by
break is not strictly necessary here and could be removed.

The break statement is not necessary if it is preceded for example by a return statement:

switch ($x) {
    case 1:
        return 'foo';
        break; // This break is not necessary and can be left off.
}

If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.

Loading history...
93
            case 'xhtml':
94
                return new PMF_Export_Xhtml($faq, $category, $config);
95
                break;
96
            default:
97
                throw new PMF_Exception('Export not implemented!');
98
        }
99
    }
100
101
    /**
102
     * Returns the timestamp of the export.
103
     *
104
     * @return string
105
     */
106
    public static function getExportTimeStamp()
107
    {
108
        return date('Y-m-d-H-i-s', $_SERVER['REQUEST_TIME']);
109
    }
110
}
111