Completed
Branch master (288a42)
by Benjamin
04:20
created
src/Alpixel/Bundle/CronBundle/Command/CronRunCommand.php 5 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -136,6 +136,9 @@
 block discarded – undo
136 136
         $job->setNextRun($newTime);
137 137
     }
138 138
 
139
+    /**
140
+     * @param string $output
141
+     */
139 142
     protected function recordJobResult(EntityManager $em, CronJob $job, $timeTaken, $output, $resultCode)
140 143
     {
141 144
         // Create a new CronJobResult
Please login to merge, or discard this patch.
Unused Use Statements   -7 removed lines patch added patch discarded remove patch
@@ -1,19 +1,12 @@
 block discarded – undo
1 1
 <?php
2 2
 namespace Alpixel\Bundle\CronBundle\Command;
3 3
 use Doctrine\ORM\EntityManager;
4
-
5 4
 use Symfony\Component\Console\Input\ArgvInput;
6
-
7 5
 use Alpixel\Bundle\CronBundle\Entity\CronJobResult;
8
-
9 6
 use Alpixel\Bundle\CronBundle\Entity\CronJob;
10
-
11 7
 use Symfony\Component\Console\Output\OutputInterface;
12
-
13 8
 use Symfony\Component\Console\Input\InputInterface;
14
-
15 9
 use Symfony\Component\Console\Input\InputArgument;
16
-
17 10
 use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
18 11
 
19 12
 class CronRunCommand extends ContainerAwareCommand
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@
 block discarded – undo
21 21
     protected function configure()
22 22
     {
23 23
         $this->setName("cron:run")
24
-             ->setDescription("Runs any currently schedule cron jobs")
25
-             ->addArgument("job", InputArgument::OPTIONAL, "Run only this job (if enabled)");
24
+                ->setDescription("Runs any currently schedule cron jobs")
25
+                ->addArgument("job", InputArgument::OPTIONAL, "Run only this job (if enabled)");
26 26
     }
27 27
 
28 28
     protected function execute(InputInterface $input, OutputInterface $output)
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -32,17 +32,17 @@  discard block
 block discarded – undo
32 32
         $jobRepo = $em->getRepository('CronBundle:CronJob');
33 33
 
34 34
         $jobsToRun = array();
35
-        if($jobName = $input->getArgument('job'))
35
+        if ($jobName = $input->getArgument('job'))
36 36
         {
37 37
             try
38 38
             {
39 39
                 $jobObj = $jobRepo->findOneByCommand($jobName);
40
-                if($jobObj->getEnabled())
40
+                if ($jobObj->getEnabled())
41 41
                 {
42 42
                     $jobsToRun = array($jobObj);
43 43
                 }
44 44
             }
45
-            catch(\Exception $e)
45
+            catch (\Exception $e)
46 46
             {
47 47
                 $output->writeln("Couldn't find a job by the name of $jobName");
48 48
                 return CronJobResult::FAILED;
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
         $jobCount = count($jobsToRun);
57 57
         $output->writeln("Running $jobCount jobs:");
58 58
 
59
-        foreach($jobsToRun as $job)
59
+        foreach ($jobsToRun as $job)
60 60
         {
61 61
             $this->runJob($job, $output, $em);
62 62
         }
@@ -71,13 +71,13 @@  discard block
 block discarded – undo
71 71
 
72 72
     protected function runJob(CronJob $job, OutputInterface $output, EntityManager $em)
73 73
     {
74
-        $output->write("Running " . $job->getCommand() . ": ");
74
+        $output->write("Running ".$job->getCommand().": ");
75 75
 
76 76
         try
77 77
         {
78 78
             $commandToRun = $this->getApplication()->get($job->getCommand());
79 79
         }
80
-        catch(InvalidArgumentException $ex)
80
+        catch (InvalidArgumentException $ex)
81 81
         {
82 82
             $output->writeln(" skipped (command no longer exists)");
83 83
             $this->recordJobResult($em, $job, 0, "Command no longer exists", CronJobResult::SKIPPED);
@@ -94,32 +94,32 @@  discard block
 block discarded – undo
94 94
         {
95 95
             $returnCode = $commandToRun->execute($emptyInput, $jobOutput);
96 96
         }
97
-        catch(\Exception $ex)
97
+        catch (\Exception $ex)
98 98
         {
99 99
             $returnCode = CronJobResult::FAILED;
100 100
             $jobOutput->writeln("");
101
-            $jobOutput->writeln("Job execution failed with exception " . get_class($ex) . ":");
101
+            $jobOutput->writeln("Job execution failed with exception ".get_class($ex).":");
102 102
             $jobOutput->writeln($ex->__toString());
103 103
         }
104 104
         $jobEnd = microtime(true);
105 105
 
106 106
         // Clamp the result to accepted values
107
-        if($returnCode < CronJobResult::RESULT_MIN || $returnCode > CronJobResult::RESULT_MAX)
107
+        if ($returnCode < CronJobResult::RESULT_MIN || $returnCode > CronJobResult::RESULT_MAX)
108 108
         {
109 109
             $returnCode = CronJobResult::FAILED;
110 110
         }
111 111
 
112 112
         // Output the result
113 113
         $statusStr = "unknown";
114
-        if($returnCode == CronJobResult::SKIPPED)
114
+        if ($returnCode == CronJobResult::SKIPPED)
115 115
         {
116 116
             $statusStr = "skipped";
117 117
         }
118
-        elseif($returnCode == CronJobResult::SUCCEEDED)
118
+        elseif ($returnCode == CronJobResult::SUCCEEDED)
119 119
         {
120 120
             $statusStr = "succeeded";
121 121
         }
122
-        elseif($returnCode == CronJobResult::FAILED)
122
+        elseif ($returnCode == CronJobResult::FAILED)
123 123
         {
124 124
             $statusStr = "failed";
125 125
         }
Please login to merge, or discard this patch.
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -41,14 +41,12 @@  discard block
 block discarded – undo
41 41
                 {
42 42
                     $jobsToRun = array($jobObj);
43 43
                 }
44
-            }
45
-            catch(\Exception $e)
44
+            } catch(\Exception $e)
46 45
             {
47 46
                 $output->writeln("Couldn't find a job by the name of $jobName");
48 47
                 return CronJobResult::FAILED;
49 48
             }
50
-        }
51
-        else
49
+        } else
52 50
         {
53 51
             $jobsToRun = $jobRepo->findDueTasks();
54 52
         }
@@ -76,8 +74,7 @@  discard block
 block discarded – undo
76 74
         try
77 75
         {
78 76
             $commandToRun = $this->getApplication()->get($job->getCommand());
79
-        }
80
-        catch(InvalidArgumentException $ex)
77
+        } catch(InvalidArgumentException $ex)
81 78
         {
82 79
             $output->writeln(" skipped (command no longer exists)");
83 80
             $this->recordJobResult($em, $job, 0, "Command no longer exists", CronJobResult::SKIPPED);
@@ -93,8 +90,7 @@  discard block
 block discarded – undo
93 90
         try
94 91
         {
95 92
             $returnCode = $commandToRun->execute($emptyInput, $jobOutput);
96
-        }
97
-        catch(\Exception $ex)
93
+        } catch(\Exception $ex)
98 94
         {
99 95
             $returnCode = CronJobResult::FAILED;
100 96
             $jobOutput->writeln("");
@@ -114,12 +110,10 @@  discard block
 block discarded – undo
114 110
         if($returnCode == CronJobResult::SKIPPED)
115 111
         {
116 112
             $statusStr = "skipped";
117
-        }
118
-        elseif($returnCode == CronJobResult::SUCCEEDED)
113
+        } elseif($returnCode == CronJobResult::SUCCEEDED)
119 114
         {
120 115
             $statusStr = "succeeded";
121
-        }
122
-        elseif($returnCode == CronJobResult::FAILED)
116
+        } elseif($returnCode == CronJobResult::FAILED)
123 117
         {
124 118
             $statusStr = "failed";
125 119
         }
Please login to merge, or discard this patch.
src/Alpixel/Bundle/CronBundle/Command/CronScanCommand.php 4 patches
Unused Use Statements   -9 removed lines patch added patch discarded remove patch
@@ -1,21 +1,12 @@
 block discarded – undo
1 1
 <?php
2 2
 namespace Alpixel\Bundle\CronBundle\Command;
3 3
 use Alpixel\Bundle\CronBundle\Entity\CronJob;
4
-
5 4
 use Doctrine\ORM\EntityManager;
6
-
7 5
 use Symfony\Component\Console\Command\Command;
8
-
9 6
 use Alpixel\Bundle\CronBundle\Annotation\CronJob as CronJobAnno;
10
-
11
-use Symfony\Bundle\DoctrineBundle\Registry;
12
-
13 7
 use Symfony\Component\Console\Output\OutputInterface;
14
-
15 8
 use Symfony\Component\Console\Input\InputInterface;
16
-
17 9
 use Symfony\Component\Console\Input\InputOption;
18
-
19 10
 use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
20 11
 
21 12
 class CronScanCommand extends ContainerAwareCommand
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -23,9 +23,9 @@
 block discarded – undo
23 23
     protected function configure()
24 24
     {
25 25
         $this->setName("cron:scan")
26
-             ->setDescription("Scans for any new or deleted cron jobs")
27
-             ->addOption('keep-deleted', 'k', InputOption::VALUE_NONE, 'If set, deleted cron jobs will not be removed')
28
-             ->addOption('default-disabled', 'd', InputOption::VALUE_NONE, 'If set, new jobs will be disabled by default');
26
+                ->setDescription("Scans for any new or deleted cron jobs")
27
+                ->addOption('keep-deleted', 'k', InputOption::VALUE_NONE, 'If set, deleted cron jobs will not be removed')
28
+                ->addOption('default-disabled', 'd', InputOption::VALUE_NONE, 'If set, new jobs will be disabled by default');
29 29
     }
30 30
 
31 31
     protected function execute(InputInterface $input, OutputInterface $output)
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -42,16 +42,16 @@  discard block
 block discarded – undo
42 42
         // Enumerate all the jobs currently loaded
43 43
         $reader = $this->getContainer()->get("annotation_reader");
44 44
 
45
-        foreach($this->getApplication()->all() as $command)
45
+        foreach ($this->getApplication()->all() as $command)
46 46
         {
47 47
             // Check for an @CronJob annotation
48 48
             $reflClass = new \ReflectionClass($command);
49
-            foreach($reader->getClassAnnotations($reflClass) as $anno)
49
+            foreach ($reader->getClassAnnotations($reflClass) as $anno)
50 50
             {
51
-                if($anno instanceof CronJobAnno)
51
+                if ($anno instanceof CronJobAnno)
52 52
                 {
53 53
                     $job = $command->getName();
54
-                    if(array_key_exists($job, $knownJobs))
54
+                    if (array_key_exists($job, $knownJobs))
55 55
                     {
56 56
                         // Clear it from the known jobs so that we don't try to delete it
57 57
                         unset($knownJobs[$job]);
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
                         // Update the job if necessary
60 60
                         $currentJob = $jobRepo->findOneByCommand($job);
61 61
                         $currentJob->setDescription($command->getDescription());
62
-                        if($currentJob->getInterval() != $anno->value)
62
+                        if ($currentJob->getInterval() != $anno->value)
63 63
                         {
64 64
                             $newTime = new \DateTime();
65 65
                             $newTime = $newTime->add(new \DateInterval($anno->value));
@@ -78,9 +78,9 @@  discard block
 block discarded – undo
78 78
         }
79 79
 
80 80
         // Clear any jobs that weren't found
81
-        if(!$keepDeleted)
81
+        if (!$keepDeleted)
82 82
         {
83
-            foreach(array_keys($knownJobs) as $deletedJob)
83
+            foreach (array_keys($knownJobs) as $deletedJob)
84 84
             {
85 85
                 $output->writeln("Deleting job: $deletedJob");
86 86
                 $jobToDelete = $jobRepo->findOneByCommand($deletedJob);
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
         $newJob->setNextRun(new \DateTime());
102 102
         $newJob->setEnabled(!$defaultDisabled);
103 103
 
104
-        $output->writeln("Added the job " . $newJob->getCommand() . " with interval " . $newJob->getInterval());
104
+        $output->writeln("Added the job ".$newJob->getCommand()." with interval ".$newJob->getInterval());
105 105
         $em->persist($newJob);
106 106
     }
107 107
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -68,8 +68,7 @@
 block discarded – undo
68 68
                             $currentJob->setNextRun($newTime);
69 69
                             $output->writeln("Updated interval for $job to {$anno->value}");
70 70
                         }
71
-                    }
72
-                    else
71
+                    } else
73 72
                     {
74 73
                         $this->newJobFound($em, $output, $command, $anno, $defaultDisabled);
75 74
                     }
Please login to merge, or discard this patch.
src/Alpixel/Bundle/CronBundle/Command/CronStatusCommand.php 4 patches
Unused Use Statements   -5 removed lines patch added patch discarded remove patch
@@ -1,15 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 namespace Alpixel\Bundle\CronBundle\Command;
3 3
 use Alpixel\Bundle\CronBundle\Entity\CronJobResult;
4
-
5 4
 use Alpixel\Bundle\CronBundle\Entity\CronJob;
6
-
7 5
 use Symfony\Component\Console\Output\OutputInterface;
8
-
9 6
 use Symfony\Component\Console\Input\InputInterface;
10
-
11 7
 use Symfony\Component\Console\Input\InputArgument;
12
-
13 8
 use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
14 9
 
15 10
 class CronStatusCommand extends ContainerAwareCommand
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,8 +17,8 @@
 block discarded – undo
17 17
     protected function configure()
18 18
     {
19 19
         $this->setName("cron:status")
20
-             ->setDescription("Displays the current status of cron jobs")
21
-             ->addArgument("job", InputArgument::OPTIONAL, "Show information for only this job");
20
+                ->setDescription("Displays the current status of cron jobs")
21
+                ->addArgument("job", InputArgument::OPTIONAL, "Show information for only this job");
22 22
     }
23 23
 
24 24
     protected function execute(InputInterface $input, OutputInterface $output)
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -27,13 +27,13 @@  discard block
 block discarded – undo
27 27
         $output->writeln("Cron job statuses:");
28 28
 
29 29
         $cronJobs = array();
30
-        if($jobName = $input->getArgument('job'))
30
+        if ($jobName = $input->getArgument('job'))
31 31
         {
32 32
             try
33 33
             {
34 34
                 $cronJobs = array($jobRepo->findOneByCommand($jobName));
35 35
             }
36
-            catch(\Exception $e)
36
+            catch (\Exception $e)
37 37
             {
38 38
                 $output->writeln("Couldn't find a job by the name of $jobName");
39 39
                 return CronJobResult::FAILED;
@@ -44,16 +44,16 @@  discard block
 block discarded – undo
44 44
             $cronJobs = $em->getRepository('CronBundle:CronJob')->findAll();
45 45
         }
46 46
 
47
-        foreach($cronJobs as $cronJob)
47
+        foreach ($cronJobs as $cronJob)
48 48
         {
49
-            $output->write(" - " . $cronJob->getCommand());
50
-            if(!$cronJob->getEnabled())
49
+            $output->write(" - ".$cronJob->getCommand());
50
+            if (!$cronJob->getEnabled())
51 51
             {
52 52
                 $output->write(" (disabled)");
53 53
             }
54 54
             $output->writeln("");
55
-            $output->writeln("   Description: " . $cronJob->getDescription());
56
-            if(!$cronJob->getEnabled())
55
+            $output->writeln("   Description: ".$cronJob->getDescription());
56
+            if (!$cronJob->getEnabled())
57 57
             {
58 58
                 $output->writeln("   Not scheduled");
59 59
             }
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
             {
62 62
                 $output->write("   Scheduled for: ");
63 63
                 $now = new \DateTime();
64
-                if($cronJob->getNextRun() <= $now)
64
+                if ($cronJob->getNextRun() <= $now)
65 65
                 {
66 66
                     $output->writeln("Next run");
67 67
                 }
@@ -70,10 +70,10 @@  discard block
 block discarded – undo
70 70
                     $output->writeln(strftime("%c", $cronJob->getNextRun()->getTimestamp()));
71 71
                 }
72 72
             }
73
-            if($cronJob->getMostRecentRun())
73
+            if ($cronJob->getMostRecentRun())
74 74
             {
75 75
                 $status = "Unknown";
76
-                switch($cronJob->getMostRecentRun()->getResult())
76
+                switch ($cronJob->getMostRecentRun()->getResult())
77 77
                 {
78 78
                     case CronJobResult::SUCCEEDED:
79 79
                         $status = "Successful";
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -32,14 +32,12 @@  discard block
 block discarded – undo
32 32
             try
33 33
             {
34 34
                 $cronJobs = array($jobRepo->findOneByCommand($jobName));
35
-            }
36
-            catch(\Exception $e)
35
+            } catch(\Exception $e)
37 36
             {
38 37
                 $output->writeln("Couldn't find a job by the name of $jobName");
39 38
                 return CronJobResult::FAILED;
40 39
             }
41
-        }
42
-        else
40
+        } else
43 41
         {
44 42
             $cronJobs = $em->getRepository('CronBundle:CronJob')->findAll();
45 43
         }
@@ -56,16 +54,14 @@  discard block
 block discarded – undo
56 54
             if(!$cronJob->getEnabled())
57 55
             {
58 56
                 $output->writeln("   Not scheduled");
59
-            }
60
-            else
57
+            } else
61 58
             {
62 59
                 $output->write("   Scheduled for: ");
63 60
                 $now = new \DateTime();
64 61
                 if($cronJob->getNextRun() <= $now)
65 62
                 {
66 63
                     $output->writeln("Next run");
67
-                }
68
-                else
64
+                } else
69 65
                 {
70 66
                     $output->writeln(strftime("%c", $cronJob->getNextRun()->getTimestamp()));
71 67
                 }
@@ -86,8 +82,7 @@  discard block
 block discarded – undo
86 82
                         break;
87 83
                 }
88 84
                 $output->writeln("   Last run was: $status");
89
-            }
90
-            else
85
+            } else
91 86
             {
92 87
                 $output->writeln("   This job has not yet been run");
93 88
             }
Please login to merge, or discard this patch.
src/Alpixel/Bundle/CronBundle/Entity/CronJob.php 1 patch
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
     /**
137 137
      * Set nextRun
138 138
      *
139
-     * @param datetime $nextRun
139
+     * @param \DateTime $nextRun
140 140
      */
141 141
     public function setNextRun($nextRun)
142 142
     {
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
     /**
157 157
      * Add results
158 158
      *
159
-     * @param Alpixel\Bundle\CronBundle\Entity\CronJobResult $results
159
+     * @param CronJobResult $results
160 160
      */
161 161
     public function addCronJobResult(\Alpixel\Bundle\CronBundle\Entity\CronJobResult $results)
162 162
     {
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
     /**
177 177
      * Set mostRecentRun
178 178
      *
179
-     * @param Alpixel\Bundle\CronBundle\Entity\CronJobResult $mostRecentRun
179
+     * @param CronJobResult $mostRecentRun
180 180
      */
181 181
     public function setMostRecentRun(\Alpixel\Bundle\CronBundle\Entity\CronJobResult $mostRecentRun)
182 182
     {
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
     /**
187 187
      * Get mostRecentRun
188 188
      *
189
-     * @return Alpixel\Bundle\CronBundle\Entity\CronJobResult
189
+     * @return CronJobResult
190 190
      */
191 191
     public function getMostRecentRun()
192 192
     {
Please login to merge, or discard this patch.
src/Alpixel/Bundle/CronBundle/Entity/CronJobResult.php 1 patch
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
     /**
151 151
      * Set job
152 152
      *
153
-     * @param Alpixel\Bundle\CronBundle\Entity\CronJob $job
153
+     * @param CronJob $job
154 154
      */
155 155
     public function setJob(\Alpixel\Bundle\CronBundle\Entity\CronJob $job)
156 156
     {
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
     /**
161 161
      * Get job
162 162
      *
163
-     * @return Alpixel\Bundle\CronBundle\Entity\CronJob
163
+     * @return CronJob
164 164
      */
165 165
     public function getJob()
166 166
     {
Please login to merge, or discard this patch.
src/Alpixel/Bundle/CronBundle/Command/CronEnableJobCommand.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,8 +13,8 @@
 block discarded – undo
13 13
     protected function configure()
14 14
     {
15 15
         $this->setName("cron:enable-job")
16
-             ->setDescription("Enables a cron job")
17
-             ->addArgument("job", InputArgument::REQUIRED, "Name of the job to enable");
16
+                ->setDescription("Enables a cron job")
17
+                ->addArgument("job", InputArgument::REQUIRED, "Name of the job to enable");
18 18
     }
19 19
 
20 20
     protected function execute(InputInterface $input, OutputInterface $output)
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -24,15 +24,15 @@
 block discarded – undo
24 24
         $jobRepo = $em->getRepository('CronBundle:CronJob');
25 25
 
26 26
         $job = $jobRepo->findOneByCommand($jobName);
27
-        if(!$job)
27
+        if (!$job)
28 28
         {
29
-            $output->writeln("Couldn't find a job by the name of " . $jobName);
29
+            $output->writeln("Couldn't find a job by the name of ".$jobName);
30 30
             return CronJobResult::FAILED;
31 31
         }
32 32
 
33 33
         $job->setEnabled(true);
34 34
         $em->flush();
35 35
 
36
-        $output->writeln("Enabled cron job by the name of " . $jobName);
36
+        $output->writeln("Enabled cron job by the name of ".$jobName);
37 37
     }
38 38
 }
Please login to merge, or discard this patch.
src/Alpixel/Bundle/CronBundle/Command/MemoryWriter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
 
16 16
     public function doWrite($message, $newline) {
17 17
         $this->backingStore .= $message;
18
-        if($newline) {
18
+        if ($newline) {
19 19
             $this->backingStore .= "\n";
20 20
         }
21 21
     }
Please login to merge, or discard this patch.
src/Alpixel/Bundle/CronBundle/Command/CronPruneLogsCommand.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@
 block discarded – undo
16 16
     protected function configure()
17 17
     {
18 18
         $this->setName("cron:pruneLogs")
19
-             ->setDescription("Prunes the logs for each cron job, leaving only recent failures and the most recent success")
20
-             ->addArgument('job', InputArgument::OPTIONAL, 'Operate only on this job');
19
+                ->setDescription("Prunes the logs for each cron job, leaving only recent failures and the most recent success")
20
+                ->addArgument('job', InputArgument::OPTIONAL, 'Operate only on this job');
21 21
     }
22 22
 
23 23
     protected function execute(InputInterface $input, OutputInterface $output)
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
         $em = $this->getContainer()->get("doctrine.orm.entity_manager");
26 26
         $job = $input->getArgument('job');
27 27
 
28
-        if($job)
28
+        if ($job)
29 29
         {
30 30
             $output->writeln("Pruning logs for cron job $job");
31 31
         }
@@ -34,12 +34,12 @@  discard block
 block discarded – undo
34 34
             $output->writeln("Pruning logs for all cron jobs");
35 35
         }
36 36
 
37
-        if($job)
37
+        if ($job)
38 38
         {
39 39
             $jobObj = $em->getRepository('CronBundle:CronJob')->findOneByCommand($job);
40
-            if(!$jobObj)
40
+            if (!$jobObj)
41 41
             {
42
-                $output->writeln("Couldn't find a job by the name of " . $job);
42
+                $output->writeln("Couldn't find a job by the name of ".$job);
43 43
                 return CronJobResult::FAILED;
44 44
             }
45 45
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -28,8 +28,7 @@  discard block
 block discarded – undo
28 28
         if($job)
29 29
         {
30 30
             $output->writeln("Pruning logs for cron job $job");
31
-        }
32
-        else
31
+        } else
33 32
         {
34 33
             $output->writeln("Pruning logs for all cron jobs");
35 34
         }
@@ -44,8 +43,7 @@  discard block
 block discarded – undo
44 43
             }
45 44
 
46 45
             $em->getRepository('CronBundle:CronJobResult')->deleteOldLogs($jobObj);
47
-        }
48
-        else
46
+        } else
49 47
         {
50 48
             $em->getRepository('CronBundle:CronJobResult')->deleteOldLogs();
51 49
         }
Please login to merge, or discard this patch.
src/Alpixel/Bundle/CronBundle/Command/CronDisableJobCommand.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,8 +15,8 @@
 block discarded – undo
15 15
     protected function configure()
16 16
     {
17 17
         $this->setName("cron:disable-job")
18
-             ->setDescription("Disables a cron job")
19
-             ->addArgument("job", InputArgument::REQUIRED, "Name of the job to disable");
18
+                ->setDescription("Disables a cron job")
19
+                ->addArgument("job", InputArgument::REQUIRED, "Name of the job to disable");
20 20
     }
21 21
 
22 22
     protected function execute(InputInterface $input, OutputInterface $output)
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -26,15 +26,15 @@
 block discarded – undo
26 26
         $jobRepo = $em->getRepository('CronBundle:CronJob');
27 27
 
28 28
         $job = $jobRepo->findOneByCommand($jobName);
29
-        if(!$job)
29
+        if (!$job)
30 30
         {
31
-            $output->writeln("Couldn't find a job by the name of " . $jobName);
31
+            $output->writeln("Couldn't find a job by the name of ".$jobName);
32 32
             return CronJobResult::FAILED;
33 33
         }
34 34
 
35 35
         $job->setEnabled(false);
36 36
         $em->flush();
37 37
 
38
-        $output->writeln("Disabled cron job by the name of " . $jobName);
38
+        $output->writeln("Disabled cron job by the name of ".$jobName);
39 39
     }
40 40
 }
Please login to merge, or discard this patch.