1 | <?php |
||
17 | class ListCommand extends AbstractCommand |
||
18 | { |
||
19 | const DEFAULT_VALUE_JOB_NAME = 'all'; |
||
20 | |||
21 | /** |
||
22 | * Configures the current command. |
||
23 | */ |
||
24 | 3 | protected function configure() |
|
32 | |||
33 | /** |
||
34 | * @return int |
||
35 | * @throws \LogicException |
||
36 | */ |
||
37 | 3 | protected function process() |
|
64 | |||
65 | /** |
||
66 | * @param JobEntity $oJobEntity |
||
67 | * @param bool $bOnlyFailed |
||
68 | * @param bool $bOnlyDisabled |
||
69 | * @return bool |
||
70 | */ |
||
71 | 3 | private function hasJobToPrint(JobEntity $oJobEntity, $bOnlyFailed, $bOnlyDisabled) |
|
72 | { |
||
73 | 3 | $_bPrintAllJobs = (false === $bOnlyFailed && false === $bOnlyDisabled); |
|
74 | if ($_bPrintAllJobs) |
||
75 | 3 | { |
|
76 | 1 | return true; |
|
77 | } |
||
78 | |||
79 | 2 | $_bHasToPrint = false; |
|
80 | |||
81 | 2 | if (true === $bOnlyFailed && $oJobEntity->errorsSinceLastSuccess > 0) |
|
82 | 2 | { |
|
83 | 1 | $_bHasToPrint = true; |
|
84 | 1 | } |
|
85 | |||
86 | 2 | if (true === $bOnlyDisabled && true === $oJobEntity->disabled) |
|
87 | 2 | { |
|
88 | 1 | $_bHasToPrint = true; |
|
89 | 1 | } |
|
90 | |||
91 | 2 | return $_bHasToPrint; |
|
92 | } |
||
93 | |||
94 | /** |
||
95 | * @param Table $oTable |
||
96 | * @param JobEntity $oJobEntity |
||
97 | */ |
||
98 | 3 | private function printJobTableRow(Table $oTable, JobEntity $oJobEntity) |
|
112 | |||
113 | /** |
||
114 | * @param JobEntity $oJobEntity |
||
115 | * @return string |
||
116 | */ |
||
117 | 3 | private function getOutputLabel(JobEntity $oJobEntity) |
|
144 | |||
145 | /** |
||
146 | * @param JobEntity $oJobEntity |
||
147 | * @return string |
||
148 | */ |
||
149 | 3 | private function getOutputFormat(JobEntity $oJobEntity) |
|
164 | } |
When comparing two booleans, it is generally considered safer to use the strict comparison operator.