Conditions | 3 |
Paths | 3 |
Total Lines | 23 |
Code Lines | 11 |
Lines | 15 |
Ratio | 65.22 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
21 | public function actionRun() |
||
22 | { |
||
23 | Craft::log(Craft::t('Running new tasks.')); |
||
24 | |||
25 | // Make sure tasks aren't already running |
||
26 | View Code Duplication | if (!craft()->tasks->isTaskRunning()) { |
|
1 ignored issue
–
show
|
|||
27 | |||
28 | // Is there a pending task? |
||
29 | if (craft()->tasks->getNextPendingTask()) { |
||
30 | |||
31 | // Start running tasks |
||
32 | craft()->tasks->runPendingTasks(); |
||
33 | |||
34 | return 1; |
||
35 | } else { |
||
36 | Craft::log(Craft::t('No pending tasks found.')); |
||
37 | } |
||
38 | } else { |
||
39 | Craft::log(Craft::t('Tasks are already running.')); |
||
40 | } |
||
41 | |||
42 | return 0; |
||
43 | } |
||
44 | |||
75 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.