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.

ExportController   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 70
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 11
Bugs 2 Features 3
Metric Value
wmc 3
c 11
b 2
f 3
lcom 0
cbo 0
dl 0
loc 70
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A actionGetEntryTypes() 0 16 1
A actionMap() 0 13 1
A actionDownload() 0 21 1
1
<?php
2
3
namespace Craft;
4
5
/**
6
 * Export controller.
7
 *
8
 * Handles mapping and export requests.
9
 *
10
 * @author    Bob Olde Hampsink <[email protected]>
11
 * @copyright Copyright (c) 2015, Bob Olde Hampsink
12
 * @license   MIT
13
 *
14
 * @link      http://github.com/boboldehampsink
15
 */
16
class ExportController extends BaseController
17
{
18
    /**
19
     * Get available entry types for section.
20
     *
21
     * @return string JSON
22
     */
23
    public function actionGetEntryTypes()
24
    {
25
        // Only ajax post requests
26
        $this->requirePostRequest();
27
        $this->requireAjaxRequest();
28
29
        // Get section
30
        $section = craft()->request->getPost('section');
31
        $section = craft()->sections->getSectionById($section);
32
33
        // Get entry types
34
        $entrytypes = $section->getEntryTypes();
35
36
        // Return JSON
37
        $this->returnJson($entrytypes);
38
    }
39
40
    /**
41
     * Process input for mapping.
42
     *
43
     * @return string HTML
44
     */
45
    public function actionMap()
46
    {
47
48
        // Get export posts
49
        $export = craft()->request->getRequiredPost('export');
50
        $reset = craft()->request->getPost('reset');
51
52
        // Send variables to template and display
53
        $this->renderTemplate('export/_map', array(
54
            'export' => $export,
55
            'reset' => $reset,
56
        ));
57
    }
58
59
    /**
60
     * Download export.
61
     *
62
     * @return string CSV
63
     */
64
    public function actionDownload()
65
    {
66
67
        // Get export post
68
        $settings = craft()->request->getRequiredPost('export');
69
70
        // Get mapping fields
71
        $map = craft()->request->getParam('fields');
72
73
        // Save map
74
        craft()->export->saveMap($settings, $map);
75
76
        // Set more settings
77
        $settings['map'] = $map;
78
79
        // Get data
80
        $data = craft()->export->download($settings);
81
82
        // Download the csv
83
        craft()->request->sendFile('export.csv', $data, array('forceDownload' => true, 'mimeType' => 'text/csv'));
84
    }
85
}
86