Skip to content

Commit c60a899

Browse files
committed
Reverted 'new' DialogHelper thing with stupid helper dependency
1 parent d0e8e6e commit c60a899

File tree

1 file changed

+11
-18
lines changed

1 file changed

+11
-18
lines changed

src/PHPCR/Shell/Subscriber/ProfileLoaderSubscriber.php

+11-18
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,19 @@
11
<?php
22

3-
/*
4-
* This file is part of the PHPCR Shell package
5-
*
6-
* (c) Daniel Leech <[email protected]>
7-
*
8-
* For the full copyright and license information, please view the LICENSE
9-
* file that was distributed with this source code.
10-
*/
11-
123
namespace PHPCR\Shell\Subscriber;
134

145
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
156
use PHPCR\Shell\Event\PhpcrShellEvents;
167
use PHPCR\Shell\Event\ProfileInitEvent;
17-
use Symfony\Component\Console\Helper\QuestionHelper;
8+
use Symfony\Component\Console\Helper\DialogHelper;
189
use PHPCR\Shell\Config\ProfileLoader;
1910
use Symfony\Component\Console\Output\OutputInterface;
2011
use PHPCR\Shell\Config\Profile;
2112

2213
class ProfileLoaderSubscriber implements EventSubscriberInterface
2314
{
2415
protected $profileLoader;
25-
protected $questionHelper;
16+
protected $dialogHelper;
2617

2718
public static function getSubscribedEvents()
2819
{
@@ -31,10 +22,10 @@ public static function getSubscribedEvents()
3122
);
3223
}
3324

34-
public function __construct(ProfileLoader $profileLoader, $questionHelper)
25+
public function __construct(ProfileLoader $profileLoader, $dialogHelper)
3526
{
3627
$this->profileLoader = $profileLoader;
37-
$this->questionHelper = $questionHelper;
28+
$this->dialogHelper = $dialogHelper;
3829
}
3930

4031
public function handleProfileInit(ProfileInitEvent $e)
@@ -82,13 +73,15 @@ public function handleProfileInit(ProfileInitEvent $e)
8273
$output->writeln('<info>No connection parameters, given. Select an existing profile:</info>');
8374
$output->writeln('');
8475

76+
foreach ($profileNames as $i => $profileName) {
77+
$output->writeln(sprintf(' (%d) <comment>%s</comment>', $i, $profileName));
78+
}
79+
80+
$output->writeln('');
81+
8582
$selectedName = null;
8683
while (null === $selectedName) {
87-
$number = $this->questionHelper->select(
88-
$output,
89-
'<info>Choose a profile</info>: ',
90-
$profileNames
91-
);
84+
$number = $this->dialogHelper->ask($output, '<info>Enter profile number</info>: ');
9285

9386
if (!isset($profileNames[$number])) {
9487
$output->writeln('<error>Invalid selection!</error>');

0 commit comments

Comments
 (0)