Completed
Pull Request — 2.1 (#7)
by David
02:07
created
src/Mouf/Utils/Patcher/PatchService.php 1 patch
Indentation   +89 added lines, -89 removed lines patch added patch discarded remove patch
@@ -30,42 +30,42 @@  discard block
 block discarded – undo
30 30
  * @ExtendedAction {"name":"View patches list", "url":"patcher/", "default":false}
31 31
  */
32 32
 class PatchService implements MoufValidatorInterface {
33
-    const IFEXISTS_EXCEPTION = "exception";
34
-    const IFEXISTS_IGNORE = "ignore";
33
+	const IFEXISTS_EXCEPTION = "exception";
34
+	const IFEXISTS_IGNORE = "ignore";
35 35
 
36 36
 
37
-    /**
37
+	/**
38 38
 	 * The list of patches declared for this application.
39 39
 	 * 
40 40
 	 * @var PatchInterface[]
41 41
 	 */
42 42
 	private $patchs = [];
43 43
 
44
-    /**
45
-     * The list of exiting patch types for this application.
46
-     *
47
-     * @var PatchType[]
48
-     */
44
+	/**
45
+	 * The list of exiting patch types for this application.
46
+	 *
47
+	 * @var PatchType[]
48
+	 */
49 49
 	private $types = [];
50 50
 
51
-    /**
52
-     * The list of listeners on the patch service.
53
-     *
54
-     * @var array|PatchListenerInterface[]
55
-     */
56
-    private $listeners;
51
+	/**
52
+	 * The list of listeners on the patch service.
53
+	 *
54
+	 * @var array|PatchListenerInterface[]
55
+	 */
56
+	private $listeners;
57 57
 
58
-    /**
59
-     * @param PatchType[] $types
60
-     * @param PatchListenerInterface[] $listeners
61
-     */
62
-    public function __construct(array $types, array $listeners = [])
63
-    {
64
-        $this->types = $types;
65
-        $this->listeners = $listeners;
66
-    }
58
+	/**
59
+	 * @param PatchType[] $types
60
+	 * @param PatchListenerInterface[] $listeners
61
+	 */
62
+	public function __construct(array $types, array $listeners = [])
63
+	{
64
+		$this->types = $types;
65
+		$this->listeners = $listeners;
66
+	}
67 67
 
68
-    /**
68
+	/**
69 69
 	 * The list of patches declared for this application.
70 70
 	 * @param PatchInterface[] $patchs
71 71
 	 * @return PatchService
@@ -75,26 +75,26 @@  discard block
 block discarded – undo
75 75
 		return $this;
76 76
 	}
77 77
 
78
-    /**
79
-     * The list of exiting patch types for this application.
80
-     *
81
-     * @return PatchType[]
82
-     */
83
-    public function getTypes(): array
84
-    {
85
-        return $this->types;
86
-    }
78
+	/**
79
+	 * The list of exiting patch types for this application.
80
+	 *
81
+	 * @return PatchType[]
82
+	 */
83
+	public function getTypes(): array
84
+	{
85
+		return $this->types;
86
+	}
87 87
 
88
-    /**
89
-     * @internal Returns a serialized list of types for the patch UI.
90
-     * @return array
91
-     */
92
-    public function _getSerializedTypes(): array
93
-    {
94
-        return array_map(function(PatchType $type) {
95
-            return $type->jsonSerialize();
96
-        }, $this->types);
97
-    }
88
+	/**
89
+	 * @internal Returns a serialized list of types for the patch UI.
90
+	 * @return array
91
+	 */
92
+	public function _getSerializedTypes(): array
93
+	{
94
+		return array_map(function(PatchType $type) {
95
+			return $type->jsonSerialize();
96
+		}, $this->types);
97
+	}
98 98
 
99 99
 	/**
100 100
 	 * Adds this patch to the list of existing patches.
@@ -223,8 +223,8 @@  discard block
 block discarded – undo
223 223
 	
224 224
 	/**
225 225
 	 * Returns a PHP array representing the patchs.
226
-     *
227
-     * @internal
226
+	 *
227
+	 * @internal
228 228
 	 */
229 229
 	public function getView(): array {
230 230
 		$view = array();
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 				"description"=>$description,
259 259
 				"error_message"=>$error_message,
260 260
 				"edit_url"=>$editUrl,
261
-                "patch_type"=>$patchType
261
+				"patch_type"=>$patchType
262 262
 			);
263 263
 			$view[] = $patchView;
264 264
 		}
@@ -293,52 +293,52 @@  discard block
 block discarded – undo
293 293
 		$patch->revert();
294 294
 	}
295 295
 
296
-    /**
297
-     * Apply all remaining patches (patches in state "awaiting" or in "error").
298
-     * The types of the patches can be passed as an array of string where the string is the name of the patch.
299
-     * Patches with the "default" type are always applied.
300
-     *
301
-     * @param string[] $types
302
-     * @return array An array containing 2 keys: "applied" and "skipped". Each key contains an associative array with the type of the patch and the number of patches of this type applied.
303
-     */
296
+	/**
297
+	 * Apply all remaining patches (patches in state "awaiting" or in "error").
298
+	 * The types of the patches can be passed as an array of string where the string is the name of the patch.
299
+	 * Patches with the "default" type are always applied.
300
+	 *
301
+	 * @param string[] $types
302
+	 * @return array An array containing 2 keys: "applied" and "skipped". Each key contains an associative array with the type of the patch and the number of patches of this type applied.
303
+	 */
304 304
 	public function applyAll(array $types = []): array {
305
-        // Array of count of applied and skipped patches. Key is the patch type.
306
-        $appliedPatchArray = [];
307
-        $skippedPatchArray = [];
305
+		// Array of count of applied and skipped patches. Key is the patch type.
306
+		$appliedPatchArray = [];
307
+		$skippedPatchArray = [];
308 308
 
309
-        foreach ($this->patchs as $patch) {
310
-            if ($patch->getStatus() === PatchInterface::STATUS_AWAITING || $patch->getStatus() === PatchInterface::STATUS_ERROR) {
311
-                $type = $patch->getPatchType()->getName();
312
-                if ($type === '' || in_array($type, $types, true)) {
313
-                    $this->apply($patch->getUniqueName());
314
-                    if (!isset($appliedPatchArray[$type])) {
315
-                        $appliedPatchArray[$type] = 0;
316
-                    }
317
-                    $appliedPatchArray[$type]++;
318
-                } else {
319
-                    $this->skip($patch->getUniqueName());
320
-                    if (!isset($skippedPatchArray[$type])) {
321
-                        $skippedPatchArray[$type] = 0;
322
-                    }
323
-                    $skippedPatchArray[$type]++;
324
-                }
325
-            }
326
-        }
309
+		foreach ($this->patchs as $patch) {
310
+			if ($patch->getStatus() === PatchInterface::STATUS_AWAITING || $patch->getStatus() === PatchInterface::STATUS_ERROR) {
311
+				$type = $patch->getPatchType()->getName();
312
+				if ($type === '' || in_array($type, $types, true)) {
313
+					$this->apply($patch->getUniqueName());
314
+					if (!isset($appliedPatchArray[$type])) {
315
+						$appliedPatchArray[$type] = 0;
316
+					}
317
+					$appliedPatchArray[$type]++;
318
+				} else {
319
+					$this->skip($patch->getUniqueName());
320
+					if (!isset($skippedPatchArray[$type])) {
321
+						$skippedPatchArray[$type] = 0;
322
+					}
323
+					$skippedPatchArray[$type]++;
324
+				}
325
+			}
326
+		}
327 327
 
328
-        return [
329
-            'applied' => $appliedPatchArray,
330
-            'skipped' => $skippedPatchArray
331
-        ];
332
-    }
328
+		return [
329
+			'applied' => $appliedPatchArray,
330
+			'skipped' => $skippedPatchArray
331
+		];
332
+	}
333 333
 
334
-    /**
335
-     * Reset all patches to a not applied state.
336
-     *
337
-     * Note: this does NOT run the "revert" method on each patch but DOES trigger a "reset" event.
338
-     */
334
+	/**
335
+	 * Reset all patches to a not applied state.
336
+	 *
337
+	 * Note: this does NOT run the "revert" method on each patch but DOES trigger a "reset" event.
338
+	 */
339 339
 	public function reset(): void {
340
-        foreach ($this->listeners as $listener) {
341
-            $listener->onReset();
342
-        }
343
-    }
340
+		foreach ($this->listeners as $listener) {
341
+			$listener->onReset();
342
+		}
343
+	}
344 344
 }
Please login to merge, or discard this patch.
src/Mouf/Utils/Patcher/Controllers/PatchController.php 1 patch
Indentation   +96 added lines, -97 removed lines patch added patch discarded remove patch
@@ -20,7 +20,6 @@  discard block
 block discarded – undo
20 20
 
21 21
 /**
22 22
  * The controller to track which patchs have been applied.
23
-
24 23
  */
25 24
 class PatchController extends AbstractMoufInstanceController {
26 25
 	
@@ -99,115 +98,115 @@  discard block
 block discarded – undo
99 98
 		header('Location: .?name='.urlencode($name));
100 99
 	}
101 100
 
102
-    /**
103
-     * Displays the page to select the patch types to be applied.
104
-     *
105
-     * @Action
106
-     * @Logged
107
-     * @param string $name
108
-     * @param string $selfedit
109
-     * @param string $action One of "reset" or "apply"
110
-     */
111
-    public function runAllPatches($name, $selfedit, $action) {
112
-        $this->initController($name, $selfedit);
113
-
114
-        $patchService = new InstanceProxy($name, $selfedit == "true");
115
-        $this->patchesArray = $patchService->getView();
116
-
117
-        $types = $patchService->_getSerializedTypes();
118
-
119
-        foreach ($types as $type) {
120
-            $this->nbPatchesByType[$type['name']] = 0;
121
-        }
122
-
123
-        $nbNoneDefaultPatches = 0;
124
-
125
-        foreach ($this->patchesArray as $patch) {
126
-            if ($action === 'reset' || $patch['status'] === PatchInterface::STATUS_AWAITING || $patch['status'] === PatchInterface::STATUS_ERROR) {
127
-                $type = $patch['patch_type'];
128
-                if ($type !== '') {
129
-                    $nbNoneDefaultPatches++;
130
-                }
131
-                $this->nbPatchesByType[$type]++;
132
-            }
133
-        }
134
-
135
-        // If all patches to be applied are default patches, let's do this right now.
136
-        if ($nbNoneDefaultPatches === 0) {
137
-            $this->applyAllPatches($name, [''], $action, $selfedit);
138
-            return;
139
-        }
140
-
141
-        ksort($this->nbPatchesByType);
142
-
143
-        $this->action = $action;
144
-
145
-        // Otherwise, let's display a screen to select the patch types to be applied.
146
-        $this->content->addFile(__DIR__."/../../../../views/applyPatches.php", $this);
147
-        $this->template->toHtml();
148
-    }
149
-
150
-
151
-    /**
152
-     * Runs all patches in a row.
153
-     *
154
-     * @Action
155
-     * @Logged
156
-     * @param string $name
157
-     * @param string[] $types
158
-     * @param string $action One of "reset" or "apply"
159
-     * @param string $selfedit
160
-     */
101
+	/**
102
+	 * Displays the page to select the patch types to be applied.
103
+	 *
104
+	 * @Action
105
+	 * @Logged
106
+	 * @param string $name
107
+	 * @param string $selfedit
108
+	 * @param string $action One of "reset" or "apply"
109
+	 */
110
+	public function runAllPatches($name, $selfedit, $action) {
111
+		$this->initController($name, $selfedit);
112
+
113
+		$patchService = new InstanceProxy($name, $selfedit == "true");
114
+		$this->patchesArray = $patchService->getView();
115
+
116
+		$types = $patchService->_getSerializedTypes();
117
+
118
+		foreach ($types as $type) {
119
+			$this->nbPatchesByType[$type['name']] = 0;
120
+		}
121
+
122
+		$nbNoneDefaultPatches = 0;
123
+
124
+		foreach ($this->patchesArray as $patch) {
125
+			if ($action === 'reset' || $patch['status'] === PatchInterface::STATUS_AWAITING || $patch['status'] === PatchInterface::STATUS_ERROR) {
126
+				$type = $patch['patch_type'];
127
+				if ($type !== '') {
128
+					$nbNoneDefaultPatches++;
129
+				}
130
+				$this->nbPatchesByType[$type]++;
131
+			}
132
+		}
133
+
134
+		// If all patches to be applied are default patches, let's do this right now.
135
+		if ($nbNoneDefaultPatches === 0) {
136
+			$this->applyAllPatches($name, [''], $action, $selfedit);
137
+			return;
138
+		}
139
+
140
+		ksort($this->nbPatchesByType);
141
+
142
+		$this->action = $action;
143
+
144
+		// Otherwise, let's display a screen to select the patch types to be applied.
145
+		$this->content->addFile(__DIR__."/../../../../views/applyPatches.php", $this);
146
+		$this->template->toHtml();
147
+	}
148
+
149
+
150
+	/**
151
+	 * Runs all patches in a row.
152
+	 *
153
+	 * @Action
154
+	 * @Logged
155
+	 * @param string $name
156
+	 * @param string[] $types
157
+	 * @param string $action One of "reset" or "apply"
158
+	 * @param string $selfedit
159
+	 */
161 160
 	public function applyAllPatches($name, array $types, $action, $selfedit) {
162 161
 		$patchService = new InstanceProxy($name, $selfedit == "true");
163 162
 		/* @var $patchService PatchService */
164 163
 
165
-        if ($action === 'reset') {
166
-            $patchService->reset();
167
-        }
168
-        try {
164
+		if ($action === 'reset') {
165
+			$patchService->reset();
166
+		}
167
+		try {
169 168
 
170
-            [
171
-                'applied' => $appliedPatchArray,
172
-                'skipped' => $skippedPatchArray
173
-            ] = $patchService->applyAll($types);
169
+			[
170
+				'applied' => $appliedPatchArray,
171
+				'skipped' => $skippedPatchArray
172
+			] = $patchService->applyAll($types);
174 173
 
175 174
 		} catch (\Exception $e) {
176 175
 			$htmlMessage = "An error occured while applying the patch: ".$e->getMessage();
177 176
 			set_user_message($htmlMessage);
178 177
 		}
179 178
 
180
-        $this->displayNotificationMessage($appliedPatchArray, $skippedPatchArray);
179
+		$this->displayNotificationMessage($appliedPatchArray, $skippedPatchArray);
181 180
 
182
-        header('Location: .?name='.urlencode($name));
181
+		header('Location: .?name='.urlencode($name));
183 182
 	}
184 183
 
185 184
 	private function displayNotificationMessage(array $appliedPatchArray, array $skippedPatchArray)
186
-    {
187
-        $nbPatchesApplied = array_sum($appliedPatchArray);
188
-        $nbPatchesSkipped = array_sum($skippedPatchArray);
189
-        $msg = '';
190
-        if ($nbPatchesApplied !== 0) {
191
-            $patchArr = [];
192
-            foreach ($appliedPatchArray as $name => $number) {
193
-                $name = $name ?: 'default';
194
-                $patchArr[] = plainstring_to_htmlprotected($name).': '.$number;
195
-            }
196
-
197
-            $msg .= sprintf('%d patch%s applied (%s)', $nbPatchesApplied, ($nbPatchesApplied > 1)?'es':'', implode(', ', $patchArr));
198
-        }
199
-        if ($nbPatchesSkipped !== 0) {
200
-            $patchArr = [];
201
-            foreach ($skippedPatchArray as $name => $number) {
202
-                $name = $name ?: 'default';
203
-                $patchArr[] = plainstring_to_htmlprotected($name).': '.$number;
204
-            }
205
-
206
-            $msg .= sprintf('%d patch%s skipped (%s)', $nbPatchesSkipped, ($nbPatchesSkipped > 1)?'es':'', implode(', ', $patchArr));
207
-        }
208
-
209
-        if ($msg !== '') {
210
-            set_user_message($msg, UserMessageInterface::SUCCESS);
211
-        }
212
-    }
185
+	{
186
+		$nbPatchesApplied = array_sum($appliedPatchArray);
187
+		$nbPatchesSkipped = array_sum($skippedPatchArray);
188
+		$msg = '';
189
+		if ($nbPatchesApplied !== 0) {
190
+			$patchArr = [];
191
+			foreach ($appliedPatchArray as $name => $number) {
192
+				$name = $name ?: 'default';
193
+				$patchArr[] = plainstring_to_htmlprotected($name).': '.$number;
194
+			}
195
+
196
+			$msg .= sprintf('%d patch%s applied (%s)', $nbPatchesApplied, ($nbPatchesApplied > 1)?'es':'', implode(', ', $patchArr));
197
+		}
198
+		if ($nbPatchesSkipped !== 0) {
199
+			$patchArr = [];
200
+			foreach ($skippedPatchArray as $name => $number) {
201
+				$name = $name ?: 'default';
202
+				$patchArr[] = plainstring_to_htmlprotected($name).': '.$number;
203
+			}
204
+
205
+			$msg .= sprintf('%d patch%s skipped (%s)', $nbPatchesSkipped, ($nbPatchesSkipped > 1)?'es':'', implode(', ', $patchArr));
206
+		}
207
+
208
+		if ($msg !== '') {
209
+			set_user_message($msg, UserMessageInterface::SUCCESS);
210
+		}
211
+	}
213 212
 }
214 213
\ No newline at end of file
Please login to merge, or discard this patch.
src/Mouf/Utils/Patcher/Commands/ApplyAllPatchesCommand.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -17,32 +17,32 @@
 block discarded – undo
17 17
 {
18 18
 
19 19
 
20
-    /**
21
-     * {@inheritdoc}
22
-     */
23
-    protected function configure()
24
-    {
25
-        $this
26
-        ->setName('patches:apply-all')
27
-        ->setDescription('Apply pending patches.')
28
-        ->setDefinition(array(
29
-
30
-        ))
31
-        ->setHelp(<<<EOT
20
+	/**
21
+	 * {@inheritdoc}
22
+	 */
23
+	protected function configure()
24
+	{
25
+		$this
26
+		->setName('patches:apply-all')
27
+		->setDescription('Apply pending patches.')
28
+		->setDefinition(array(
29
+
30
+		))
31
+		->setHelp(<<<EOT
32 32
 Apply pending patches. You can select the type of patches to be applied using the options. Default patches are always applied.
33 33
 
34 34
 Use patches:apply if you want to cherry-pick a particular patch.
35 35
 EOT
36
-        );
37
-
38
-        $this->registerOptions();
39
-    }
40
-
41
-    /**
42
-     * {@inheritdoc}
43
-     */
44
-    protected function execute(InputInterface $input, OutputInterface $output)
45
-    {
46
-        $this->applyAll($input, $output);
47
-    }
36
+		);
37
+
38
+		$this->registerOptions();
39
+	}
40
+
41
+	/**
42
+	 * {@inheritdoc}
43
+	 */
44
+	protected function execute(InputInterface $input, OutputInterface $output)
45
+	{
46
+		$this->applyAll($input, $output);
47
+	}
48 48
 }
Please login to merge, or discard this patch.
src/Mouf/Utils/Patcher/Commands/AbstractApplyAllCommand.php 1 patch
Indentation   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -12,81 +12,81 @@
 block discarded – undo
12 12
 
13 13
 class AbstractApplyAllCommand extends Command
14 14
 {
15
-    /**
16
-     * @var PatchService
17
-     */
18
-    protected $patchService;
19
-
20
-    public function __construct(PatchService $patchService)
21
-    {
22
-        $this->patchService = $patchService;
23
-        parent::__construct();
24
-    }
25
-
26
-    protected function registerOptions(): void
27
-    {
28
-        foreach ($this->patchService->getTypes() as $type) {
29
-            if ($type->getName() !== '') {
30
-                $this->addOption($type->getName(), null, InputOption::VALUE_NONE, 'Applies patches of type "'.$type->getName().'". '.$type->getDescription());
31
-            }
32
-        }
33
-    }
34
-
35
-    protected function applyAll(InputInterface $input, OutputInterface $output)
36
-    {
37
-        $types = [];
38
-        foreach ($this->patchService->getTypes() as $type) {
39
-            if ($type->getName() !== '' && $input->getOption($type->getName())) {
40
-                $types[] = $type->getName();
41
-            }
42
-        }
43
-
44
-        try {
45
-
46
-            [
47
-                'applied' => $appliedPatchArray,
48
-                'skipped' => $skippedPatchArray
49
-            ] = $this->patchService->applyAll($types);
50
-
51
-        } catch (\Exception $e) {
52
-            $output->writeln(sprintf(
53
-                'An error occurred while applying patch: <error>%s</error>', $e->getMessage()
54
-            ));
55
-            throw $e;
56
-        }
57
-
58
-        $msg = $this->getNotificationMessage($appliedPatchArray, $skippedPatchArray);
59
-        if ($msg) {
60
-            $output->writeln($msg);
61
-        } else {
62
-            $output->writeln('<info>No patches to apply</info>');
63
-        }
64
-    }
65
-
66
-    private function getNotificationMessage(array $appliedPatchArray, array $skippedPatchArray): string
67
-    {
68
-        $nbPatchesApplied = array_sum($appliedPatchArray);
69
-        $nbPatchesSkipped = array_sum($skippedPatchArray);
70
-        $msg = '';
71
-        if ($nbPatchesApplied !== 0) {
72
-            $patchArr = [];
73
-            foreach ($appliedPatchArray as $name => $number) {
74
-                $name = $name ?: 'default';
75
-                $patchArr[] = $name.': <info>'.$number.'</info>';
76
-            }
77
-
78
-            $msg .= sprintf('<info>%d</info> patch%s applied (%s)', $nbPatchesApplied, ($nbPatchesApplied > 1)?'es':'', implode(', ', $patchArr))."\n";
79
-        }
80
-        if ($nbPatchesSkipped !== 0) {
81
-            $patchArr = [];
82
-            foreach ($skippedPatchArray as $name => $number) {
83
-                $name = $name ?: 'default';
84
-                $patchArr[] = $name.': <info>'.$number.'</info>';
85
-            }
86
-
87
-            $msg .= sprintf('<info>%d</info><comment> patch%s skipped</comment> (%s)', $nbPatchesSkipped, ($nbPatchesSkipped > 1)?'es':'', implode(', ', $patchArr));
88
-        }
89
-
90
-        return $msg;
91
-    }
15
+	/**
16
+	 * @var PatchService
17
+	 */
18
+	protected $patchService;
19
+
20
+	public function __construct(PatchService $patchService)
21
+	{
22
+		$this->patchService = $patchService;
23
+		parent::__construct();
24
+	}
25
+
26
+	protected function registerOptions(): void
27
+	{
28
+		foreach ($this->patchService->getTypes() as $type) {
29
+			if ($type->getName() !== '') {
30
+				$this->addOption($type->getName(), null, InputOption::VALUE_NONE, 'Applies patches of type "'.$type->getName().'". '.$type->getDescription());
31
+			}
32
+		}
33
+	}
34
+
35
+	protected function applyAll(InputInterface $input, OutputInterface $output)
36
+	{
37
+		$types = [];
38
+		foreach ($this->patchService->getTypes() as $type) {
39
+			if ($type->getName() !== '' && $input->getOption($type->getName())) {
40
+				$types[] = $type->getName();
41
+			}
42
+		}
43
+
44
+		try {
45
+
46
+			[
47
+				'applied' => $appliedPatchArray,
48
+				'skipped' => $skippedPatchArray
49
+			] = $this->patchService->applyAll($types);
50
+
51
+		} catch (\Exception $e) {
52
+			$output->writeln(sprintf(
53
+				'An error occurred while applying patch: <error>%s</error>', $e->getMessage()
54
+			));
55
+			throw $e;
56
+		}
57
+
58
+		$msg = $this->getNotificationMessage($appliedPatchArray, $skippedPatchArray);
59
+		if ($msg) {
60
+			$output->writeln($msg);
61
+		} else {
62
+			$output->writeln('<info>No patches to apply</info>');
63
+		}
64
+	}
65
+
66
+	private function getNotificationMessage(array $appliedPatchArray, array $skippedPatchArray): string
67
+	{
68
+		$nbPatchesApplied = array_sum($appliedPatchArray);
69
+		$nbPatchesSkipped = array_sum($skippedPatchArray);
70
+		$msg = '';
71
+		if ($nbPatchesApplied !== 0) {
72
+			$patchArr = [];
73
+			foreach ($appliedPatchArray as $name => $number) {
74
+				$name = $name ?: 'default';
75
+				$patchArr[] = $name.': <info>'.$number.'</info>';
76
+			}
77
+
78
+			$msg .= sprintf('<info>%d</info> patch%s applied (%s)', $nbPatchesApplied, ($nbPatchesApplied > 1)?'es':'', implode(', ', $patchArr))."\n";
79
+		}
80
+		if ($nbPatchesSkipped !== 0) {
81
+			$patchArr = [];
82
+			foreach ($skippedPatchArray as $name => $number) {
83
+				$name = $name ?: 'default';
84
+				$patchArr[] = $name.': <info>'.$number.'</info>';
85
+			}
86
+
87
+			$msg .= sprintf('<info>%d</info><comment> patch%s skipped</comment> (%s)', $nbPatchesSkipped, ($nbPatchesSkipped > 1)?'es':'', implode(', ', $patchArr));
88
+		}
89
+
90
+		return $msg;
91
+	}
92 92
 }
93 93
\ No newline at end of file
Please login to merge, or discard this patch.
src/Mouf/Utils/Patcher/Commands/ResetPatchesCommand.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -15,34 +15,34 @@
 block discarded – undo
15 15
  */
16 16
 class ResetPatchesCommand extends AbstractApplyAllCommand
17 17
 {
18
-    /**
19
-     * {@inheritdoc}
20
-     */
21
-    protected function configure()
22
-    {
23
-        $this
24
-        ->setName('patches:reset')
25
-        ->setDescription('Reset database and reapply all patches.')
26
-        ->setDefinition(array(
18
+	/**
19
+	 * {@inheritdoc}
20
+	 */
21
+	protected function configure()
22
+	{
23
+		$this
24
+		->setName('patches:reset')
25
+		->setDescription('Reset database and reapply all patches.')
26
+		->setDefinition(array(
27 27
 
28
-        ))
29
-        ->setHelp(<<<EOT
28
+		))
29
+		->setHelp(<<<EOT
30 30
 Reset the database and reapplies all pending patches. You can select the type of patches to be applied using the options. Default patches are always applied.
31 31
 
32 32
 Use patches:apply-all if you want to apply remaining patches without resetting the database.
33 33
 EOT
34
-        );
34
+		);
35 35
 
36
-        $this->registerOptions();
37
-    }
36
+		$this->registerOptions();
37
+	}
38 38
 
39
-    /**
40
-     * {@inheritdoc}
41
-     */
42
-    protected function execute(InputInterface $input, OutputInterface $output)
43
-    {
44
-        $this->patchService->reset();
39
+	/**
40
+	 * {@inheritdoc}
41
+	 */
42
+	protected function execute(InputInterface $input, OutputInterface $output)
43
+	{
44
+		$this->patchService->reset();
45 45
 
46
-        $this->applyAll($input, $output);
47
-    }
46
+		$this->applyAll($input, $output);
47
+	}
48 48
 }
Please login to merge, or discard this patch.