features/upload/routes.php

Summary

Maintainability
A
0 mins
Test Coverage

Expected 1 space after FUNCTION keyword; 0 found
Open

$app->post('/upload/:id', function($id) use ($app) {
Severity: Minor
Found in features/upload/routes.php by phpcodesniffer

Blank line found at end of control structure
Open


Severity: Minor
Found in features/upload/routes.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

        if ( ! move_uploaded_file($tempFile,$targetFile) ) {
Severity: Minor
Found in features/upload/routes.php by phpcodesniffer

Expected 1 blank line at end of file; 3 found
Open

});
Severity: Minor
Found in features/upload/routes.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        // Step One: Put our uploaded files somewhere
Severity: Minor
Found in features/upload/routes.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        shell_exec("mkdir -p $targetPath");
Severity: Minor
Found in features/upload/routes.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $targetPath = "{$upload_base_path}{$ds}{$id}{$ds}";
Severity: Minor
Found in features/upload/routes.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        // we're making directories here
Severity: Minor
Found in features/upload/routes.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        // Step Two: Send the file somewhere and expect a URL back
Severity: Minor
Found in features/upload/routes.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        // end. That will save the image to the the database.
Severity: Minor
Found in features/upload/routes.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        // Ensure we have somewhere to upload to
Severity: Minor
Found in features/upload/routes.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        header("Content-Type: application/json");
Severity: Minor
Found in features/upload/routes.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    $config = Configuration::get_configuration();
Severity: Minor
Found in features/upload/routes.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $tempFile = $_FILES['file']['tmp_name'];
Severity: Minor
Found in features/upload/routes.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        // Step Three: Add the URL of the file as an image for the event
Severity: Minor
Found in features/upload/routes.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        // Lucky us, we just have to call renderImage on the front
Severity: Minor
Found in features/upload/routes.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    $ds = DIRECTORY_SEPARATOR; 
Severity: Minor
Found in features/upload/routes.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $app->log->error("Nothing to upload.");
Severity: Minor
Found in features/upload/routes.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    $upload_base_path = $config['upload_dir'];
Severity: Minor
Found in features/upload/routes.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $options = Configuration::get_configuration('upload');
Severity: Minor
Found in features/upload/routes.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        echo json_encode(array("location" => $location));
Severity: Minor
Found in features/upload/routes.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        if ( ! move_uploaded_file($tempFile,$targetFile) ) {
Severity: Minor
Found in features/upload/routes.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    } 
Severity: Minor
Found in features/upload/routes.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            $app->response->status(500);
Severity: Minor
Found in features/upload/routes.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $app->log->error("File Uploaded");
Severity: Minor
Found in features/upload/routes.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $app->response->status(400);
Severity: Minor
Found in features/upload/routes.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        }
Severity: Minor
Found in features/upload/routes.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    } else {
Severity: Minor
Found in features/upload/routes.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    if (!empty($_FILES)) {
Severity: Minor
Found in features/upload/routes.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $targetFile =  $targetPath. $_FILES['file']['name'];
Severity: Minor
Found in features/upload/routes.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            $app->log->error("Error saving uploaded file.");
Severity: Minor
Found in features/upload/routes.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        // We're grouping uploades by their associated event so
Severity: Minor
Found in features/upload/routes.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $location = $response['location'];
Severity: Minor
Found in features/upload/routes.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        return;
Severity: Minor
Found in features/upload/routes.php by phpcodesniffer

No space found after comma in function call
Open

        if ( ! move_uploaded_file($tempFile,$targetFile) ) {
Severity: Minor
Found in features/upload/routes.php by phpcodesniffer

Whitespace found at end of line
Open

    $ds = DIRECTORY_SEPARATOR; 
Severity: Minor
Found in features/upload/routes.php by phpcodesniffer

Whitespace found at end of line
Open

    } 
Severity: Minor
Found in features/upload/routes.php by phpcodesniffer

Expected 0 spaces after opening bracket; 1 found
Open

        if ( ! move_uploaded_file($tempFile,$targetFile) ) {
Severity: Minor
Found in features/upload/routes.php by phpcodesniffer

There are no issues that match your filters.

Category
Status