Conditions | 2 |
Paths | 2 |
Total Lines | 110 |
Code Lines | 73 |
Lines | 0 |
Ratio | 0 % |
Changes | 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 |
||
31 | public function __construct() { |
||
32 | $mapping = [ |
||
33 | SYNC_POOMTASKS_BODY => [ |
||
34 | self::STREAMER_VAR => "body", |
||
35 | self::STREAMER_RONOTIFY => true, |
||
36 | ], |
||
37 | SYNC_POOMTASKS_COMPLETE => [ |
||
38 | self::STREAMER_VAR => "complete", |
||
39 | self::STREAMER_CHECKS => [ |
||
40 | self::STREAMER_CHECK_REQUIRED => self::STREAMER_CHECK_SETZERO, |
||
41 | self::STREAMER_CHECK_ZEROORONE => self::STREAMER_CHECK_SETZERO, |
||
42 | ], |
||
43 | self::STREAMER_RONOTIFY => true, |
||
44 | ], |
||
45 | SYNC_POOMTASKS_DATECOMPLETED => [ |
||
46 | self::STREAMER_VAR => "datecompleted", |
||
47 | self::STREAMER_TYPE => self::STREAMER_TYPE_DATE_DASHES, |
||
48 | self::STREAMER_RONOTIFY => true, |
||
49 | ], |
||
50 | SYNC_POOMTASKS_DUEDATE => [ |
||
51 | self::STREAMER_VAR => "duedate", |
||
52 | self::STREAMER_TYPE => self::STREAMER_TYPE_DATE_DASHES, |
||
53 | self::STREAMER_RONOTIFY => true, |
||
54 | ], |
||
55 | SYNC_POOMTASKS_UTCDUEDATE => [ |
||
56 | self::STREAMER_VAR => "utcduedate", |
||
57 | self::STREAMER_TYPE => self::STREAMER_TYPE_DATE_DASHES, |
||
58 | self::STREAMER_RONOTIFY => true, |
||
59 | ], |
||
60 | // Importance values |
||
61 | // 0 = Low |
||
62 | // 1 = Normal |
||
63 | // 2 = High |
||
64 | // even the default value 1 is optional, the native android client 2.2 interprets a non-existing value as 0 (low) |
||
65 | SYNC_POOMTASKS_IMPORTANCE => [self::STREAMER_VAR => "importance", |
||
66 | self::STREAMER_CHECKS => [ |
||
67 | self::STREAMER_CHECK_REQUIRED => self::STREAMER_CHECK_SETONE, |
||
68 | self::STREAMER_CHECK_ONEVALUEOF => [0, 1, 2], |
||
69 | ], |
||
70 | self::STREAMER_RONOTIFY => true, |
||
71 | ], |
||
72 | SYNC_POOMTASKS_RECURRENCE => [ |
||
73 | self::STREAMER_VAR => "recurrence", |
||
74 | self::STREAMER_TYPE => "SyncTaskRecurrence", |
||
75 | self::STREAMER_RONOTIFY => true, |
||
76 | ], |
||
77 | SYNC_POOMTASKS_REGENERATE => [ |
||
78 | self::STREAMER_VAR => "regenerate", |
||
79 | self::STREAMER_RONOTIFY => true, |
||
80 | ], |
||
81 | SYNC_POOMTASKS_DEADOCCUR => [ |
||
82 | self::STREAMER_VAR => "deadoccur", |
||
83 | self::STREAMER_RONOTIFY => true, |
||
84 | ], |
||
85 | SYNC_POOMTASKS_REMINDERSET => [ |
||
86 | self::STREAMER_VAR => "reminderset", |
||
87 | self::STREAMER_CHECKS => [ |
||
88 | self::STREAMER_CHECK_REQUIRED => self::STREAMER_CHECK_SETZERO, |
||
89 | self::STREAMER_CHECK_ZEROORONE => self::STREAMER_CHECK_SETZERO, |
||
90 | ], |
||
91 | self::STREAMER_RONOTIFY => true, |
||
92 | ], |
||
93 | SYNC_POOMTASKS_REMINDERTIME => [ |
||
94 | self::STREAMER_VAR => "remindertime", |
||
95 | self::STREAMER_TYPE => self::STREAMER_TYPE_DATE_DASHES, |
||
96 | self::STREAMER_RONOTIFY => true, |
||
97 | ], |
||
98 | // Sensitivity values |
||
99 | // 0 = Normal |
||
100 | // 1 = Personal |
||
101 | // 2 = Private |
||
102 | // 3 = Confident |
||
103 | SYNC_POOMTASKS_SENSITIVITY => [ |
||
104 | self::STREAMER_VAR => "sensitivity", |
||
105 | self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1, 2, 3]], |
||
106 | self::STREAMER_RONOTIFY => true, |
||
107 | ], |
||
108 | SYNC_POOMTASKS_STARTDATE => [ |
||
109 | self::STREAMER_VAR => "startdate", |
||
110 | self::STREAMER_TYPE => self::STREAMER_TYPE_DATE_DASHES, |
||
111 | self::STREAMER_RONOTIFY => true, |
||
112 | ], |
||
113 | SYNC_POOMTASKS_UTCSTARTDATE => [ |
||
114 | self::STREAMER_VAR => "utcstartdate", |
||
115 | self::STREAMER_TYPE => self::STREAMER_TYPE_DATE_DASHES, |
||
116 | self::STREAMER_RONOTIFY => true, |
||
117 | ], |
||
118 | SYNC_POOMTASKS_SUBJECT => [ |
||
119 | self::STREAMER_VAR => "subject", |
||
120 | self::STREAMER_RONOTIFY => true, |
||
121 | ], |
||
122 | SYNC_POOMTASKS_CATEGORIES => [ |
||
123 | self::STREAMER_VAR => "categories", |
||
124 | self::STREAMER_ARRAY => SYNC_POOMTASKS_CATEGORY, |
||
125 | self::STREAMER_RONOTIFY => true, |
||
126 | ], |
||
127 | ]; |
||
128 | |||
129 | if (Request::GetProtocolVersion() >= 12.0) { |
||
130 | $mapping[SYNC_AIRSYNCBASE_BODY] = [ |
||
131 | self::STREAMER_VAR => "asbody", |
||
132 | self::STREAMER_TYPE => "SyncBaseBody", |
||
133 | self::STREAMER_RONOTIFY => true, |
||
134 | ]; |
||
135 | |||
136 | // unset these properties because airsyncbase body and attachments will be used instead |
||
137 | unset($mapping[SYNC_POOMTASKS_BODY]); |
||
138 | } |
||
139 | |||
140 | parent::__construct($mapping); |
||
141 | } |
||
193 |