diff --git a/README.md b/README.md
index b2306c20..5ce615b1 100644
--- a/README.md
+++ b/README.md
@@ -5,16 +5,10 @@ Shell for PHPCR
Shell for PHPCR
-## Warning
-
-This shell is currently under heavy development
-
## Building
The recommended way to use the PHPCR shell is as a phar archive.
-Currently there is no stable release and so it is necessary to build it manually.
-
Install box: http://box-project.org
Build the PHAR:
@@ -29,7 +23,7 @@ This will produce the file `phpcr.phar`.
Copy this file to your bin directory:
````bash
-$ sudo cp phpcr.sh /usr/bin
+$ sudo cp phpcrsh.phar /usr/bin/local/phpcrsh
````
## Connecting
@@ -41,9 +35,8 @@ To connect to a doctrine-dbal PHPCR repository:
Full definition:
````bash
-./bin/phpcr --help
Usage:
- phpcr_shell [-h|--help] [-v|--verbose] [-V|--version] [--ansi] [--no-ansi] [-t|--transport="..."] [-pu|--phpcr-username="..."] [-pp|--phpcr-password[="..."]] [-pw|--phpcr-workspace[="..."]] [-du|--db-username="..."] [-dn|--db-name="..."] [-dp|--db-password[="..."]] [-dh|--db-host="..."] [-dd|--db-driver="..."] [-dP|--db-path="..."] [-url|--repo-url="..."]
+ phpcr_shell [-h|--help] [-v|--verbose] [-V|--version] [--ansi] [--no-ansi] [-t|--transport="..."] [-pu|--phpcr-username="..."] [-pp|--phpcr-password[="..."]] [-pw|--phpcr-workspace[="..."]] [-du|--db-username="..."] [-dn|--db-name="..."] [-dp|--db-password[="..."]] [-dh|--db-host="..."] [-dd|--db-driver="..."] [-dP|--db-path="..."] [--no-interaction] [--unsupported] [-url|--repo-url="..."] [--command="..."]
Options:
--help (-h) Display this help message.
@@ -61,12 +54,14 @@ Options:
--db-host (-dh) Database Host. (default: "localhost")
--db-driver (-dd) Database Transport. (default: "pdo_mysql")
--db-path (-dP) Database Path.
+ --no-interaction Turn off interaction (for testing purposes)
+ --unsupported Show all commands, including commands not supported by the repository
--repo-url (-url) URL of repository (e.g. for jackrabbit). (default: "http://localhost:8080/server/")
+ --command Run the given command
````
-## TODO
-
-- Versioning:
- - Activity
- - Configuration
+Todo:
+- Better querying support
+- Better autocompletion
+- Directory aware configuration / configuration auto-detection
diff --git a/bin/phpcr b/bin/phpcrsh
similarity index 100%
rename from bin/phpcr
rename to bin/phpcrsh
diff --git a/spec/PHPCR/Shell/Console/Helper/EditorHelperSpec.php b/spec/PHPCR/Shell/Console/Helper/EditorHelperSpec.php
new file mode 100644
index 00000000..f2b1f65a
--- /dev/null
+++ b/spec/PHPCR/Shell/Console/Helper/EditorHelperSpec.php
@@ -0,0 +1,14 @@
+shouldHaveType('PHPCR\Shell\Console\Helper\EditorHelper');
+ }
+}
diff --git a/spec/PHPCR/Shell/Console/Helper/NodeHelperSpec.php b/spec/PHPCR/Shell/Console/Helper/NodeHelperSpec.php
new file mode 100644
index 00000000..2fb91425
--- /dev/null
+++ b/spec/PHPCR/Shell/Console/Helper/NodeHelperSpec.php
@@ -0,0 +1,58 @@
+shouldHaveType('PHPCR\Shell\Console\Helper\NodeHelper');
+ }
+
+ function it_should_provide_a_method_to_determine_if_a_node_has_a_given_mixin(
+ NodeInterface $node,
+ NodeTypeInterface $mixin1,
+ NodeTypeInterface $mixin2,
+ NodeTypeInterface $mixin3
+ )
+ {
+ $node->getMixinNodeTypes()->willReturn(array(
+ $mixin1, $mixin2, $mixin3
+ ));
+
+ $mixin1->getName()->willReturn('mixin1');
+ $mixin2->getName()->willReturn('mixin1');
+ $mixin3->getName()->willReturn('mixin3');
+
+ $this->nodeHasMixinType($node, 'mixin1')->shouldReturn(true);
+ $this->nodeHasMixinType($node, 'mixin5')->shouldReturn(false);
+ }
+
+ function it_should_provide_a_method_to_determine_if_a_node_is_versionable(
+ NodeInterface $nodeVersionable,
+ NodeInterface $nodeNotVersionable,
+ NodeTypeInterface $mixin1,
+ NodeTypeInterface $mixin2
+ )
+ {
+ $nodeVersionable->getMixinNodeTypes()->willReturn(array(
+ $mixin1, $mixin2
+ ));
+ $nodeNotVersionable->getMixinNodeTypes()->willReturn(array(
+ $mixin2
+ ));
+ $nodeNotVersionable->getPath()->willReturn('foobar');
+ $mixin1->getName()->willReturn('mix:versionable');
+ $this->assertNodeIsVersionable($nodeVersionable)->shouldReturn(null);;
+
+ try {
+ $this->assertNodeIsVersionable($nodeNotVersionable);
+ } catch (\OutOfBoundsException $e) {
+ }
+ }
+}
diff --git a/spec/PHPCR/Shell/Console/Helper/PhpcrHelperSpec.php b/spec/PHPCR/Shell/Console/Helper/PhpcrHelperSpec.php
new file mode 100644
index 00000000..af846754
--- /dev/null
+++ b/spec/PHPCR/Shell/Console/Helper/PhpcrHelperSpec.php
@@ -0,0 +1,21 @@
+beConstructedWith($input);
+ }
+
+ function it_is_initializable()
+ {
+ $this->shouldHaveType('PHPCR\Shell\Console\Helper\PhpcrHelper');
+ }
+}
diff --git a/spec/PHPCR/Shell/Console/Helper/RepositoryHelperSpec.php b/spec/PHPCR/Shell/Console/Helper/RepositoryHelperSpec.php
new file mode 100644
index 00000000..7ebe692f
--- /dev/null
+++ b/spec/PHPCR/Shell/Console/Helper/RepositoryHelperSpec.php
@@ -0,0 +1,36 @@
+beConstructedWith($phpcrHelper);
+ }
+
+ function it_is_initializable()
+ {
+ $this->shouldHaveType('PHPCR\Shell\Console\Helper\RepositoryHelper');
+ }
+
+ function it_provides_a_method_to_say_if_a_descriptor_exists_or_not(
+ PhpcrHelper $phpcrHelper,
+ RepositoryInterface $repository
+ ) {
+ $phpcrHelper->getRepository()->willReturn($repository);
+ $repository->getDescriptorKeys()->willReturn(array(
+ 'foo', 'bar'
+ ));
+ $repository->getDescriptor('foo')->willReturn('foo');
+ $repository->getDescriptor('bar')->willReturn('foo');
+
+ $this->hasDescriptor('foo')->shouldReturn(true);
+ }
+}
diff --git a/spec/PHPCR/Shell/Console/Helper/ResultFormatterHelperSpec.php b/spec/PHPCR/Shell/Console/Helper/ResultFormatterHelperSpec.php
new file mode 100644
index 00000000..30619d47
--- /dev/null
+++ b/spec/PHPCR/Shell/Console/Helper/ResultFormatterHelperSpec.php
@@ -0,0 +1,14 @@
+shouldHaveType('PHPCR\Shell\Console\Helper\ResultFormatterHelper');
+ }
+}
diff --git a/spec/PHPCR/Shell/Console/Helper/TextHelperSpec.php b/spec/PHPCR/Shell/Console/Helper/TextHelperSpec.php
new file mode 100644
index 00000000..85dd1921
--- /dev/null
+++ b/spec/PHPCR/Shell/Console/Helper/TextHelperSpec.php
@@ -0,0 +1,19 @@
+shouldHaveType('PHPCR\Shell\Console\Helper\TextHelper');
+ }
+
+ function it_should_truncate_text()
+ {
+ $this->truncate('hello this is some text', 5)->shouldReturn('he...');
+ }
+}
diff --git a/spec/PHPCR/Shell/Console/Input/StringInputSpec.php b/spec/PHPCR/Shell/Console/Input/StringInputSpec.php
new file mode 100644
index 00000000..9cf31c0c
--- /dev/null
+++ b/spec/PHPCR/Shell/Console/Input/StringInputSpec.php
@@ -0,0 +1,19 @@
+beConstructedWith('foobar');
+ }
+
+ function it_is_initializable()
+ {
+ $this->shouldHaveType('PHPCR\Shell\Console\Input\StringInput');
+ }
+}
diff --git a/src/PHPCR/Shell/Console/Application/SessionApplication.php b/src/PHPCR/Shell/Console/Application/SessionApplication.php
index a531297a..a0aa8ea6 100644
--- a/src/PHPCR/Shell/Console/Application/SessionApplication.php
+++ b/src/PHPCR/Shell/Console/Application/SessionApplication.php
@@ -15,11 +15,15 @@
*/
class SessionApplication extends BaseApplication
{
- const APP_NAME = 'PHPCR';
- const APP_VERSION = '0.1';
+ const APP_NAME = 'PHPCRSH';
+ const APP_VERSION = '1.0.0-alpha1';
protected $shellApplication;
+ /**
+ * Constructor - add the single command ShellCommand which
+ * accepts the connection parameters for the shell.
+ */
public function __construct()
{
parent::__construct(self::APP_NAME, self::APP_VERSION);
@@ -39,11 +43,22 @@ public function getDefaultInputDefinition()
return new InputDefinition(array());
}
+ /**
+ * This application always runs the phpcr_shell command to connect
+ * to the shell.
+ *
+ * {@inheritDoc}
+ */
protected function getCommandName(InputInterface $input)
{
return 'phpcr_shell';
}
+ /**
+ * Return the shell application
+ *
+ * @return ShellApplication
+ */
public function getShellApplication()
{
return $this->shellApplication;
diff --git a/src/PHPCR/Shell/Console/Application/Shell.php b/src/PHPCR/Shell/Console/Application/Shell.php
index 45ca9e3b..29d52d18 100644
--- a/src/PHPCR/Shell/Console/Application/Shell.php
+++ b/src/PHPCR/Shell/Console/Application/Shell.php
@@ -82,8 +82,10 @@ protected function getHeader()
Welcome to the {$this->application->getName()} shell ({$this->application->getVersion()}).
-At the prompt, type help for some help,
-or list to get a list of available commands.
+At the prompt, type help for some help.
+
+- To list all of the commands type list.
+- To list all of the registered command aliases, type aliases.
To exit the shell, type exit.
diff --git a/src/PHPCR/Shell/Console/Application/ShellApplication.php b/src/PHPCR/Shell/Console/Application/ShellApplication.php
index 1bab6dc8..2831d33f 100644
--- a/src/PHPCR/Shell/Console/Application/ShellApplication.php
+++ b/src/PHPCR/Shell/Console/Application/ShellApplication.php
@@ -8,13 +8,8 @@
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\InputInterface;
-use Symfony\Component\Console\Input\StringInput;
use Symfony\Component\Console\Output\OutputInterface;
-
-use PHPCR\SimpleCredentials;
-
-use PHPCR\Util\Console\Helper\PhpcrConsoleDumperHelper;
-use PHPCR\Util\Console\Helper\PhpcrHelper;
+use Symfony\Component\EventDispatcher\EventDispatcher;
use PHPCR\Shell\Console\Command\Phpcr as CommandPhpcr;
use PHPCR\Shell\Console\Command\Shell as CommandShell;
@@ -25,13 +20,13 @@
use PHPCR\Shell\Console\Helper\RepositoryHelper;
use PHPCR\Shell\Console\Helper\ResultFormatterHelper;
use PHPCR\Shell\Console\Helper\TextHelper;
+use PHPCR\Shell\Console\Helper\PhpcrHelper;
-use PHPCR\Shell\Subscriber;
use PHPCR\Shell\Event;
-use PHPCR\Shell\PhpcrSession;
-use Symfony\Component\EventDispatcher\EventDispatcher;
-use PHPCR\Shell\Event\PhpcrShellEvents;
use PHPCR\Shell\Event\ApplicationInitEvent;
+use PHPCR\Shell\Event\PhpcrShellEvents;
+use PHPCR\Shell\Subscriber;
+use PHPCR\Shell\Console\Command\Phpcr\PhpcrShellCommand;
/**
* Main application for PHPCRSH
@@ -41,11 +36,8 @@
class ShellApplication extends Application
{
/**
- * @var \PHPCR\TransportInterface[]
- */
- protected $transports;
-
- /**
+ * True when application has been initialized once
+ *
* @var boolean
*/
protected $initialized;
@@ -56,18 +48,16 @@ class ShellApplication extends Application
protected $sessionInput;
/**
- * @var SessionInterface
+ * Constructor - name and version inherited from SessionApplication
+ *
+ * {@inheritDoc}
*/
- private $session;
-
public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN')
{
parent::__construct($name, $version);
-
$this->dispatcher = new EventDispatcher();
}
-
/**
* The SessionInput is the input used to intialize the shell.
* It contains the connection parameters.
@@ -80,7 +70,11 @@ public function setSessionInput(InputInterface $input)
}
/**
- * Initialize the application
+ * Initialize the application.
+ *
+ * Note that we do this "lazily" because we instantiate the ShellApplication early,
+ * before the SessionInput has been set. The SessionInput must be set before we
+ * can initialize the application.
*/
public function init()
{
@@ -94,9 +88,6 @@ public function init()
);
}
-
- $this->initializeTransports();
- $this->initSession();
$this->registerHelpers();
$this->registerCommands();
$this->registerEventListeners();
@@ -107,36 +98,22 @@ public function init()
$this->initialized = true;
}
- /**
- * Initialize the supported transports.
- */
- private function initializeTransports()
- {
- $transports = array(
- new \PHPCR\Shell\Transport\DoctrineDbal($this->sessionInput),
- new \PHPCR\Shell\Transport\Jackrabbit($this->sessionInput),
- );
-
- foreach ($transports as $transport) {
- $this->transports[$transport->getName()] = $transport;;
- }
- }
-
/**
* Register the helpers required by the application
*/
private function registerHelpers()
{
+ $phpcrHelper = new PhpcrHelper($this->sessionInput);
+
$helpers = array(
new ConfigHelper(),
- new EditorHelper($this->session),
- new NodeHelper($this->session),
- new PathHelper($this->session),
- new PhpcrConsoleDumperHelper(),
- new PhpcrHelper($this->session),
- new RepositoryHelper($this->session->getRepository()),
+ new EditorHelper(),
+ new NodeHelper(),
+ new PathHelper(),
+ new RepositoryHelper($phpcrHelper),
new ResultFormatterHelper(),
new TextHelper(),
+ $phpcrHelper,
);
foreach ($helpers as $helper) {
@@ -165,8 +142,8 @@ private function registerCommands()
$this->add(new CommandPhpcr\NodePropertyShowCommand());
$this->add(new CommandPhpcr\SessionRefreshCommand());
$this->add(new CommandPhpcr\SessionSaveCommand());
- $this->add(new CommandPhpcr\QuerySelectCommand());
$this->add(new CommandPhpcr\QueryCommand());
+ $this->add(new CommandPhpcr\QuerySelectCommand());
$this->add(new CommandPhpcr\RetentionHoldAddCommand());
$this->add(new CommandPhpcr\RetentionHoldListCommand());
$this->add(new CommandPhpcr\RetentionHoldRemoveCommand());
@@ -235,81 +212,6 @@ private function registerEventListeners()
$this->dispatcher->addSubscriber(new Subscriber\AliasSubscriber($this->getHelperSet()->get('config')));
}
- /**
- * Initialize the PHPCR session
- */
- private function initSession()
- {
- $transport = $this->getTransport();
- $repository = $transport->getRepository();
- $credentials = new SimpleCredentials(
- $this->sessionInput->getOption('phpcr-username'),
- $this->sessionInput->getOption('phpcr-password')
- );
-
- $session = $repository->login($credentials, $this->sessionInput->getOption('phpcr-workspace'));
-
- if (!$this->session) {
- $this->session = new PhpcrSession($session);
- } else {
- $this->session->setPhpcrSession($session);
- }
- }
-
- /**
- * Change the current workspace
- *
- * @todo: Move to session helper?
- *
- * @param string $workspaceName
- */
- public function changeWorkspace($workspaceName)
- {
- $this->session->logout();
- $this->sessionInput->setOption('phpcr-workspace', $workspaceName);
- $this->initSession($this->sessionInput);
- }
-
- /**
- * Login (again)
- *
- * @todo: Move to session helper
- *
- * @param string $username
- * @param string $password
- * @param string $workspaceName
- */
- public function relogin($username, $password, $workspaceName = null)
- {
- $this->session->logout();
- $this->sessionInput->setOption('phpcr-username', $username);
- $this->sessionInput->setOption('phpcr-password', $password);
-
- if ($workspaceName) {
- $this->sessionInput->setOption('phpcr-workspace', $workspaceName);
- }
- $this->initSession($this->sessionInput);
- }
-
- /**
- * Return the transport as defined in the sessionInput
- */
- private function getTransport()
- {
- $transportName = $this->sessionInput->getOption('transport');
-
- if (!isset($this->transports[$transportName])) {
- throw new \InvalidArgumentException(sprintf(
- 'Unknown transport "%s", I have "%s"',
- $transportName, implode(', ', array_keys($this->transports))
- ));
- }
-
- $transport = $this->transports[$transportName];
-
- return $transport;
- }
-
/**
* Configure the output formatter
*/
@@ -358,6 +260,7 @@ public function doRun(InputInterface $input, OutputInterface $output)
$exitCode = parent::doRun($input, $output);
} catch (\Exception $e) {
$this->dispatcher->dispatch(PhpcrShellEvents::COMMAND_EXCEPTION, new Event\CommandExceptionEvent($e, $output));
+
return 1;
}
@@ -365,14 +268,9 @@ public function doRun(InputInterface $input, OutputInterface $output)
}
/**
- * {@inheritDoc}
- *
* Render an exception to the console
*
- * @access public
- *
- * @param \Exception $e $exception
- * @param OutputInterface $output
+ * {@inheritDoc}
*/
public function renderException($exception, $output)
{
@@ -380,12 +278,10 @@ public function renderException($exception, $output)
}
/**
- * {@inheritDoc}
- *
* Wrap the add method and do not register commands which are unsupported by
* the current transport.
*
- * @param Command $command
+ * {@inheritDoc}
*/
public function add(Command $command)
{
diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/AccessControlPrivilegeListCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/AccessControlPrivilegeListCommand.php
index 64b02a37..ddc9ab75 100644
--- a/src/PHPCR/Shell/Console/Command/Phpcr/AccessControlPrivilegeListCommand.php
+++ b/src/PHPCR/Shell/Console/Command/Phpcr/AccessControlPrivilegeListCommand.php
@@ -2,18 +2,19 @@
namespace PHPCR\Shell\Console\Command\Phpcr;
-use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
+
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
+use PHPCR\RepositoryInterface;
-class AccessControlPrivilegeListCommand extends Command
+class AccessControlPrivilegeListCommand extends PhpcrShellCommand
{
protected function configure()
{
$this->setName('access-control:privilege:list');
- $this->setDescription('List the privileges of the repository or a specific node NOT IMPLEMENTED');
+ $this->setDescription('List the privileges of the repository or a specific node');
$this->addArgument('absPath', InputArgument::OPTIONAL, 'Absolute path for node, optional.');
$this->addOption('supported', null, InputOption::VALUE_NONE, 'List privileges supported by repository rather than current session.');
$this->setHelp(<<requiresDescriptor(RepositoryInterface::OPTION_ACCESS_CONTROL_SUPPORTED, true);
}
public function execute(InputInterface $input, OutputInterface $output)
@@ -59,7 +62,6 @@ public function execute(InputInterface $input, OutputInterface $output)
$privileges = $acm->getPrivileges($absPath);
}
-
$table = clone $this->getHelper('table');
$table->setHeaders(array('Name'));
@@ -68,4 +70,3 @@ public function execute(InputInterface $input, OutputInterface $output)
}
}
}
-
diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/LockInfoCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/LockInfoCommand.php
index 01ab4e42..4974ee58 100644
--- a/src/PHPCR/Shell/Console/Command/Phpcr/LockInfoCommand.php
+++ b/src/PHPCR/Shell/Console/Command/Phpcr/LockInfoCommand.php
@@ -6,7 +6,6 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputArgument;
-use Symfony\Component\Console\Input\InputOption;
use PHPCR\RepositoryInterface;
class LockInfoCommand extends PhpcrShellCommand
@@ -14,7 +13,7 @@ class LockInfoCommand extends PhpcrShellCommand
protected function configure()
{
$this->setName('lock:info');
- $this->setDescription('Create a node at the current path');
+ $this->setDescription('Show details of the lock that applies to the specified node path');
$this->addArgument('path', InputArgument::REQUIRED, 'Path of locked node');
$this->setHelp(<<render($output);
}
}
-
diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/LockRefreshCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/LockRefreshCommand.php
index 3e4384d3..7f262eb7 100644
--- a/src/PHPCR/Shell/Console/Command/Phpcr/LockRefreshCommand.php
+++ b/src/PHPCR/Shell/Console/Command/Phpcr/LockRefreshCommand.php
@@ -6,7 +6,6 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputArgument;
-use Symfony\Component\Console\Input\InputOption;
use PHPCR\RepositoryInterface;
class LockRefreshCommand extends PhpcrShellCommand
diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/LockTokenAddCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/LockTokenAddCommand.php
index d7421092..1b840ffe 100644
--- a/src/PHPCR/Shell/Console/Command/Phpcr/LockTokenAddCommand.php
+++ b/src/PHPCR/Shell/Console/Command/Phpcr/LockTokenAddCommand.php
@@ -6,7 +6,6 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputArgument;
-use Symfony\Component\Console\Input\InputOption;
use PHPCR\RepositoryInterface;
class LockTokenAddCommand extends PhpcrShellCommand
diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/LockTokenListCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/LockTokenListCommand.php
index dc7bcd37..c42d1383 100644
--- a/src/PHPCR/Shell/Console/Command/Phpcr/LockTokenListCommand.php
+++ b/src/PHPCR/Shell/Console/Command/Phpcr/LockTokenListCommand.php
@@ -5,8 +5,6 @@
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
-use Symfony\Component\Console\Input\InputArgument;
-use Symfony\Component\Console\Input\InputOption;
use PHPCR\RepositoryInterface;
class LockTokenListCommand extends PhpcrShellCommand
diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/LockTokenRemoveCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/LockTokenRemoveCommand.php
index 2e35344f..0971f75f 100644
--- a/src/PHPCR/Shell/Console/Command/Phpcr/LockTokenRemoveCommand.php
+++ b/src/PHPCR/Shell/Console/Command/Phpcr/LockTokenRemoveCommand.php
@@ -6,7 +6,6 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputArgument;
-use Symfony\Component\Console\Input\InputOption;
use PHPCR\RepositoryInterface;
class LockTokenRemoveCommand extends PhpcrShellCommand
diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/LockUnlockCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/LockUnlockCommand.php
index b97698c4..125f7751 100644
--- a/src/PHPCR/Shell/Console/Command/Phpcr/LockUnlockCommand.php
+++ b/src/PHPCR/Shell/Console/Command/Phpcr/LockUnlockCommand.php
@@ -6,7 +6,6 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputArgument;
-use Symfony\Component\Console\Input\InputOption;
use PHPCR\RepositoryInterface;
class LockUnlockCommand extends PhpcrShellCommand
diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/NodeCloneCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/NodeCloneCommand.php
index f67b7b09..88d864e4 100644
--- a/src/PHPCR/Shell/Console/Command/Phpcr/NodeCloneCommand.php
+++ b/src/PHPCR/Shell/Console/Command/Phpcr/NodeCloneCommand.php
@@ -13,7 +13,7 @@ class NodeCloneCommand extends Command
protected function configure()
{
$this->setName('node:clone');
- $this->setDescription('Copy a node from one workspace to another');
+ $this->setDescription('Clone a node');
$this->addArgument('srcPath', InputArgument::REQUIRED, 'Path to source node');
$this->addArgument('destPath', InputArgument::REQUIRED, 'Path to destination node');
$this->addArgument('srcWorkspace', InputArgument::OPTIONAL, 'If specified, copy from this workspace');
diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/NodeCorrespondingCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/NodeCorrespondingCommand.php
index 4f88313a..f92a4d01 100644
--- a/src/PHPCR/Shell/Console/Command/Phpcr/NodeCorrespondingCommand.php
+++ b/src/PHPCR/Shell/Console/Command/Phpcr/NodeCorrespondingCommand.php
@@ -6,11 +6,6 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputArgument;
-use PHPCR\Util\CND\Writer\CndWriter;
-use PHPCR\NodeType\NoSuchNodeTypeException;
-use PHPCR\Util\CND\Parser\CndParser;
-use PHPCR\NamespaceException;
-use Symfony\Component\Console\Input\InputOption;
class NodeCorrespondingCommand extends Command
{
diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/NodeCreateCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/NodeCreateCommand.php
index d21ed6bd..494c75ca 100644
--- a/src/PHPCR/Shell/Console/Command/Phpcr/NodeCreateCommand.php
+++ b/src/PHPCR/Shell/Console/Command/Phpcr/NodeCreateCommand.php
@@ -6,11 +6,6 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputArgument;
-use PHPCR\Util\CND\Writer\CndWriter;
-use PHPCR\NodeType\NoSuchNodeTypeException;
-use PHPCR\Util\CND\Parser\CndParser;
-use PHPCR\NamespaceException;
-use Symfony\Component\Console\Input\InputOption;
class NodeCreateCommand extends Command
{
diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/NodeDefinitionCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/NodeDefinitionCommand.php
index 132892fd..0ccc34c0 100644
--- a/src/PHPCR/Shell/Console/Command/Phpcr/NodeDefinitionCommand.php
+++ b/src/PHPCR/Shell/Console/Command/Phpcr/NodeDefinitionCommand.php
@@ -2,26 +2,24 @@
namespace PHPCR\Shell\Console\Command\Phpcr;
-use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputArgument;
use PHPCR\Util\CND\Writer\CndWriter;
-use PHPCR\NodeType\NoSuchNodeTypeException;
-use PHPCR\Util\CND\Parser\CndParser;
-use PHPCR\NamespaceException;
-class NodeDefinitionCommand extends Command
+class NodeDefinitionCommand extends PhpcrShellCommand
{
protected function configure()
{
$this->setName('node:definition');
- $this->setDescription('Show the CND Definition of current node NOT IMPLEMENTED');
+ $this->setDescription('Show the CND Definition of current node');
$this->addArgument('path', InputArgument::REQUIRED, 'Path of node');
$this->setHelp(<<dequiresDescriptor('jackalope.not_implemented.node.definition');
}
public function execute(InputInterface $input, OutputInterface $output)
diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/NodeInfoCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/NodeInfoCommand.php
index d818ed24..dba014e5 100644
--- a/src/PHPCR/Shell/Console/Command/Phpcr/NodeInfoCommand.php
+++ b/src/PHPCR/Shell/Console/Command/Phpcr/NodeInfoCommand.php
@@ -6,10 +6,6 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputArgument;
-use PHPCR\Util\CND\Writer\CndWriter;
-use PHPCR\NodeType\NoSuchNodeTypeException;
-use PHPCR\Util\CND\Parser\CndParser;
-use PHPCR\NamespaceException;
class NodeInfoCommand extends Command
{
diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/NodeLifecycleFollowCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/NodeLifecycleFollowCommand.php
index 66fcf52c..babad405 100644
--- a/src/PHPCR/Shell/Console/Command/Phpcr/NodeLifecycleFollowCommand.php
+++ b/src/PHPCR/Shell/Console/Command/Phpcr/NodeLifecycleFollowCommand.php
@@ -6,10 +6,6 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputArgument;
-use PHPCR\Util\CND\Writer\CndWriter;
-use PHPCR\NodeType\NoSuchNodeTypeException;
-use PHPCR\Util\CND\Parser\CndParser;
-use PHPCR\NamespaceException;
use PHPCR\RepositoryInterface;
class NodeLifecycleFollowCommand extends PhpcrShellCommand
@@ -17,7 +13,7 @@ class NodeLifecycleFollowCommand extends PhpcrShellCommand
protected function configure()
{
$this->setName('node:lifecycle:follow');
- $this->setDescription('Causes the lifecycle state of this node to undergo the specified transition. NOT IMPLEMENTED');
+ $this->setDescription('Causes the lifecycle state of this node to undergo the specified transition.');
$this->addArgument('path', InputArgument::REQUIRED, 'Path of node');
$this->addArgument('transition', InputArgument::REQUIRED, 'A state transition');
$this->setHelp(<<followLifecycleTransition($transition);
}
}
-
diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/NodeLifecycleListCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/NodeLifecycleListCommand.php
index 2c1b482b..e88f4390 100644
--- a/src/PHPCR/Shell/Console/Command/Phpcr/NodeLifecycleListCommand.php
+++ b/src/PHPCR/Shell/Console/Command/Phpcr/NodeLifecycleListCommand.php
@@ -6,10 +6,6 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputArgument;
-use PHPCR\Util\CND\Writer\CndWriter;
-use PHPCR\NodeType\NoSuchNodeTypeException;
-use PHPCR\Util\CND\Parser\CndParser;
-use PHPCR\NamespaceException;
use PHPCR\RepositoryInterface;
class NodeLifecycleListCommand extends PhpcrShellCommand
@@ -17,7 +13,7 @@ class NodeLifecycleListCommand extends PhpcrShellCommand
protected function configure()
{
$this->setName('node:lifecycle:list');
- $this->setDescription('Returns the list of valid state transitions for this node. NOT IMPLEMENTED');
+ $this->setDescription('Returns the list of valid state transitions for this node.');
$this->addArgument('path', InputArgument::REQUIRED, 'Path of node');
$this->setHelp(<<addMixin($mixinName);
}
}
-
diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/NodeMixinRemoveCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/NodeMixinRemoveCommand.php
index c312d111..5019fc02 100644
--- a/src/PHPCR/Shell/Console/Command/Phpcr/NodeMixinRemoveCommand.php
+++ b/src/PHPCR/Shell/Console/Command/Phpcr/NodeMixinRemoveCommand.php
@@ -6,11 +6,6 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputArgument;
-use PHPCR\Util\CND\Writer\CndWriter;
-use PHPCR\NodeType\NoSuchNodeTypeException;
-use PHPCR\Util\CND\Parser\CndParser;
-use PHPCR\NamespaceException;
-use Symfony\Component\Console\Input\InputOption;
class NodeMixinRemoveCommand extends Command
{
@@ -37,4 +32,3 @@ public function execute(InputInterface $input, OutputInterface $output)
$currentNode->removeMixin($mixinName);
}
}
-
diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/NodeOrderBeforeCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/NodeOrderBeforeCommand.php
index 04f6b13f..3d5f43af 100644
--- a/src/PHPCR/Shell/Console/Command/Phpcr/NodeOrderBeforeCommand.php
+++ b/src/PHPCR/Shell/Console/Command/Phpcr/NodeOrderBeforeCommand.php
@@ -6,10 +6,6 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputArgument;
-use PHPCR\Util\CND\Writer\CndWriter;
-use PHPCR\NodeType\NoSuchNodeTypeException;
-use PHPCR\Util\CND\Parser\CndParser;
-use PHPCR\NamespaceException;
class NodeOrderBeforeCommand extends Command
{
diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/NodePropertyEditCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/NodePropertyEditCommand.php
index 0832a68a..6bc50619 100644
--- a/src/PHPCR/Shell/Console/Command/Phpcr/NodePropertyEditCommand.php
+++ b/src/PHPCR/Shell/Console/Command/Phpcr/NodePropertyEditCommand.php
@@ -6,7 +6,6 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputArgument;
-use Symfony\Component\Filesystem\Filesystem;
use PHPCR\Util\ValueConverter;
class NodePropertyEditCommand extends Command
diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/NodePropertySetCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/NodePropertySetCommand.php
index c48acf29..d7e3619b 100644
--- a/src/PHPCR/Shell/Console/Command/Phpcr/NodePropertySetCommand.php
+++ b/src/PHPCR/Shell/Console/Command/Phpcr/NodePropertySetCommand.php
@@ -6,10 +6,6 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputArgument;
-use PHPCR\Util\CND\Writer\CndWriter;
-use PHPCR\NodeType\NoSuchNodeTypeException;
-use PHPCR\Util\CND\Parser\CndParser;
-use PHPCR\NamespaceException;
use Symfony\Component\Console\Input\InputOption;
use PHPCR\PropertyType;
use PHPCR\PathNotFoundException;
diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/NodeReferencesCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/NodeReferencesCommand.php
index c0ed9a6e..b105272e 100644
--- a/src/PHPCR/Shell/Console/Command/Phpcr/NodeReferencesCommand.php
+++ b/src/PHPCR/Shell/Console/Command/Phpcr/NodeReferencesCommand.php
@@ -6,10 +6,6 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputArgument;
-use PHPCR\Util\CND\Writer\CndWriter;
-use PHPCR\NodeType\NoSuchNodeTypeException;
-use PHPCR\Util\CND\Parser\CndParser;
-use PHPCR\NamespaceException;
class NodeReferencesCommand extends Command
{
@@ -68,7 +64,7 @@ public function execute(InputInterface $input, OutputInterface $output)
} else {
$nodes = array($property->getNode());
}
-
+
$nodePaths = array();
foreach ($nodes as $node) {
@@ -86,4 +82,3 @@ public function execute(InputInterface $input, OutputInterface $output)
$table->render($output);
}
}
-
diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/NodeRemoveCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/NodeRemoveCommand.php
index 638c2724..a80f0787 100644
--- a/src/PHPCR/Shell/Console/Command/Phpcr/NodeRemoveCommand.php
+++ b/src/PHPCR/Shell/Console/Command/Phpcr/NodeRemoveCommand.php
@@ -6,10 +6,6 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputArgument;
-use PHPCR\Util\CND\Writer\CndWriter;
-use PHPCR\NodeType\NoSuchNodeTypeException;
-use PHPCR\Util\CND\Parser\CndParser;
-use PHPCR\NamespaceException;
class NodeRemoveCommand extends Command
{
@@ -19,7 +15,7 @@ protected function configure()
$this->setDescription('Remove the node at path');
$this->addArgument('path', InputArgument::REQUIRED, 'Path of node');
$this->setHelp(<<writeln('Editor emptied the CND file, doing nothing. Use node-type:delete to remove node types.');
+
return 0;
}
diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/NodeTypeListCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/NodeTypeListCommand.php
index fdaf0a35..520db023 100644
--- a/src/PHPCR/Shell/Console/Command/Phpcr/NodeTypeListCommand.php
+++ b/src/PHPCR/Shell/Console/Command/Phpcr/NodeTypeListCommand.php
@@ -6,8 +6,6 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputArgument;
-use PHPCR\Util\CND\Writer\CndWriter;
-use PHPCR\NodeType\NoSuchNodeTypeException;
class NodeTypeListCommand extends Command
{
@@ -52,4 +50,3 @@ public function execute(InputInterface $input, OutputInterface $output)
$table->render($output);
}
}
-
diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/NodeTypeLoadCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/NodeTypeLoadCommand.php
index ed1cf91c..5ea3d711 100644
--- a/src/PHPCR/Shell/Console/Command/Phpcr/NodeTypeLoadCommand.php
+++ b/src/PHPCR/Shell/Console/Command/Phpcr/NodeTypeLoadCommand.php
@@ -6,10 +6,6 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputArgument;
-use PHPCR\Util\CND\Writer\CndWriter;
-use PHPCR\NodeType\NoSuchNodeTypeException;
-use PHPCR\Util\CND\Parser\CndParser;
-use PHPCR\NamespaceException;
use Symfony\Component\Console\Input\InputOption;
class NodeTypeLoadCommand extends Command
diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/NodeTypeShowCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/NodeTypeShowCommand.php
index 9ff46bff..9fe7141b 100644
--- a/src/PHPCR/Shell/Console/Command/Phpcr/NodeTypeShowCommand.php
+++ b/src/PHPCR/Shell/Console/Command/Phpcr/NodeTypeShowCommand.php
@@ -42,4 +42,3 @@ public function execute(InputInterface $input, OutputInterface $output)
$output->writeln(sprintf('%s', $out));
}
}
-
diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/NodeTypeUnregisterCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/NodeTypeUnregisterCommand.php
index e49ca6ed..cbe5f956 100644
--- a/src/PHPCR/Shell/Console/Command/Phpcr/NodeTypeUnregisterCommand.php
+++ b/src/PHPCR/Shell/Console/Command/Phpcr/NodeTypeUnregisterCommand.php
@@ -2,14 +2,11 @@
namespace PHPCR\Shell\Console\Command\Phpcr;
-use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputArgument;
-use PHPCR\Util\CND\Writer\CndWriter;
-use PHPCR\NodeType\NoSuchNodeTypeException;
-class NodeTypeUnregisterCommand extends Command
+class NodeTypeUnregisterCommand extends PhpcrShellCommand
{
protected function configure()
{
@@ -20,6 +17,8 @@ protected function configure()
Unregisters the specified node type
HERE
);
+
+ $this->dequiresDescriptor('jackalope.not_implemented.node_type.unregister');
}
public function execute(InputInterface $input, OutputInterface $output)
@@ -33,4 +32,3 @@ public function execute(InputInterface $input, OutputInterface $output)
$nodeType = $nodeTypeManager->unregisterNodeTypes(array($nodeTypeName));
}
}
-
diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/NodeUpdateCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/NodeUpdateCommand.php
index 5cda89bc..de46530d 100644
--- a/src/PHPCR/Shell/Console/Command/Phpcr/NodeUpdateCommand.php
+++ b/src/PHPCR/Shell/Console/Command/Phpcr/NodeUpdateCommand.php
@@ -6,10 +6,6 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputArgument;
-use PHPCR\Util\CND\Writer\CndWriter;
-use PHPCR\NodeType\NoSuchNodeTypeException;
-use PHPCR\Util\CND\Parser\CndParser;
-use PHPCR\NamespaceException;
class NodeUpdateCommand extends Command
{
diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/PhpcrShellCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/PhpcrShellCommand.php
index 6c3fcd55..4c91d502 100644
--- a/src/PHPCR/Shell/Console/Command/Phpcr/PhpcrShellCommand.php
+++ b/src/PHPCR/Shell/Console/Command/Phpcr/PhpcrShellCommand.php
@@ -20,12 +20,12 @@ public function dequiresDescriptor($descriptorKey, $value = null)
$this->descriptorDequires[$descriptorKey] = $value;
}
- public function getDescriptorRequires()
+ public function getDescriptorRequires()
{
return $this->descriptorRequires;
}
-
- public function getDescriptorDequires()
+
+ public function getDescriptorDequires()
{
return $this->descriptorDequires;
}
@@ -49,10 +49,9 @@ public function isSupported(RepositoryHelper $repositoryHelper)
return true;
}
-
+
public function getDescriptor()
{
-
return true;
}
}
diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/QueryCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/QueryCommand.php
index ec501bf8..bedb576c 100644
--- a/src/PHPCR/Shell/Console/Command/Phpcr/QueryCommand.php
+++ b/src/PHPCR/Shell/Console/Command/Phpcr/QueryCommand.php
@@ -12,19 +12,17 @@ class QueryCommand extends Command
protected function configure()
{
$this->setName('query');
- $this->setDescription('Execute an SQL query UNSTABLE');
+ $this->setDescription('Execute a query ');
$this->addArgument('query');
$this->addOption('language', 'l', InputOption::VALUE_OPTIONAL, 'The query language (e.g. jcr-sql2', 'JCR-SQL2');
$this->addOption('limit', null, InputOption::VALUE_OPTIONAL, 'The query limit', 0);
$this->addOption('offset', null, InputOption::VALUE_OPTIONAL, 'The query offset', 0);
$this->setHelp(<<select in that it
+is executed conventionally and not literally. The advantage is that you can
+specify a specific query language and additional options:
-TODO:
-
-- Ensure values are properly handled
-- Allow table formatting options
-- Provide way to add path and/or UUID to results
+ query "SELECT * FROM [nt:unstructured]" --language=JCR_SQL2 --limit=5 --offset=4
EOT
);
}
@@ -63,6 +61,6 @@ public function execute(InputInterface $input, OutputInterface $output)
$result = $query->execute();
$elapsed = microtime(true) - $start;
- $this->getHelper('result_formatter')->format($result, $output, $elapsed);
+ $this->getHelper('result_formatter')->formatQueryResult($result, $output, $elapsed);
}
}
diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/QuerySelectCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/QuerySelectCommand.php
index 31284535..965bb4b6 100644
--- a/src/PHPCR/Shell/Console/Command/Phpcr/QuerySelectCommand.php
+++ b/src/PHPCR/Shell/Console/Command/Phpcr/QuerySelectCommand.php
@@ -4,7 +4,6 @@
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
-use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class QuerySelectCommand extends Command
@@ -12,10 +11,14 @@ class QuerySelectCommand extends Command
protected function configure()
{
$this->setName('select');
- $this->setDescription('Execute an SQL query UNSTABLE');
+ $this->setDescription('Execute a literal JCR-SQL2 query');
$this->addArgument('query');
$this->setHelp(<<query command.
+Execute a JCR-SQL2 query. Unlike other commands you can enter a query literally:
+
+ SELECT * FROM [nt:unstructured];
+
+This command only executes JCR-SQL2 queries at the moment.
EOT
);
}
@@ -38,6 +41,6 @@ public function execute(InputInterface $input, OutputInterface $output)
$result = $query->execute();
$elapsed = microtime(true) - $start;
- $this->getHelper('result_formatter')->format($result, $output, $elapsed);
+ $this->getHelper('result_formatter')->formatQueryResult($result, $output, $elapsed);
}
}
diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/RetentionHoldListCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/RetentionHoldListCommand.php
index 7436f85a..a92015c3 100644
--- a/src/PHPCR/Shell/Console/Command/Phpcr/RetentionHoldListCommand.php
+++ b/src/PHPCR/Shell/Console/Command/Phpcr/RetentionHoldListCommand.php
@@ -6,7 +6,6 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputArgument;
-use Symfony\Component\Console\Input\InputOption;
use PHPCR\RepositoryInterface;
class RetentionHoldListCommand extends PhpcrShellCommand
diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/RetentionHoldRemoveCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/RetentionHoldRemoveCommand.php
index 443e4639..3e8073e8 100644
--- a/src/PHPCR/Shell/Console/Command/Phpcr/RetentionHoldRemoveCommand.php
+++ b/src/PHPCR/Shell/Console/Command/Phpcr/RetentionHoldRemoveCommand.php
@@ -6,7 +6,6 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputArgument;
-use Symfony\Component\Console\Input\InputOption;
use PHPCR\RepositoryInterface;
class RetentionHoldRemoveCommand extends PhpcrShellCommand
diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/RetentionPolicyGetCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/RetentionPolicyGetCommand.php
index f983af31..aecef1b6 100644
--- a/src/PHPCR/Shell/Console/Command/Phpcr/RetentionPolicyGetCommand.php
+++ b/src/PHPCR/Shell/Console/Command/Phpcr/RetentionPolicyGetCommand.php
@@ -6,7 +6,6 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputArgument;
-use Symfony\Component\Console\Input\InputOption;
use PHPCR\RepositoryInterface;
class RetentionPolicyGetCommand extends PhpcrShellCommand
diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/RetentionPolicyRemoveCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/RetentionPolicyRemoveCommand.php
index f9ce25e7..e16c93cd 100644
--- a/src/PHPCR/Shell/Console/Command/Phpcr/RetentionPolicyRemoveCommand.php
+++ b/src/PHPCR/Shell/Console/Command/Phpcr/RetentionPolicyRemoveCommand.php
@@ -6,7 +6,6 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputArgument;
-use Symfony\Component\Console\Input\InputOption;
use PHPCR\RepositoryInterface;
class RetentionPolicyRemoveCommand extends PhpcrShellCommand
diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/SessionImpersonateCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/SessionImpersonateCommand.php
index 5db65cd6..cdfa01a9 100644
--- a/src/PHPCR/Shell/Console/Command/Phpcr/SessionImpersonateCommand.php
+++ b/src/PHPCR/Shell/Console/Command/Phpcr/SessionImpersonateCommand.php
@@ -8,12 +8,12 @@
use Symfony\Component\Console\Input\InputArgument;
use PHPCR\SimpleCredentials;
-class SessionImpersonateCommand extends Command
+class SessionImpersonateCommand extends PhpcrShellCommand
{
protected function configure()
{
$this->setName('session:impersonate');
- $this->setDescription('Impersonate the given user NOT SUPPORTED');
+ $this->setDescription('Impersonate the given user');
$this->addArgument('username', InputArgument::REQUIRED, 'Username of user to impersonate');
$this->setHelp(<<dequiresDescriptor('jackalope.not_implemented.session.impersonate');
}
public function execute(InputInterface $input, OutputInterface $output)
diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/SessionImportXMLCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/SessionImportXMLCommand.php
index 85bbb67a..78f95c3d 100644
--- a/src/PHPCR/Shell/Console/Command/Phpcr/SessionImportXMLCommand.php
+++ b/src/PHPCR/Shell/Console/Command/Phpcr/SessionImportXMLCommand.php
@@ -21,7 +21,7 @@ class SessionImportXMLCommand extends Command
protected function configure()
{
$this->setName('session:import-xml');
- $this->setDescription('Export the system view');
+ $this->setDescription('Import content from an XML file');
$this->addArgument('parentAbsPath', InputArgument::REQUIRED, 'Path of node to export');
$this->addArgument('file', InputArgument::REQUIRED, 'File to export to');
$this->addOption('uuid-behavior', null, InputOption::VALUE_REQUIRED, 'UUID behavior', 'create-new');
diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/SessionLoginCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/SessionLoginCommand.php
index 44e57cf8..0f06e501 100644
--- a/src/PHPCR/Shell/Console/Command/Phpcr/SessionLoginCommand.php
+++ b/src/PHPCR/Shell/Console/Command/Phpcr/SessionLoginCommand.php
@@ -26,6 +26,6 @@ public function execute(InputInterface $input, OutputInterface $output)
$username = $input->getArgument('userId');
$password = $input->getArgument('password');
$workspaceName = $input->getArgument('workspaceName');
- $this->getApplication()->relogin($username, $password, $workspaceName);
+ $this->getHelper('phpcr')->relogin($username, $password, $workspaceName);
}
}
diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/WorkspaceDeleteCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/WorkspaceDeleteCommand.php
index c12c79bf..bdf26353 100644
--- a/src/PHPCR/Shell/Console/Command/Phpcr/WorkspaceDeleteCommand.php
+++ b/src/PHPCR/Shell/Console/Command/Phpcr/WorkspaceDeleteCommand.php
@@ -12,7 +12,7 @@ class WorkspaceDeleteCommand extends Command
protected function configure()
{
$this->setName('workspace:delete');
- $this->setDescription('Delete a new workspace');
+ $this->setDescription('Delete a workspace');
$this->addArgument('name', InputArgument::REQUIRED, 'Name of new workspace');
$this->addArgument('srcWorkspace', InputArgument::OPTIONAL, 'If specified, clone from this workspace');
$this->setHelp(<<setName('workspace:namespace:unregister');
- $this->setDescription('Sets a one-to-one mapping between prefix and uri in the global namespace');
+ $this->setDescription('Unregister a namespace');
$this->addArgument('uri', null, InputArgument::REQUIRED, 'The URI to be removed');
$this->setHelp(<<getArgument('name');
- $this->getApplication()->changeWorkspace($workspaceName);
+ $this->getHelper('phpcr')->changeWorkspace($workspaceName);
}
}
diff --git a/src/PHPCR/Shell/Console/Command/Shell/ConfigInitCommand.php b/src/PHPCR/Shell/Console/Command/Shell/ConfigInitCommand.php
index 4e9a9ca8..821b79a4 100644
--- a/src/PHPCR/Shell/Console/Command/Shell/ConfigInitCommand.php
+++ b/src/PHPCR/Shell/Console/Command/Shell/ConfigInitCommand.php
@@ -2,7 +2,6 @@
namespace PHPCR\Shell\Console\Command\Shell;
-use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
diff --git a/src/PHPCR/Shell/Console/Command/Shell/ConfigReloadCommand.php b/src/PHPCR/Shell/Console/Command/Shell/ConfigReloadCommand.php
index 49d9bff5..3c4c2236 100644
--- a/src/PHPCR/Shell/Console/Command/Shell/ConfigReloadCommand.php
+++ b/src/PHPCR/Shell/Console/Command/Shell/ConfigReloadCommand.php
@@ -2,7 +2,6 @@
namespace PHPCR\Shell\Console\Command\Shell;
-use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
diff --git a/src/PHPCR/Shell/Console/Command/ShellCommand.php b/src/PHPCR/Shell/Console/Command/ShellCommand.php
index c93e4a97..02b33e4a 100644
--- a/src/PHPCR/Shell/Console/Command/ShellCommand.php
+++ b/src/PHPCR/Shell/Console/Command/ShellCommand.php
@@ -10,18 +10,34 @@
use PHPCR\Shell\Console\Application\Shell;
use Symfony\Component\Console\Input\StringInput;
+/**
+ * The shell command is the command used to configure the shell session
+ *
+ * @author Daniel Leech
+ */
class ShellCommand extends Command
{
- protected $output;
- protected $options;
+ /**
+ * @var ShellApplication
+ */
protected $application;
+ /**
+ * Constructor - construct with the shell application. This
+ * command provides the connection parameters (by simply passing
+ * the Input object).
+ *
+ * @param ShellApplication $application
+ */
public function __construct(ShellApplication $application)
{
$this->application = $application;
parent::__construct();
}
+ /**
+ * {@inheritDoc}
+ */
public function configure()
{
$this->setName('phpcr_shell');
@@ -50,6 +66,9 @@ public function configure()
));
}
+ /**
+ * {@inheritDoc}
+ */
public function execute(InputInterface $input, OutputInterface $output)
{
$application = $this->application;
@@ -60,6 +79,7 @@ public function execute(InputInterface $input, OutputInterface $output)
$application->setCatchExceptions(false);
$input = new StringInput($command);
$application->run($input, $output);
+
return;
} else {
$application = new Shell($this->application);
diff --git a/src/PHPCR/Shell/Console/Helper/ConfigHelper.php b/src/PHPCR/Shell/Console/Helper/ConfigHelper.php
index efee3a13..69e271a3 100644
--- a/src/PHPCR/Shell/Console/Helper/ConfigHelper.php
+++ b/src/PHPCR/Shell/Console/Helper/ConfigHelper.php
@@ -39,6 +39,12 @@ class ConfigHelper extends Helper
*/
protected $filesystem;
+ /**
+ * Constuctor - can optionally accept a Filesystem object
+ * for testing purposes, otherwise one is created.
+ *
+ * @param Filesystem $filesystem
+ */
public function __construct(Filesystem $filesystem = null)
{
if (null === $filesystem) {
@@ -170,11 +176,11 @@ public function initConfig(OutputInterface $output = null, DialogHelper $dialogH
if (null !== $dialogHelper) {
if (false === $noInteraction) {
$confirmed = $dialogHelper->askConfirmation(
- $output,
+ $output,
'"' . $configFilename . '" already exists, do you want to overwrite it?'
);
- if (!$confirmed) {
+ if (!$confirmed) {
return;
}
}
diff --git a/src/PHPCR/Shell/Console/Helper/NodeHelper.php b/src/PHPCR/Shell/Console/Helper/NodeHelper.php
index f3590ecc..53e5dc0f 100644
--- a/src/PHPCR/Shell/Console/Helper/NodeHelper.php
+++ b/src/PHPCR/Shell/Console/Helper/NodeHelper.php
@@ -2,10 +2,8 @@
namespace PHPCR\Shell\Console\Helper;
-use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Console\Helper\Helper;
use PHPCR\NodeInterface;
-use PHPCR\SessionInterface;
/**
* Helper for nodes
@@ -14,13 +12,11 @@
*/
class NodeHelper extends Helper
{
- protected $session;
-
- public function __construct(SessionInterface $session)
- {
- $this->session = $session;
- }
-
+ /**
+ * Return true if the given node has the given mixinType
+ *
+ * @return boolean
+ */
public function nodeHasMixinType($node, $mixinTypeName)
{
$mixinTypes = $node->getMixinNodeTypes();
@@ -34,6 +30,9 @@ public function nodeHasMixinType($node, $mixinTypeName)
return false;
}
+ /**
+ * Return true if the given node is versionable
+ */
public function assertNodeIsVersionable(NodeInterface $node)
{
if (!$this->nodeHasMixinType($node, 'mix:versionable')) {
diff --git a/src/PHPCR/Shell/Console/Helper/PhpcrHelper.php b/src/PHPCR/Shell/Console/Helper/PhpcrHelper.php
new file mode 100644
index 00000000..24137610
--- /dev/null
+++ b/src/PHPCR/Shell/Console/Helper/PhpcrHelper.php
@@ -0,0 +1,192 @@
+
+ */
+class PhpcrHelper extends Helper
+{
+ /**
+ * Initial input which was used to initialize the shell.
+ *
+ * @var \Symfony\Component\Console\Input\InputInterface
+ */
+ protected $sessionInput;
+
+ /**
+ * Active PHPCR session
+ *
+ * @var \PHPCR\SessionInterface
+ */
+ protected $session;
+
+ /**
+ * Available transports
+ *
+ * @var \Jackalope\Transport\TransportInterface[]
+ */
+ protected $transports = array();
+
+ /**
+ * Lazy initialize PHPCR session
+ *
+ * @var boolean
+ */
+ protected $initialized = false;
+
+ /**
+ * @param InputInterface $sessionInput
+ */
+ public function __construct(InputInterface $sessionInput)
+ {
+ $this->sessionInput = $sessionInput;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getName()
+ {
+ return 'phpcr';
+ }
+
+ private function init()
+ {
+ if (false === $this->initialized) {
+ $this->initializeTransports();
+ $this->initSession();
+ $this->initialized = true;
+ }
+ }
+
+ /**
+ * Initialize the PHPCR session
+ *
+ * @access private
+ */
+ private function initSession()
+ {
+ $transport = $this->getTransport();
+ $repository = $transport->getRepository();
+ $credentials = new SimpleCredentials(
+ $this->sessionInput->getOption('phpcr-username'),
+ $this->sessionInput->getOption('phpcr-password')
+ );
+
+ $session = $repository->login($credentials, $this->sessionInput->getOption('phpcr-workspace'));
+
+ // if you are wondering wtf here -- we wrap the PhpcrSession
+ if (!$this->session) {
+ $this->session = new PhpcrSession($session);
+ } else {
+ $this->session->setPhpcrSession($session);
+ }
+ }
+
+ /**
+ * Return the transport as defined in the sessionInput
+ *
+ * @access private
+ */
+ private function getTransport()
+ {
+ $transportName = $this->sessionInput->getOption('transport');
+
+ if (!isset($this->transports[$transportName])) {
+ throw new \InvalidArgumentException(sprintf(
+ 'Unknown transport "%s", I have "%s"',
+ $transportName, implode(', ', array_keys($this->transports))
+ ));
+ }
+
+ $transport = $this->transports[$transportName];
+
+ return $transport;
+ }
+
+ /**
+ * Initialize the supported transports.
+ *
+ * @access private
+ */
+ private function initializeTransports()
+ {
+ $transports = array(
+ new \PHPCR\Shell\Transport\DoctrineDbal($this->sessionInput),
+ new \PHPCR\Shell\Transport\Jackrabbit($this->sessionInput),
+ );
+
+ foreach ($transports as $transport) {
+ $this->transports[$transport->getName()] = $transport;;
+ }
+ }
+
+ /**
+ * Change the current workspace
+ *
+ * @param string $workspaceName
+ */
+ public function changeWorkspace($workspaceName)
+ {
+ $this->init();
+ $this->session->logout();
+ $this->sessionInput->setOption('phpcr-workspace', $workspaceName);
+ $this->initSession($this->sessionInput);
+ }
+
+ /**
+ * Login (again)
+ *
+ * @param string $username
+ * @param string $password
+ * @param string $workspaceName
+ */
+ public function relogin($username, $password, $workspaceName = null)
+ {
+ if ($this->session) {
+ $this->session->logout();
+ }
+
+ $this->sessionInput->setOption('phpcr-username', $username);
+ $this->sessionInput->setOption('phpcr-password', $password);
+
+ if ($workspaceName) {
+ $this->sessionInput->setOption('phpcr-workspace', $workspaceName);
+ }
+
+ $this->init();
+ }
+
+ /**
+ * Return the current PHPCR session. We lazy call
+ * initialize.
+ *
+ * @return \PHPCR\SessionInterface
+ */
+ public function getSession()
+ {
+ $this->init();
+
+ return $this->session;
+ }
+
+ /**
+ * Proxy for getting the repository (make mocking easier)
+ *
+ * @return \PHPCR\RepositoryInterface
+ */
+ public function getRepository()
+ {
+ $this->init();
+
+ return $this->session->getRepository();
+ }
+}
diff --git a/src/PHPCR/Shell/Console/Helper/RepositoryHelper.php b/src/PHPCR/Shell/Console/Helper/RepositoryHelper.php
index e49cf5fe..32ca271e 100644
--- a/src/PHPCR/Shell/Console/Helper/RepositoryHelper.php
+++ b/src/PHPCR/Shell/Console/Helper/RepositoryHelper.php
@@ -2,28 +2,27 @@
namespace PHPCR\Shell\Console\Helper;
-use PHPCR\RepositoryInterface;
use Symfony\Component\Console\Helper\Helper;
class RepositoryHelper extends Helper
{
/**
- * @var RepositoryInterface
+ * @var PhpcrHelper
*/
- protected $repository;
+ protected $phpcrHelper;
/**
* @var array
*/
protected $descriptors;
- public function __construct(RepositoryInterface $repository)
+ public function __construct(PhpcrHelper $phpcrHelper)
{
- $this->repository = $repository;
+ $this->phpcrHelper = $phpcrHelper;
}
/**
- * Return true if the repository supports the given descriptor
+ * Return true if the phpcrHelper supports the given descriptor
* which relates to a descriptor key
*
* @param string $descriptor
@@ -62,8 +61,10 @@ public function hasDescriptor($descriptor, $value = null)
private function loadDescriptors()
{
if (null === $this->descriptors) {
- foreach ($this->repository->getDescriptorKeys() as $key) {
- $this->descriptors[$key] = $this->repository->getDescriptor($key);
+ $repository = $this->phpcrHelper->getRepository();
+
+ foreach ($repository->getDescriptorKeys() as $key) {
+ $this->descriptors[$key] = $repository->getDescriptor($key);
}
}
}
diff --git a/src/PHPCR/Shell/Console/Helper/ResultFormatterHelper.php b/src/PHPCR/Shell/Console/Helper/ResultFormatterHelper.php
index 94eba18c..80ded3fd 100644
--- a/src/PHPCR/Shell/Console/Helper/ResultFormatterHelper.php
+++ b/src/PHPCR/Shell/Console/Helper/ResultFormatterHelper.php
@@ -11,15 +11,27 @@
use PHPCR\PropertyInterface;
/**
+ * Provide methods for formatting PHPCR objects
+ *
* @TODO: Rename this to PhpcrFormatterHelper
*/
class ResultFormatterHelper extends Helper
{
+ /**
+ * {@inheritDoc}
+ */
public function getName()
{
return 'result_formatter';
}
+
+ /**
+ * Return the name of a property from its enumeration (i.e.
+ * the value of its CONSTANT)
+ *
+ * @return string
+ */
public function getPropertyTypeName($typeInteger)
{
$refl = new \ReflectionClass('PHPCR\PropertyType');
@@ -30,7 +42,10 @@ public function getPropertyTypeName($typeInteger)
}
}
- public function format(QueryResultInterface $result, OutputInterface $output, $elapsed)
+ /**
+ * Render a table with the results of the given QueryResultInterface
+ */
+ public function formatQueryResult(QueryResultInterface $result, OutputInterface $output, $elapsed)
{
$selectorNames = $result->getSelectorNames();
@@ -144,7 +159,7 @@ public function formatNodeName(NodeInterface $node)
return sprintf('%s%s', $node->getName(), $node->hasNodes() ? '/' : '');
}
- public function formatException(\Exception $e)
+ public function formatException(\Exception $e)
{
if ($e instanceof \Jackalope\NotImplementedException) {
return '[ERROR] Not implemented by jackalope';
diff --git a/src/PHPCR/Shell/Console/Helper/TextHelper.php b/src/PHPCR/Shell/Console/Helper/TextHelper.php
index d5ef101f..c8479ae1 100644
--- a/src/PHPCR/Shell/Console/Helper/TextHelper.php
+++ b/src/PHPCR/Shell/Console/Helper/TextHelper.php
@@ -4,13 +4,31 @@
use Symfony\Component\Console\Helper\Helper;
+/**
+ * Helper for text plain text formatting
+ *
+ * @author Daniel Leech
+ */
class TextHelper extends Helper
{
+ /**
+ * {@inheritDoc}
+ */
public function getName()
{
return 'text';
}
+ /**
+ * Truncate the given string
+ *
+ * @param string $string String to truncate
+ * @param integer $length Truncate to this length
+ * @param string $alignment Align to the "left" or the "right"
+ * @param string $delimString String to use to use to indicate the truncation
+ *
+ * @return string
+ */
public function truncate($string, $length, $alignment = null, $delimString = null)
{
$alignment = $alignment === null ? 'left' : $alignment;
diff --git a/src/PHPCR/Shell/Console/Input/StringInput.php b/src/PHPCR/Shell/Console/Input/StringInput.php
index d4bfaa94..ad86982a 100644
--- a/src/PHPCR/Shell/Console/Input/StringInput.php
+++ b/src/PHPCR/Shell/Console/Input/StringInput.php
@@ -4,11 +4,20 @@
use Symfony\Component\Console\Input\StringInput as BaseInput;
+/**
+ * Extend the Symfony StringInput class to provide additional accessors
+ * and methods
+ *
+ * @author Daniel Leech
+ */
class StringInput extends BaseInput
{
protected $rawCommand;
protected $tokens;
+ /**
+ * {@inheritDoc}
+ */
public function __construct($command)
{
$this->rawCommand = trim($command);
@@ -20,6 +29,13 @@ public function __construct($command)
parent::__construct($command);
}
+ /**
+ * Return the raw command string without any parsing
+ *
+ * (useful for returning the full SQL query for example)
+ *
+ * @return string
+ */
public function getRawCommand()
{
return $this->rawCommand;
@@ -32,6 +48,11 @@ public function validate()
}
}
+ /**
+ * Do not validate if the command is a query
+ *
+ * {@inheritDoc}
+ */
protected function parse()
{
if (false === $this->isQuery()) {
@@ -39,17 +60,34 @@ protected function parse()
}
}
+ /**
+ * Provide access to the tokens as this is not
+ * allowed by the default StringInput and we require
+ * it for the "alias" feature.
+ */
protected function setTokens(array $tokens)
{
$this->tokens = $tokens;
parent::setTokens($tokens);
}
+ /**
+ * Return the tokens for this command (as recognized
+ * by the parse() method).
+ *
+ * @return array
+ */
public function getTokens()
{
return $this->tokens;
}
+ /**
+ * Return true if this command sounds like a query, i.e.
+ * if it begins with "select "
+ *
+ * @return boolean
+ */
protected function isQuery()
{
if (strpos(strtolower($this->rawCommand), 'select') === 0) {
diff --git a/src/PHPCR/Shell/Event/CommandExceptionEvent.php b/src/PHPCR/Shell/Event/CommandExceptionEvent.php
index 5d066b3f..a8db1ba5 100644
--- a/src/PHPCR/Shell/Event/CommandExceptionEvent.php
+++ b/src/PHPCR/Shell/Event/CommandExceptionEvent.php
@@ -2,8 +2,6 @@
namespace PHPCR\Shell\Event;
-use PHPCR\UnsupportedRepositoryOperationException;
-use Jackalope\NotImplementedException;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\Console\Output\OutputInterface;
@@ -18,12 +16,12 @@ public function __construct(\Exception $exception, OutputInterface $output)
$this->output = $output;
}
- public function getException()
+ public function getException()
{
return $this->exception;
}
- public function getOutput()
+ public function getOutput()
{
return $this->output;
}
diff --git a/src/PHPCR/Shell/Event/CommandPreRunEvent.php b/src/PHPCR/Shell/Event/CommandPreRunEvent.php
index dac210e2..0852b6c0 100644
--- a/src/PHPCR/Shell/Event/CommandPreRunEvent.php
+++ b/src/PHPCR/Shell/Event/CommandPreRunEvent.php
@@ -16,19 +16,19 @@ public function __construct($commandName, InputInterface $input)
$this->input = $input;
}
- public function getInput()
+ public function getInput()
{
return $this->input;
}
-
+
public function setInput($input)
{
$this->input = $input;
}
- public function getCommandName()
+ public function getCommandName()
{
return $this->commandName;
}
-
+
}
diff --git a/src/PHPCR/Shell/PhpcrSession.php b/src/PHPCR/Shell/PhpcrSession.php
index 74060fcc..318e09f0 100644
--- a/src/PHPCR/Shell/PhpcrSession.php
+++ b/src/PHPCR/Shell/PhpcrSession.php
@@ -43,6 +43,9 @@ public function setCwd($cwd)
$this->cwd = $cwd;
}
+ /**
+ * @TODO: Refactor this.
+ */
public function autocomplete($text)
{
// get last string
diff --git a/tests/PHPCR/Shell/Helper/RepositoryHelperTest.php b/tests/PHPCR/Shell/Helper/RepositoryHelperTest.php
deleted file mode 100644
index 76cd83a6..00000000
--- a/tests/PHPCR/Shell/Helper/RepositoryHelperTest.php
+++ /dev/null
@@ -1,61 +0,0 @@
-repository = $this->getMock('PHPCR\RepositoryInterface');
- $this->helper = new RepositoryHelper($this->repository);
- }
-
- public function testHasDescriptor()
- {
- $descriptors = array(
- 'foobar' => true,
- 'barfoo' => true,
- 'zoobar' => false,
- 'true' => 'true',
- 'false' => 'false',
- );
-
- $this->repository->expects($this->once())
- ->method('getDescriptorKeys')
- ->will($this->returnValue(array_keys($descriptors)));
-
- $this->repository->expectS($this->any())
- ->method('getDescriptor')
- ->will($this->returnCallback(function ($k) use ($descriptors) {
- return $descriptors[$k];
- }));
-
- $res = $this->helper->hasDescriptor('zoobar', false);
- $this->assertTrue($res);
-
- $res = $this->helper->hasDescriptor('foobar');
- $this->assertTrue($res);
-
- $res = $this->helper->hasDescriptor('asdasd');
- $this->assertFalse($res);
-
- $res = $this->helper->hasDescriptor('');
- $this->assertFalse($res);
-
- $res = $this->helper->hasDescriptor('foobar', 'asdasd');
- $this->assertFalse($res);
-
- $res = $this->helper->hasDescriptor('true', true);
- $this->assertTrue($res);
-
- $res = $this->helper->hasDescriptor('false', false);
- $this->assertTrue($res);
- }
-}
-