Conditions | 5 |
Paths | 16 |
Total Lines | 53 |
Code Lines | 25 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 30 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
15 | public function run() |
||
16 | { |
||
17 | try { |
||
18 | factory(Module::class)->create( |
||
19 | [ |
||
20 | "name" => "MP01 - Implantació de sistemes operatius(ASIX) - Implementació de sistemes informàtics(DAM)", |
||
21 | "order" => 1, |
||
22 | "study_id" => 1 |
||
23 | |||
24 | ] |
||
25 | ); |
||
26 | } catch (\Illuminate\Database\QueryException $exception) { |
||
|
|||
27 | |||
28 | } |
||
29 | try { |
||
30 | factory(Module::class)->create( |
||
31 | [ |
||
32 | "name" => "MP02 - Gestió de bases de dades", |
||
33 | "order" => 2, |
||
34 | "study_id" => 1 |
||
35 | ] |
||
36 | ); |
||
37 | |||
38 | } catch (\Illuminate\Database\QueryException $exception) { |
||
39 | |||
40 | } |
||
41 | |||
42 | try { |
||
43 | factory(Module::class)->create( |
||
44 | [ |
||
45 | "name" => "MP03 - Programació bàsica", |
||
46 | "order" => 3, |
||
47 | "study_id" => 1 |
||
48 | ] |
||
49 | ); |
||
50 | |||
51 | } catch (\Illuminate\Database\QueryException $exception) { |
||
52 | |||
53 | } |
||
54 | |||
55 | try { |
||
56 | factory(Module::class)->create( |
||
57 | [ |
||
58 | "name" => "MP04 - Llenguatges de marques i sistemes de gestió d'informació", |
||
59 | "order" => 4, |
||
60 | "study_id" => 1 |
||
61 | ] |
||
62 | ); |
||
63 | |||
64 | } catch (\Illuminate\Database\QueryException $exception) { |
||
65 | |||
66 | } |
||
67 | } |
||
68 | } |