RevisionLog   F
last analyzed

Complexity

Total Complexity 69

Size/Duplication

Total Lines 626
Duplicated Lines 0 %

Test Coverage

Coverage 87.22%

Importance

Changes 4
Bugs 0 Features 0
Metric Value
wmc 69
eloc 163
c 4
b 0
f 0
dl 0
loc 626
ccs 157
cts 180
cp 0.8722
rs 2.88

27 Methods

Rating   Name   Duplication   Size   Complexity  
A refresh() 0 27 5
A getRevisionURLBuilder() 0 3 1
A setForceRefreshFlag() 0 7 2
A __construct() 0 17 1
A getForceRefreshFlag() 0 3 1
A getPlugin() 0 7 2
A setPluginsOverwriteMode() 0 4 2
A reparse() 0 8 2
B _useRepositoryCollectorPlugins() 0 56 9
B _useDatabaseCollectorPlugins() 0 35 8
A _getAggregateRevision() 0 13 3
A _queryRevisionData() 0 7 3
A _getRevisionQueryFlags() 0 9 2
A getRefName() 0 3 1
A getRevisionsData() 0 3 1
A find() 0 3 1
A _getLogCommandArguments() 0 17 3
A registerPlugin() 0 10 2
A getPluginsByInterface() 0 15 4
A _databaseReady() 0 4 2
A _parseLog() 0 4 2
A getRepositoryCollectorPlugins() 0 9 2
A getDatabaseCollectorPlugins() 0 9 2
A _displayPluginActivityStatistics() 0 14 3
A getProjectPath() 0 3 1
A pluginRegistered() 0 3 1
A getBugsFromRevisions() 0 14 3

How to fix   Complexity   

Complex Class

Complex classes like RevisionLog often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

While breaking up the class, it is a good idea to analyze how other classes use RevisionLog, and based on these observations, apply Extract Interface, too.

1
<?php
2
/**
3
 * This file is part of the SVN-Buddy library.
4
 * For the full copyright and license information, please view
5
 * the LICENSE file that was distributed with this source code.
6
 *
7
 * @copyright Alexander Obuhovich <[email protected]>
8
 * @link      https://github.com/console-helpers/svn-buddy
9
 */
10
11
namespace ConsoleHelpers\SVNBuddy\Repository\RevisionLog;
12
13
14
use ConsoleHelpers\ConsoleKit\ConsoleIO;
15
use ConsoleHelpers\SVNBuddy\Repository\Connector\Connector;
16
use ConsoleHelpers\SVNBuddy\Repository\RevisionLog\Plugin\DatabaseCollectorPlugin\IDatabaseCollectorPlugin;
17
use ConsoleHelpers\SVNBuddy\Repository\RevisionLog\Plugin\IOverwriteAwarePlugin;
18
use ConsoleHelpers\SVNBuddy\Repository\RevisionLog\Plugin\IPlugin;
19
use ConsoleHelpers\SVNBuddy\Repository\RevisionLog\Plugin\RepositoryCollectorPlugin\IRepositoryCollectorPlugin;
20
use ConsoleHelpers\SVNBuddy\Repository\RevisionUrlBuilder;
21
22
class RevisionLog
23
{
24
25
	const FLAG_VERBOSE = 1;
26
27
	const FLAG_MERGE_HISTORY = 2;
28
29
	/**
30
	 * Repository path.
31
	 *
32
	 * @var string
33
	 */
34
	private $_repositoryRootUrl;
35
36
	/**
37
	 * Project path.
38
	 *
39
	 * @var string
40
	 */
41
	private $_projectPath;
42
43
	/**
44
	 * Ref name.
45
	 *
46
	 * @var string
47
	 */
48
	private $_refName;
49
50
	/**
51
	 * Repository connector.
52
	 *
53
	 * @var Connector
54
	 */
55
	private $_repositoryConnector;
56
57
	/**
58
	 * Console IO.
59
	 *
60
	 * @var ConsoleIO
61
	 */
62
	private $_io;
63
64
	/**
65
	 * Installed plugins.
66
	 *
67
	 * @var IPlugin[]
68
	 */
69
	private $_plugins = array();
70
71
	/**
72
	 * Revision URL builder.
73
	 *
74
	 * @var RevisionUrlBuilder
75
	 */
76
	private $_revisionUrlBuilder;
77
78
	/**
79
	 * Force refresh flag filename.
80
	 *
81
	 * @var string
82
	 */
83
	private $_forceRefreshFlagFilename;
84
85
	/**
86
	 * Create revision log.
87
	 *
88
	 * @param string             $repository_url       Repository url.
89
	 * @param RevisionUrlBuilder $revision_url_builder Revision URL builder.
90
	 * @param Connector          $repository_connector Repository connector.
91
	 * @param string             $working_directory    Working directory.
92
	 * @param ConsoleIO          $io                   Console IO.
93
	 */
94 19
	public function __construct(
95
		$repository_url,
96
		RevisionUrlBuilder $revision_url_builder,
97
		Connector $repository_connector,
98
		$working_directory,
99
		ConsoleIO $io = null
100
	) {
101 19
		$this->_io = $io;
102 19
		$this->_repositoryConnector = $repository_connector;
103
104 19
		$this->_repositoryRootUrl = $repository_connector->getRootUrl($repository_url);
105
106 19
		$relative_path = $repository_connector->getRelativePath($repository_url);
107 19
		$this->_projectPath = $repository_connector->getProjectUrl($relative_path) . '/';
108 19
		$this->_refName = $repository_connector->getRefByPath($relative_path);
0 ignored issues
show
Documentation Bug introduced by
It seems like $repository_connector->g...fByPath($relative_path) can also be of type boolean. However, the property $_refName is declared as type string. Maybe add an additional type check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.

For example, imagine you have a variable $accountId that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to the id property of an instance of the Account class. This class holds a proper account, so the id value must no longer be false.

Either this assignment is in error or a type check should be added for that assignment.

class Id
{
    public $id;

    public function __construct($id)
    {
        $this->id = $id;
    }

}

class Account
{
    /** @var  Id $id */
    public $id;
}

$account_id = false;

if (starsAreRight()) {
    $account_id = new Id(42);
}

$account = new Account();
if ($account instanceof Id)
{
    $account->id = $account_id;
}
Loading history...
109 19
		$this->_revisionUrlBuilder = $revision_url_builder;
110 19
		$this->_forceRefreshFlagFilename = $working_directory . '/' . md5($this->_repositoryRootUrl) . '.force-refresh';
111
	}
112
113
	/**
114
	 * Returns revision URL builder.
115
	 *
116
	 * @return RevisionUrlBuilder
117
	 */
118 1
	public function getRevisionURLBuilder()
119
	{
120 1
		return $this->_revisionUrlBuilder;
121
	}
122
123
	/**
124
	 * Queries missing revisions.
125
	 *
126
	 * @param boolean $is_migration Is migration.
127
	 *
128
	 * @return void
129
	 * @throws \LogicException When no plugins are registered.
130
	 */
131 6
	public function refresh($is_migration)
132
	{
133 6
		if ( !$this->_plugins ) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $this->_plugins of type ConsoleHelpers\SVNBuddy\...ionLog\Plugin\IPlugin[] is implicitly converted to a boolean; are you sure this is intended? If so, consider using empty($expr) instead to make it clear that you intend to check for an array without elements.

This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.

Consider making the comparison explicit by using empty(..) or ! empty(...) instead.

Loading history...
134 1
			throw new \LogicException('Please register at least one revision log plugin.');
135
		}
136
137 5
		$this->_databaseReady();
138
139 5
		if ( $is_migration ) {
140
			// Import missing data for imported commits only.
141
			$from_revision = 0;
142
			$to_revision = $this->_getAggregateRevision('max');
143
		}
144
		else {
145
			// Import all data for new commits only.
146 5
			$from_revision = $this->_getAggregateRevision('min');
147
148 5
			if ( $this->getForceRefreshFlag() ) {
149
				$this->_repositoryConnector->withCacheOverwrite(true);
150
				$this->setForceRefreshFlag(false);
151
			}
152
153 5
			$to_revision = $this->_repositoryConnector->getLastRevision($this->_repositoryRootUrl);
154
		}
155
156 5
		if ( $to_revision > $from_revision ) {
157 3
			$this->_queryRevisionData($from_revision, $to_revision);
158
		}
159
	}
160
161
	/**
162
	 * Sets force refresh flag.
163
	 *
164
	 * @param boolean $flag Flag.
165
	 *
166
	 * @return void
167
	 */
168
	public function setForceRefreshFlag($flag)
169
	{
170
		if ( $flag ) {
171
			touch($this->_forceRefreshFlagFilename);
172
		}
173
		else {
174
			unlink($this->_forceRefreshFlagFilename);
175
		}
176
	}
177
178
	/**
179
	 * Gets force refresh flag.
180
	 *
181
	 * @return boolean
182
	 */
183 5
	protected function getForceRefreshFlag()
184
	{
185 5
		return file_exists($this->_forceRefreshFlagFilename);
186
	}
187
188
	/**
189
	 * Reparses a revision.
190
	 *
191
	 * @param integer $from_revision From revision.
192
	 * @param integer $to_revision   To revision.
193
	 *
194
	 * @return void
195
	 * @throws \LogicException When no plugins are registered.
196
	 */
197
	public function reparse($from_revision, $to_revision)
198
	{
199
		if ( !$this->_plugins ) {
200
			throw new \LogicException('Please register at least one revision log plugin.');
201
		}
202
203
		$this->_databaseReady();
204
		$this->_queryRevisionData($from_revision, $to_revision, true);
205
	}
206
207
	/**
208
	 * Reports to each plugin, that database is ready for usage.
209
	 *
210
	 * @return void
211
	 */
212 5
	private function _databaseReady()
213
	{
214 5
		foreach ( $this->_plugins as $plugin ) {
215 5
			$plugin->whenDatabaseReady();
216
		}
217
	}
218
219
	/**
220
	 * Returns aggregated revision from all plugins.
221
	 *
222
	 * @param string $function Aggregate function.
223
	 *
224
	 * @return integer
225
	 */
226 5
	private function _getAggregateRevision($function)
227
	{
228 5
		$last_revisions = array();
229
230 5
		foreach ( $this->_plugins as $plugin ) {
231 5
			$last_revisions[] = $plugin->getLastRevision();
232
		}
233
234 5
		if ( count($last_revisions) > 1 ) {
235 5
			return call_user_func_array($function, $last_revisions);
236
		}
237
238
		return current($last_revisions);
239
	}
240
241
	/**
242
	 * Queries missing revision data.
243
	 *
244
	 * @param integer $from_revision From revision.
245
	 * @param integer $to_revision   To revision.
246
	 * @param boolean $overwrite     Overwrite.
247
	 *
248
	 * @return void
249
	 */
250 3
	private function _queryRevisionData($from_revision, $to_revision, $overwrite = false)
251
	{
252 3
		$this->_useRepositoryCollectorPlugins($from_revision, $to_revision, $overwrite);
253 3
		$this->_useDatabaseCollectorPlugins($from_revision, $to_revision, $overwrite);
254
255 3
		if ( isset($this->_io) && $this->_io->isVerbose() ) {
256 1
			$this->_displayPluginActivityStatistics();
257
		}
258
	}
259
260
	/**
261
	 * Use repository collector plugins.
262
	 *
263
	 * @param integer $from_revision From revision.
264
	 * @param integer $to_revision   To revision.
265
	 * @param boolean $overwrite     Overwrite.
266
	 *
267
	 * @return void
268
	 */
269 3
	private function _useRepositoryCollectorPlugins($from_revision, $to_revision, $overwrite = false)
270
	{
271 3
		$batch_size = 500; // Revision count to query in one go.
272
273
		// The "io" isn't set during autocomplete.
274 3
		if ( isset($this->_io) ) {
275
			// Create progress bar for repository plugins, where data amount is known upfront.
276 2
			$progress_bar = $this->_io->createProgressBar(ceil(($to_revision - $from_revision) / $batch_size) + 1);
0 ignored issues
show
Bug introduced by
ceil($to_revision - $fro...sion / $batch_size) + 1 of type double is incompatible with the type integer expected by parameter $max of ConsoleHelpers\ConsoleKi...IO::createProgressBar(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

276
			$progress_bar = $this->_io->createProgressBar(/** @scrutinizer ignore-type */ ceil(($to_revision - $from_revision) / $batch_size) + 1);
Loading history...
277 2
			$progress_bar->setMessage(
278 2
				$overwrite ? '* Reparsing revisions:' : ' * Reading missing revisions:'
279 2
			);
280 2
			$progress_bar->setFormat(
281 2
				'%message% %current%/%max% [%bar%] <info>%percent:3s%%</info> %elapsed:6s%/%estimated:-6s% <info>%memory:-10s%</info>'
282 2
			);
283 2
			$progress_bar->start();
284
		}
285
286 3
		$plugins = $this->getRepositoryCollectorPlugins($overwrite);
287
288 3
		if ( $overwrite ) {
289
			$this->setPluginsOverwriteMode($plugins, true);
290
		}
291
292 3
		$range_start = $from_revision;
293 3
		$cache_duration = $overwrite ? null : '10 years';
294 3
		$log_command_arguments = $this->_getLogCommandArguments($plugins);
295
296 3
		while ( $range_start <= $to_revision ) {
297 3
			$range_end = min($range_start + ($batch_size - 1), $to_revision);
298
299 3
			$command_arguments = str_replace(
300 3
				array('{revision_range}', '{repository_url}'),
301 3
				array($range_start . ':' . $range_end, $this->_repositoryRootUrl),
302 3
				$log_command_arguments
303 3
			);
304 3
			$command = $this->_repositoryConnector->getCommand('log', $command_arguments);
305 3
			$command->setCacheDuration($cache_duration)->setIdleTimeoutRecovery(true);
306 3
			$svn_log = $command->run();
307
308 3
			$this->_parseLog($svn_log, $plugins);
0 ignored issues
show
Bug introduced by
It seems like $svn_log can also be of type string; however, parameter $log of ConsoleHelpers\SVNBuddy\...evisionLog::_parseLog() does only seem to accept SimpleXMLElement, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

308
			$this->_parseLog(/** @scrutinizer ignore-type */ $svn_log, $plugins);
Loading history...
309
310 3
			$range_start = $range_end + 1;
311
312 3
			if ( isset($progress_bar) ) {
313 2
				$progress_bar->advance();
314
			}
315
		}
316
317
		// Remove progress bar of repository plugins.
318 3
		if ( isset($progress_bar) ) {
319 2
			$progress_bar->clear();
320 2
			unset($progress_bar);
321
		}
322
323 3
		if ( $overwrite ) {
324
			$this->setPluginsOverwriteMode($plugins, false);
325
		}
326
	}
327
328
	/**
329
	 * Use database collector plugins.
330
	 *
331
	 * @param integer $from_revision From revision.
332
	 * @param integer $to_revision   To revision.
333
	 * @param boolean $overwrite     Overwrite.
334
	 *
335
	 * @return void
336
	 */
337 3
	private function _useDatabaseCollectorPlugins($from_revision, $to_revision, $overwrite = false)
338
	{
339 3
		$plugins = $this->getDatabaseCollectorPlugins($overwrite);
340
341 3
		if ( $overwrite ) {
342
			$this->setPluginsOverwriteMode($plugins, true);
343
		}
344
345
		// The "io" isn't set during autocomplete.
346 3
		if ( isset($this->_io) ) {
347
			// Create progress bar for database plugins, where data amount isn't known upfront.
348 2
			$progress_bar = $this->_io->createProgressBar();
349 2
			$progress_bar->setMessage(
350 2
				$overwrite ? '* Reparsing revisions:' : ' * Reading missing revisions:'
351 2
			);
352 2
			$progress_bar->setFormat('%message% %current% [%bar%] %elapsed:6s% <info>%memory:-10s%</info>');
353 2
			$progress_bar->start();
354
355 2
			foreach ( $plugins as $plugin ) {
356 2
				$plugin->process($from_revision, $to_revision, $progress_bar);
357
			}
358
		}
359
		else {
360 1
			foreach ( $plugins as $plugin ) {
361 1
				$plugin->process($from_revision, $to_revision);
362
			}
363
		}
364
365 3
		if ( $overwrite ) {
366
			$this->setPluginsOverwriteMode($plugins, false);
367
		}
368
369 3
		if ( isset($progress_bar) ) {
370 2
			$progress_bar->finish();
371 2
			$this->_io->writeln('');
372
		}
373
	}
374
375
	/**
376
	 * Returns arguments for "log" command.
377
	 *
378
	 * @param IRepositoryCollectorPlugin[] $plugins Plugins.
379
	 *
380
	 * @return array
381
	 */
382 3
	private function _getLogCommandArguments(array $plugins)
383
	{
384 3
		$query_flags = $this->_getRevisionQueryFlags($plugins);
385
386 3
		$ret = array('-r', '{revision_range}', '--xml');
387
388 3
		if ( in_array(self::FLAG_VERBOSE, $query_flags) ) {
389 3
			$ret[] = '--verbose';
390
		}
391
392 3
		if ( in_array(self::FLAG_MERGE_HISTORY, $query_flags) ) {
393 3
			$ret[] = '--use-merge-history';
394
		}
395
396 3
		$ret[] = '{repository_url}';
397
398 3
		return $ret;
399
	}
400
401
	/**
402
	 * Returns revision query flags.
403
	 *
404
	 * @param IRepositoryCollectorPlugin[] $plugins Plugins.
405
	 *
406
	 * @return array
407
	 */
408 3
	private function _getRevisionQueryFlags(array $plugins)
409
	{
410 3
		$ret = array();
411
412 3
		foreach ( $plugins as $plugin ) {
413 3
			$ret = array_merge($ret, $plugin->getRevisionQueryFlags());
414
		}
415
416 3
		return array_unique($ret);
417
	}
418
419
	/**
420
	 * Parses output of "svn log" command.
421
	 *
422
	 * @param \SimpleXMLElement            $log     Log.
423
	 * @param IRepositoryCollectorPlugin[] $plugins Plugins.
424
	 *
425
	 * @return void
426
	 */
427 3
	private function _parseLog(\SimpleXMLElement $log, array $plugins)
428
	{
429 3
		foreach ( $plugins as $plugin ) {
430 3
			$plugin->parse($log);
431
		}
432
	}
433
434
	/**
435
	 * Displays plugin activity statistics.
436
	 *
437
	 * @return void
438
	 */
439 1
	private function _displayPluginActivityStatistics()
440
	{
441 1
		$statistics = array();
442
443
		// Combine statistics from all plugins.
444 1
		foreach ( $this->_plugins as $plugin ) {
445 1
			$statistics = array_merge($statistics, array_filter($plugin->getStatistics()));
446
		}
447
448
		// Show statistics.
449 1
		$this->_io->writeln('<debug>Combined Plugin Statistics:</debug>');
450
451 1
		foreach ( $statistics as $statistic_type => $occurrences ) {
452 1
			$this->_io->writeln('<debug> * ' . $statistic_type . ': ' . $occurrences . '</debug>');
453
		}
454
	}
455
456
	/**
457
	 * Registers a plugin.
458
	 *
459
	 * @param IPlugin $plugin Plugin.
460
	 *
461
	 * @return void
462
	 * @throws \LogicException When plugin is registered several times.
463
	 */
464 12
	public function registerPlugin(IPlugin $plugin)
465
	{
466 12
		$plugin_name = $plugin->getName();
467
468 12
		if ( $this->pluginRegistered($plugin_name) ) {
469 1
			throw new \LogicException('The "' . $plugin_name . '" revision log plugin is already registered.');
470
		}
471
472 12
		$plugin->setRevisionLog($this);
473 12
		$this->_plugins[$plugin_name] = $plugin;
474
	}
475
476
	/**
477
	 * Finds information using plugin.
478
	 *
479
	 * @param string       $plugin_name Plugin name.
480
	 * @param array|string $criteria    Search criteria.
481
	 *
482
	 * @return array
483
	 */
484 3
	public function find($plugin_name, $criteria)
485
	{
486 3
		return $this->getPlugin($plugin_name)->find((array)$criteria, $this->_projectPath);
487
	}
488
489
	/**
490
	 * Returns information about revisions.
491
	 *
492
	 * @param string $plugin_name Plugin name.
493
	 * @param array  $revisions   Revisions.
494
	 *
495
	 * @return array
496
	 */
497 3
	public function getRevisionsData($plugin_name, array $revisions)
498
	{
499 3
		return $this->getPlugin($plugin_name)->getRevisionsData($revisions);
500
	}
501
502
	/**
503
	 * Determines if plugin is registered.
504
	 *
505
	 * @param string $plugin_name Plugin name.
506
	 *
507
	 * @return boolean
508
	 */
509 15
	public function pluginRegistered($plugin_name)
510
	{
511 15
		return array_key_exists($plugin_name, $this->_plugins);
512
	}
513
514
	/**
515
	 * Returns plugin instance.
516
	 *
517
	 * @param string $plugin_name Plugin name.
518
	 *
519
	 * @return IPlugin
520
	 * @throws \InvalidArgumentException When unknown plugin is given.
521
	 */
522 8
	public function getPlugin($plugin_name)
523
	{
524 8
		if ( !$this->pluginRegistered($plugin_name) ) {
525 3
			throw new \InvalidArgumentException('The "' . $plugin_name . '" revision log plugin is unknown.');
526
		}
527
528 5
		return $this->_plugins[$plugin_name];
529
	}
530
531
	/**
532
	 * Returns bugs, from revisions.
533
	 *
534
	 * @param array $revisions Revisions.
535
	 *
536
	 * @return array
537
	 */
538 1
	public function getBugsFromRevisions(array $revisions)
539
	{
540 1
		$bugs = array();
541 1
		$revisions_bugs = $this->getRevisionsData('bugs', $revisions);
542
543 1
		foreach ( $revisions as $revision ) {
544 1
			$revision_bugs = $revisions_bugs[$revision];
545
546 1
			foreach ( $revision_bugs as $bug_id ) {
547 1
				$bugs[$bug_id] = true;
548
			}
549
		}
550
551 1
		return array_keys($bugs);
552
	}
553
554
	/**
555
	 * Returns repository collector plugins.
556
	 *
557
	 * @param boolean $overwrite_mode Overwrite mode.
558
	 *
559
	 * @return IRepositoryCollectorPlugin[]
560
	 */
561 3
	protected function getRepositoryCollectorPlugins($overwrite_mode)
562
	{
563 3
		$plugins = $this->getPluginsByInterface(IRepositoryCollectorPlugin::class);
564
565 3
		if ( !$overwrite_mode ) {
566 3
			return $plugins;
567
		}
568
569
		return $this->getPluginsByInterface(IOverwriteAwarePlugin::class, $plugins);
570
	}
571
572
	/**
573
	 * Returns database collector plugins.
574
	 *
575
	 * @param boolean $overwrite_mode Overwrite mode.
576
	 *
577
	 * @return IDatabaseCollectorPlugin[]
578
	 */
579 3
	protected function getDatabaseCollectorPlugins($overwrite_mode)
580
	{
581 3
		$plugins = $this->getPluginsByInterface(IDatabaseCollectorPlugin::class);
582
583 3
		if ( !$overwrite_mode ) {
584 3
			return $plugins;
585
		}
586
587
		return $this->getPluginsByInterface(IOverwriteAwarePlugin::class, $plugins);
588
	}
589
590
	/**
591
	 * Returns plugin list filtered by interface.
592
	 *
593
	 * @param string    $interface Interface name.
594
	 * @param IPlugin[] $plugins   Plugins.
595
	 *
596
	 * @return IPlugin[]
597
	 */
598 3
	protected function getPluginsByInterface($interface, array $plugins = array())
599
	{
600 3
		if ( !$plugins ) {
601 3
			$plugins = $this->_plugins;
602
		}
603
604 3
		$ret = array();
605
606 3
		foreach ( $plugins as $plugin ) {
607 3
			if ( $plugin instanceof $interface ) {
608 3
				$ret[] = $plugin;
609
			}
610
		}
611
612 3
		return $ret;
613
	}
614
615
	/**
616
	 * Sets overwrite mode.
617
	 *
618
	 * @param IOverwriteAwarePlugin[] $plugins        Plugins.
619
	 * @param boolean                 $overwrite_mode Overwrite mode.
620
	 *
621
	 * @return void
622
	 */
623
	protected function setPluginsOverwriteMode(array $plugins, $overwrite_mode)
624
	{
625
		foreach ( $plugins as $plugin ) {
626
			$plugin->setOverwriteMode($overwrite_mode);
627
		}
628
	}
629
630
	/**
631
	 * Returns project path.
632
	 *
633
	 * @return string
634
	 */
635 1
	public function getProjectPath()
636
	{
637 1
		return $this->_projectPath;
638
	}
639
640
	/**
641
	 * Returns ref name.
642
	 *
643
	 * @return string
644
	 */
645 1
	public function getRefName()
646
	{
647 1
		return $this->_refName;
648
	}
649
650
}
651