Completed
Pull Request — master (#107)
by Tim
10:51 queued 05:41
created

SettingsController::basicView()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 30
Code Lines 22

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 30
rs 8.8571
cc 1
eloc 22
nc 1
nop 0
1
<?php
2
3
namespace App\Http\Controllers;
4
5
use Illuminate\Http\Request;
6
7
use App\Http\Requests;
8
use App\Http\Controllers\Controller;
9
10
class SettingsController extends Controller
11
{
12
    /**
13
     * Display a listing of the resource.
14
     *
15
     * @return \Illuminate\Http\Response
16
     */
17
    public function basicView()
18
    {
19
20
    $data['date_formats'] = array(
0 ignored issues
show
Coding Style Comprehensibility introduced by
$data was never initialized. Although not strictly required by PHP, it is generally a good practice to add $data = array(); before regardless.

Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code.

Let’s take a look at an example:

foreach ($collection as $item) {
    $myArray['foo'] = $item->getFoo();

    if ($item->hasBar()) {
        $myArray['bar'] = $item->getBar();
    }

    // do something with $myArray
}

As you can see in this example, the array $myArray is initialized the first time when the foreach loop is entered. You can also see that the value of the bar key is only written conditionally; thus, its value might result from a previous iteration.

This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop.

Loading history...
21
    'Y-m-d' => '2010-12-23',
22
    'm-d-Y' => '12-23-2010',
23
    'd-m-Y' => '23-12-2010',
24
    'Y/m/d' => '2010/12/23',
25
    'm/d/Y' => '12/23/2010',
26
    'd/m/Y' => '23/12/2010',
27
    'Y.m.d' => '2010.12.23',
28
    'd.m.Y' => '23.12.2010',
29
    'm.d.Y' => '12.23.2010',
30
  );
31
32
    $data['time_formats'] = array (
33
    'H:i' => '23:00',
34
    'h:ia' => '11:00pm',
35
    'h:iA' => '11:00PM',
36
    'h:i a' => '11:00 pm',
37
    'h:i A' => '11:00 PM',
38
  );
39
    
40
    $data['title'] = config('timecontrol.title');
41
    $data['email'] = config('timecontrol.email');
42
    $data['date'] = config('timecontrol.date');
43
    $data['time'] = config('timecontrol.time');
44
45
     return view('settings/basic', $data);
46
    }
47
48
    /**
49
     * Update the basic settings.
50
     *
51
     * @param  \Illuminate\Http\Request  $request     
52
     * @return \Illuminate\Http\Response
53
     */
54
    public function generalUpdate(Request $request)
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
55
    {
56
57
58
   }    
59
60
}
61