diff --git a/README.md b/README.md index b5f5efe6..f5e72521 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ Shell for PHPCR --------------- [![Build Status](https://travis-ci.org/phpcr/phpcr-shell.png?branch=master)](https://travis-ci.org/phpcr/phpcr-shell) +[![StyleCI](https://styleci.io/repos/14844492/shield)](https://styleci.io/repos/14844492) Shell for PHPCR diff --git a/features/fixtures/jackalope-doctrine-dbal-cli-config.php b/features/fixtures/jackalope-doctrine-dbal-cli-config.php index 693044e5..c159a8b1 100644 --- a/features/fixtures/jackalope-doctrine-dbal-cli-config.php +++ b/features/fixtures/jackalope-doctrine-dbal-cli-config.php @@ -1,19 +1,30 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ + +$dbConn = \Doctrine\DBAL\DriverManager::getConnection([ 'driver' => 'pdo_sqlite', 'dbname' => 'test', 'path' => __DIR__.'/app.sqlite', -)); +]); /* * configuration */ -$workspace = 'default'; // phpcr workspace to use -$user = 'admin'; -$pass = 'admin'; +$workspace = 'default'; // phpcr workspace to use +$user = 'admin'; +$pass = 'admin'; $factory = new \Jackalope\RepositoryFactoryDoctrineDBAL(); -$repository = $factory->getRepository(array('jackalope.doctrine_dbal_connection' => $dbConn)); +$repository = $factory->getRepository(['jackalope.doctrine_dbal_connection' => $dbConn]); $credentials = new \PHPCR\SimpleCredentials($user, $pass); @@ -25,15 +36,14 @@ ) { $session = $repository->login($credentials, $workspace); - $helperSet = new \Symfony\Component\Console\Helper\HelperSet(array( - 'dialog' => new \Symfony\Component\Console\Helper\DialogHelper(), - 'phpcr' => new \PHPCR\Util\Console\Helper\PhpcrHelper($session), + $helperSet = new \Symfony\Component\Console\Helper\HelperSet([ + 'dialog' => new \Symfony\Component\Console\Helper\DialogHelper(), + 'phpcr' => new \PHPCR\Util\Console\Helper\PhpcrHelper($session), 'phpcr_console_dumper' => new \PHPCR\Util\Console\Helper\PhpcrConsoleDumperHelper(), - )); -} else if (isset($argv[1]) && $argv[1] == 'jackalope:init:dbal') { + ]); +} elseif (isset($argv[1]) && $argv[1] == 'jackalope:init:dbal') { // special case: the init command needs the db connection, but a session is impossible if the db is not yet initialized - $helperSet = new \Symfony\Component\Console\Helper\HelperSet(array( - 'connection' => new \Jackalope\Tools\Console\Helper\DoctrineDbalHelper($dbConn) - )); + $helperSet = new \Symfony\Component\Console\Helper\HelperSet([ + 'connection' => new \Jackalope\Tools\Console\Helper\DoctrineDbalHelper($dbConn), + ]); } - diff --git a/spec/PHPCR/Shell/Config/ConfigManagerSpec.php b/spec/PHPCR/Shell/Config/ConfigManagerSpec.php index c22c94d3..59dceb9d 100644 --- a/spec/PHPCR/Shell/Config/ConfigManagerSpec.php +++ b/spec/PHPCR/Shell/Config/ConfigManagerSpec.php @@ -7,6 +7,7 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace spec\PHPCR\Shell\Config; @@ -19,8 +20,7 @@ class ConfigManagerSpec extends ObjectBehavior { public function let( Filesystem $filesystem - ) - { + ) { $this->beConstructedWith($filesystem); } @@ -37,10 +37,9 @@ public function it_should_have_a_method_to_get_the_users_config_directory() public function it_should_be_able_to_parse_a_config_file_and_return_the_config_as_an_array( Filesystem $filesystem - ) - { - $dir = __DIR__ . '/fixtures/config'; - putenv('PHPCRSH_HOME=' . $dir); + ) { + $dir = __DIR__.'/fixtures/config'; + putenv('PHPCRSH_HOME='.$dir); $filesystem->exists(Argument::any())->willReturn(true); $this->getConfig('alias')->offsetGet('foobar')->shouldReturn('barfoo'); diff --git a/spec/PHPCR/Shell/Config/ConfigSpec.php b/spec/PHPCR/Shell/Config/ConfigSpec.php index 0b84f333..ae06b97b 100644 --- a/spec/PHPCR/Shell/Config/ConfigSpec.php +++ b/spec/PHPCR/Shell/Config/ConfigSpec.php @@ -7,36 +7,36 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace spec\PHPCR\Shell\Config; use PhpSpec\ObjectBehavior; -use Prophecy\Argument; class ConfigSpec extends ObjectBehavior { - function it_is_initializable() + public function it_is_initializable() { $this->shouldHaveType('PHPCR\Shell\Config\Config'); } - function let() + public function let() { - $this->beConstructedWith(array( + $this->beConstructedWith([ 'foo' => 'bar', - 'bar' => array( - 'boo' => 'baz' - ), - )); + 'bar' => [ + 'boo' => 'baz', + ], + ]); } - function it_should_be_able_to_access_data_values() + public function it_should_be_able_to_access_data_values() { $this['foo']->shouldReturn('bar'); } - function it_should_be_able_to_access_nested_config() + public function it_should_be_able_to_access_nested_config() { $this['bar']['boo']->shouldReturn('baz'); } diff --git a/spec/PHPCR/Shell/Config/ProfileLoaderSpec.php b/spec/PHPCR/Shell/Config/ProfileLoaderSpec.php index 1a054de0..9af91fc0 100644 --- a/spec/PHPCR/Shell/Config/ProfileLoaderSpec.php +++ b/spec/PHPCR/Shell/Config/ProfileLoaderSpec.php @@ -7,14 +7,15 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace spec\PHPCR\Shell\Config; -use PhpSpec\ObjectBehavior; -use Prophecy\Argument; use PHPCR\Shell\Config\ConfigManager; use PHPCR\Shell\Config\Profile; +use PhpSpec\ObjectBehavior; +use Prophecy\Argument; use Symfony\Component\Filesystem\Filesystem; class ProfileLoaderSpec extends ObjectBehavior @@ -22,8 +23,7 @@ class ProfileLoaderSpec extends ObjectBehavior public function let( ConfigManager $configManager, Filesystem $filesystem - ) - { + ) { $configManager->getConfigDir()->willReturn(__DIR__); $this->beConstructedWith($configManager, $filesystem); } @@ -35,28 +35,27 @@ public function it_is_initializable() public function it_should_list_profile_names() { - $this->getProfileNames()->shouldReturn(array( - 'one', 'two' - )); + $this->getProfileNames()->shouldReturn([ + 'one', 'two', + ]); } public function it_should_load_data_into_a_given_profile( Profile $profile, Filesystem $filesystem - ) - { + ) { $profile->get('phpcr', 'workspace')->willReturn('default'); $profile->getName()->willReturn('one'); - $profile->set('transport', array( - 'name' => 'foobar', + $profile->set('transport', [ + 'name' => 'foobar', 'bar_foo' => 'barfoo', 'foo_bar' => 'foobar', - ))->shouldBeCalled(); - $profile->set('phpcr', array( - 'username' => 'username', - 'password' => 'password', + ])->shouldBeCalled(); + $profile->set('phpcr', [ + 'username' => 'username', + 'password' => 'password', 'workspace' => 'default', - ))->shouldBeCalled(); + ])->shouldBeCalled(); $this->loadProfile($profile); } @@ -64,20 +63,19 @@ public function it_should_load_data_into_a_given_profile( public function it_should_save_a_given_profile( Profile $profile, Filesystem $filesystem - ) - { + ) { $profile->getName()->willReturn('newprofile'); - $profile->toArray()->willReturn(array( - 'transport' => array( - 'name' => 'test_transport', + $profile->toArray()->willReturn([ + 'transport' => [ + 'name' => 'test_transport', 'option1' => 'value1', - ), - 'phpcr' => array( + ], + 'phpcr' => [ 'username' => 'daniel', 'password' => 'leech', - ), - )); - $filesystem->dumpFile(Argument::type('string'), <<dumpFile(Argument::type('string'), <<<'EOT' transport: name: test_transport option1: value1 diff --git a/spec/PHPCR/Shell/Config/ProfileSpec.php b/spec/PHPCR/Shell/Config/ProfileSpec.php index a458332d..94ee7b02 100644 --- a/spec/PHPCR/Shell/Config/ProfileSpec.php +++ b/spec/PHPCR/Shell/Config/ProfileSpec.php @@ -7,12 +7,12 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace spec\PHPCR\Shell\Config; use PhpSpec\ObjectBehavior; -use PHPCR\Shell\Config\Config; class ProfileSpec extends ObjectBehavior { @@ -29,16 +29,15 @@ public function it_is_initializable() } public function it_has_a_method_to_set_config( - ) - { - $this->set('transport', array()); + ) { + $this->set('transport', []); } public function it_has_a_method_to_get_config() { - $this->set('transport', array( - 'foo' => 'bar' - )); + $this->set('transport', [ + 'foo' => 'bar', + ]); $this->get('transport')->shouldHaveType('PHPCR\Shell\Config\Config'); diff --git a/spec/PHPCR/Shell/Console/Application/EmbeddedApplicationSpec.php b/spec/PHPCR/Shell/Console/Application/EmbeddedApplicationSpec.php index 19971fe5..f888cdbc 100644 --- a/spec/PHPCR/Shell/Console/Application/EmbeddedApplicationSpec.php +++ b/spec/PHPCR/Shell/Console/Application/EmbeddedApplicationSpec.php @@ -7,22 +7,19 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace spec\PHPCR\Shell\Console\Application; -use PhpSpec\ObjectBehavior; -use PHPCR\Shell\Console\Application\EmbeddedApplication; -use Symfony\Component\DependencyInjection\ContainerInterface; -use PHPCR\Shell\PhpcrShell; use PHPCR\Shell\DependencyInjection\Container; +use PhpSpec\ObjectBehavior; class EmbeddedApplicationSpec extends ObjectBehavior { public function let( Container $container - ) - { + ) { $this->beConstructedWith($container); } diff --git a/spec/PHPCR/Shell/Console/Application/ShellApplicationSpec.php b/spec/PHPCR/Shell/Console/Application/ShellApplicationSpec.php index dac0f5bb..1588eecb 100644 --- a/spec/PHPCR/Shell/Console/Application/ShellApplicationSpec.php +++ b/spec/PHPCR/Shell/Console/Application/ShellApplicationSpec.php @@ -7,21 +7,20 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace spec\PHPCR\Shell\Console\Application; +use PHPCR\Shell\PhpcrShell; use PhpSpec\ObjectBehavior; use Symfony\Component\DependencyInjection\ContainerInterface; -use PHPCR\Shell\Console\Application\EmbeddedApplication; -use PHPCR\Shell\PhpcrShell; class ShellApplicationSpec extends ObjectBehavior { public function let( ContainerInterface $container - ) - { + ) { $this->beConstructedWith($container, PhpcrShell::MODE_EMBEDDED_COMMAND); } diff --git a/spec/PHPCR/Shell/Console/Helper/EditorHelperSpec.php b/spec/PHPCR/Shell/Console/Helper/EditorHelperSpec.php index 9d6eecbc..b345e913 100644 --- a/spec/PHPCR/Shell/Console/Helper/EditorHelperSpec.php +++ b/spec/PHPCR/Shell/Console/Helper/EditorHelperSpec.php @@ -7,6 +7,7 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace spec\PHPCR\Shell\Console\Helper; diff --git a/spec/PHPCR/Shell/Console/Helper/NodeHelperSpec.php b/spec/PHPCR/Shell/Console/Helper/NodeHelperSpec.php index 6392fb2e..21a0a130 100644 --- a/spec/PHPCR/Shell/Console/Helper/NodeHelperSpec.php +++ b/spec/PHPCR/Shell/Console/Helper/NodeHelperSpec.php @@ -7,13 +7,14 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace spec\PHPCR\Shell\Console\Helper; -use PhpSpec\ObjectBehavior; use PHPCR\NodeInterface; use PHPCR\NodeType\NodeTypeInterface; +use PhpSpec\ObjectBehavior; class NodeHelperSpec extends ObjectBehavior { @@ -27,11 +28,10 @@ public function it_should_provide_a_method_to_determine_if_a_node_has_a_given_mi NodeTypeInterface $mixin1, NodeTypeInterface $mixin2, NodeTypeInterface $mixin3 - ) - { - $node->getMixinNodeTypes()->willReturn(array( - $mixin1, $mixin2, $mixin3 - )); + ) { + $node->getMixinNodeTypes()->willReturn([ + $mixin1, $mixin2, $mixin3, + ]); $mixin1->getName()->willReturn('mixin1'); $mixin2->getName()->willReturn('mixin1'); @@ -46,17 +46,16 @@ public function it_should_provide_a_method_to_determine_if_a_node_is_versionable NodeInterface $nodeNotVersionable, NodeTypeInterface $mixin1, NodeTypeInterface $mixin2 - ) - { - $nodeVersionable->getMixinNodeTypes()->willReturn(array( - $mixin1, $mixin2 - )); - $nodeNotVersionable->getMixinNodeTypes()->willReturn(array( - $mixin2 - )); + ) { + $nodeVersionable->getMixinNodeTypes()->willReturn([ + $mixin1, $mixin2, + ]); + $nodeNotVersionable->getMixinNodeTypes()->willReturn([ + $mixin2, + ]); $nodeNotVersionable->getPath()->willReturn('foobar'); $mixin1->getName()->willReturn('mix:versionable'); - $this->assertNodeIsVersionable($nodeVersionable)->shouldReturn(null);; + $this->assertNodeIsVersionable($nodeVersionable)->shouldReturn(null); try { $this->assertNodeIsVersionable($nodeNotVersionable); diff --git a/spec/PHPCR/Shell/Console/Helper/PathHelperSpec.php b/spec/PHPCR/Shell/Console/Helper/PathHelperSpec.php index 174a2491..35365b1e 100644 --- a/spec/PHPCR/Shell/Console/Helper/PathHelperSpec.php +++ b/spec/PHPCR/Shell/Console/Helper/PathHelperSpec.php @@ -7,6 +7,7 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace spec\PHPCR\Shell\Console\Helper; diff --git a/spec/PHPCR/Shell/Console/Helper/RepositoryHelperSpec.php b/spec/PHPCR/Shell/Console/Helper/RepositoryHelperSpec.php index 0e2426e7..a302c2db 100644 --- a/spec/PHPCR/Shell/Console/Helper/RepositoryHelperSpec.php +++ b/spec/PHPCR/Shell/Console/Helper/RepositoryHelperSpec.php @@ -7,13 +7,14 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace spec\PHPCR\Shell\Console\Helper; -use PhpSpec\ObjectBehavior; use PHPCR\RepositoryInterface; use PHPCR\Shell\Phpcr\SessionManager; +use PhpSpec\ObjectBehavior; class RepositoryHelperSpec extends ObjectBehavior { @@ -33,9 +34,9 @@ public function it_provides_a_method_to_say_if_a_descriptor_exists_or_not( RepositoryInterface $repository ) { $sessionManager->getRepository()->willReturn($repository); - $repository->getDescriptorKeys()->willReturn(array( - 'foo', 'bar' - )); + $repository->getDescriptorKeys()->willReturn([ + 'foo', 'bar', + ]); $repository->getDescriptor('foo')->willReturn('foo'); $repository->getDescriptor('bar')->willReturn('foo'); diff --git a/spec/PHPCR/Shell/Console/Helper/ResultFormatterHelperSpec.php b/spec/PHPCR/Shell/Console/Helper/ResultFormatterHelperSpec.php index 3ab0c63e..82aefd0f 100644 --- a/spec/PHPCR/Shell/Console/Helper/ResultFormatterHelperSpec.php +++ b/spec/PHPCR/Shell/Console/Helper/ResultFormatterHelperSpec.php @@ -7,22 +7,21 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace spec\PHPCR\Shell\Console\Helper; -use PhpSpec\ObjectBehavior; -use PHPCR\Shell\Console\Helper\TextHelper; -use PHPCR\Shell\Console\Helper\TableHelper; use PHPCR\Shell\Config\Config; +use PHPCR\Shell\Console\Helper\TextHelper; +use PhpSpec\ObjectBehavior; class ResultFormatterHelperSpec extends ObjectBehavior { public function let( TextHelper $textHelper, Config $config - ) - { + ) { $this->beConstructedWith($textHelper, $config); } diff --git a/spec/PHPCR/Shell/Console/Helper/TextHelperSpec.php b/spec/PHPCR/Shell/Console/Helper/TextHelperSpec.php index b8d08c4e..2c71fd06 100644 --- a/spec/PHPCR/Shell/Console/Helper/TextHelperSpec.php +++ b/spec/PHPCR/Shell/Console/Helper/TextHelperSpec.php @@ -7,6 +7,7 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace spec\PHPCR\Shell\Console\Helper; diff --git a/spec/PHPCR/Shell/Console/Input/StringInputSpec.php b/spec/PHPCR/Shell/Console/Input/StringInputSpec.php index e60bf784..55d58dd2 100644 --- a/spec/PHPCR/Shell/Console/Input/StringInputSpec.php +++ b/spec/PHPCR/Shell/Console/Input/StringInputSpec.php @@ -7,6 +7,7 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace spec\PHPCR\Shell\Console\Input; diff --git a/spec/PHPCR/Shell/Event/ApplicationInitEventSpec.php b/spec/PHPCR/Shell/Event/ApplicationInitEventSpec.php index e18d2b62..c5caf701 100644 --- a/spec/PHPCR/Shell/Event/ApplicationInitEventSpec.php +++ b/spec/PHPCR/Shell/Event/ApplicationInitEventSpec.php @@ -7,6 +7,7 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace spec\PHPCR\Shell\Event; @@ -23,15 +24,13 @@ public function it_is_initializable() public function let( Application $application - ) - { + ) { $this->beConstructedWith($application); } public function it_will_return_the_application( Application $application - ) - { + ) { $this->getApplication()->shouldReturn($application); } } diff --git a/spec/PHPCR/Shell/Event/CommandExceptionEventSpec.php b/spec/PHPCR/Shell/Event/CommandExceptionEventSpec.php index cae20e9f..505c1235 100644 --- a/spec/PHPCR/Shell/Event/CommandExceptionEventSpec.php +++ b/spec/PHPCR/Shell/Event/CommandExceptionEventSpec.php @@ -7,13 +7,14 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace spec\PHPCR\Shell\Event; +use PHPCR\Shell\Console\Application\ShellApplication; use PhpSpec\ObjectBehavior; use Symfony\Component\Console\Output\OutputInterface; -use PHPCR\Shell\Console\Application\ShellApplication; class CommandExceptionEventSpec extends ObjectBehavior { diff --git a/spec/PHPCR/Shell/Event/ProfileInitEventSpec.php b/spec/PHPCR/Shell/Event/ProfileInitEventSpec.php index 44a1bf54..beba4777 100644 --- a/spec/PHPCR/Shell/Event/ProfileInitEventSpec.php +++ b/spec/PHPCR/Shell/Event/ProfileInitEventSpec.php @@ -7,12 +7,13 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace spec\PHPCR\Shell\Event; -use PhpSpec\ObjectBehavior; use PHPCR\Shell\Config\Profile; +use PhpSpec\ObjectBehavior; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -27,8 +28,7 @@ public function let( Profile $profile, InputInterface $input, OutputInterface $output - ) - { + ) { $this->beConstructedWith( $profile, $input, $output ); @@ -38,8 +38,7 @@ public function it_should_have_getters( Profile $profile, InputInterface $input, OutputInterface $output - ) - { + ) { $this->getProfile()->shouldReturn($profile); $this->getInput()->shouldReturn($input); $this->getOutput()->shouldReturn($output); diff --git a/spec/PHPCR/Shell/Phpcr/SessionManagerSpec.php b/spec/PHPCR/Shell/Phpcr/SessionManagerSpec.php index 85e7075e..bf1d3b5b 100644 --- a/spec/PHPCR/Shell/Phpcr/SessionManagerSpec.php +++ b/spec/PHPCR/Shell/Phpcr/SessionManagerSpec.php @@ -7,13 +7,14 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace spec\PHPCR\Shell\Phpcr; -use PhpSpec\ObjectBehavior; use PHPCR\Shell\Config\Profile; use PHPCR\Shell\Transport\TransportRegistryInterface; +use PhpSpec\ObjectBehavior; class SessionManagerSpec extends ObjectBehavior { diff --git a/spec/PHPCR/Shell/Query/UpdateParserSpec.php b/spec/PHPCR/Shell/Query/UpdateParserSpec.php index 2e434ee1..bdfb9eaa 100644 --- a/spec/PHPCR/Shell/Query/UpdateParserSpec.php +++ b/spec/PHPCR/Shell/Query/UpdateParserSpec.php @@ -7,27 +7,27 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace spec\PHPCR\Shell\Query; -use PhpSpec\ObjectBehavior; -use PHPCR\Query\QOM\QueryObjectModelFactoryInterface; -use PHPCR\Query\QOM\JoinInterface; -use PHPCR\Query\QOM\SourceInterface; use PHPCR\Query\QOM\ChildNodeJoinConditionInterface; -use PHPCR\Query\QOM\QueryObjectModelConstantsInterface; -use PHPCR\Query\QOM\PropertyValueInterface; -use PHPCR\Query\QOM\LiteralInterface; use PHPCR\Query\QOM\ComparisonInterface; +use PHPCR\Query\QOM\JoinInterface; +use PHPCR\Query\QOM\LiteralInterface; +use PHPCR\Query\QOM\PropertyValueInterface; +use PHPCR\Query\QOM\QueryObjectModelConstantsInterface; +use PHPCR\Query\QOM\QueryObjectModelFactoryInterface; +use PHPCR\Query\QOM\SourceInterface; use PHPCR\Query\QueryInterface; +use PhpSpec\ObjectBehavior; class UpdateParserSpec extends ObjectBehavior { public function let( QueryObjectModelFactoryInterface $qomf - ) - { + ) { $this->beConstructedWith( $qomf ); @@ -48,8 +48,7 @@ public function it_should_provide_a_qom_object_for_selecting( LiteralInterface $literalValue, ComparisonInterface $comparison, QueryInterface $query - ) - { + ) { $qomf->selector('parent', 'mgnl:page')->willReturn($parentSource); $qomf->selector('child', 'mgnl:metaData')->willReturn($childSource); $qomf->childNodeJoinCondition('child', 'parent')->willReturn($joinCondition); @@ -60,11 +59,11 @@ public function it_should_provide_a_qom_object_for_selecting( $qomf->createQuery($join, $comparison)->willReturn($query); - $sql = <<parse($sql); $res->offsetGet(0)->shouldHaveType('PHPCR\Query\QueryInterface'); - $res->offsetGet(1)->shouldReturn(array( - array( + $res->offsetGet(1)->shouldReturn([ + [ 'selector' => 'parent', - 'name' => 'foo', - 'value' => 'PHPCR\\FOO\\Bar', - ), - array( + 'name' => 'foo', + 'value' => 'PHPCR\\FOO\\Bar', + ], + [ 'selector' => 'parent', - 'name' => 'bar', - 'value' => 'foo', - ), - )); + 'name' => 'bar', + 'value' => 'foo', + ], + ]); } - public function it_should_parse_functions ( + public function it_should_parse_functions( QueryObjectModelFactoryInterface $qomf, SourceInterface $source, QueryInterface $query - ) - { + ) { $qomf->selector('a', 'dtl:article')->willReturn($source); $qomf->createQuery($source, null)->willReturn($query); - $sql = <<parse($sql); @@ -104,17 +102,16 @@ public function it_should_parse_functions ( $res->offsetGet(0)->shouldHaveType('PHPCR\Query\QueryInterface'); } - public function it_should_parse_apply ( + public function it_should_parse_apply( QueryObjectModelFactoryInterface $qomf, SourceInterface $source, QueryInterface $query - ) - { + ) { $qomf->selector('a', 'dtl:article')->willReturn($source); $qomf->createQuery($source, null)->willReturn($query); - $sql = <<parse($sql); diff --git a/spec/PHPCR/Shell/Serializer/NodeNormalizerSpec.php b/spec/PHPCR/Shell/Serializer/NodeNormalizerSpec.php index 6fa5f819..04c03af0 100644 --- a/spec/PHPCR/Shell/Serializer/NodeNormalizerSpec.php +++ b/spec/PHPCR/Shell/Serializer/NodeNormalizerSpec.php @@ -7,14 +7,15 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace spec\PHPCR\Shell\Serializer; -use PhpSpec\ObjectBehavior; use PHPCR\NodeInterface; use PHPCR\PropertyInterface; use PHPCR\PropertyType; +use PhpSpec\ObjectBehavior; class NodeNormalizerSpec extends ObjectBehavior { @@ -28,11 +29,10 @@ public function it_can_normalize_a_node_to_an_array( PropertyInterface $p1, PropertyInterface $p2, PropertyInterface $p3 - ) - { - $node->getProperties()->willReturn(array( - $p1, $p2, $p3 - )); + ) { + $node->getProperties()->willReturn([ + $p1, $p2, $p3, + ]); $p1->getName()->willReturn('my:property.1'); $p1->getType()->willReturn(PropertyType::STRING); @@ -44,19 +44,19 @@ public function it_can_normalize_a_node_to_an_array( $p3->getType()->willReturn(PropertyType::STRING); $p3->getValue()->willReturn('P3 Val'); - $this->normalize($node)->shouldReturn(array( - 'my:property.1' => array( - 'type' => 'String', + $this->normalize($node)->shouldReturn([ + 'my:property.1' => [ + 'type' => 'String', 'value' => 'P1 Val', - ), - 'my:property.2' => array( - 'type' => 'Double', + ], + 'my:property.2' => [ + 'type' => 'Double', 'value' => 'P2 Val', - ), - 'my:property.3' => array( - 'type' => 'String', + ], + 'my:property.3' => [ + 'type' => 'String', 'value' => 'P3 Val', - ), - )); + ], + ]); } } diff --git a/spec/PHPCR/Shell/Serializer/YamlEncoderSpec.php b/spec/PHPCR/Shell/Serializer/YamlEncoderSpec.php index ad3bc6e1..7fde3963 100644 --- a/spec/PHPCR/Shell/Serializer/YamlEncoderSpec.php +++ b/spec/PHPCR/Shell/Serializer/YamlEncoderSpec.php @@ -7,6 +7,7 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace spec\PHPCR\Shell\Serializer; @@ -22,8 +23,8 @@ public function it_is_initializable() public function it_should_encode_to_yaml() { - $data = array('foobar' => 'barfoo', 'barfoo' => 'foobar'); - $this->encode($data, 'yaml')->shouldReturn(<< 'barfoo', 'barfoo' => 'foobar']; + $this->encode($data, 'yaml')->shouldReturn(<<<'EOT' foobar: barfoo barfoo: foobar @@ -33,16 +34,14 @@ public function it_should_encode_to_yaml() public function is_should_decode_yaml() { - $yaml = <<decode($yaml, 'yaml')->shouldReturn(array( + $this->decode($yaml, 'yaml')->shouldReturn([ 'foobar' => 'barfoo', - 'barfoo' => 'foobar' - )); - + 'barfoo' => 'foobar', + ]); } } diff --git a/spec/PHPCR/Shell/Subscriber/AliasSubscriberSpec.php b/spec/PHPCR/Shell/Subscriber/AliasSubscriberSpec.php index bc95aaae..bd26c34a 100644 --- a/spec/PHPCR/Shell/Subscriber/AliasSubscriberSpec.php +++ b/spec/PHPCR/Shell/Subscriber/AliasSubscriberSpec.php @@ -7,15 +7,16 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace spec\PHPCR\Shell\Subscriber; -use PhpSpec\ObjectBehavior; -use Prophecy\Argument; use PHPCR\Shell\Config\ConfigManager; use PHPCR\Shell\Console\Input\StringInput; use PHPCR\Shell\Event\CommandPreRunEvent; +use PhpSpec\ObjectBehavior; +use Prophecy\Argument; class AliasSubscriberSpec extends ObjectBehavior { @@ -31,10 +32,10 @@ public function let( $config ); - $config->getConfig('alias')->willReturn(array( + $config->getConfig('alias')->willReturn([ 'ls' => 'list:command', 'mv' => 'move', - )); + ]); } public function it_should_convert_an_aliased_input_into_a_real_command_input( diff --git a/spec/PHPCR/Shell/Transport/Transport/DoctrineDbalSpec.php b/spec/PHPCR/Shell/Transport/Transport/DoctrineDbalSpec.php index 8e86400b..8cda7edf 100644 --- a/spec/PHPCR/Shell/Transport/Transport/DoctrineDbalSpec.php +++ b/spec/PHPCR/Shell/Transport/Transport/DoctrineDbalSpec.php @@ -7,6 +7,7 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace spec\PHPCR\Shell\Transport\Transport; diff --git a/spec/PHPCR/Shell/Transport/Transport/JackrabbitSpec.php b/spec/PHPCR/Shell/Transport/Transport/JackrabbitSpec.php index 10e73b9d..c9fc5199 100644 --- a/spec/PHPCR/Shell/Transport/Transport/JackrabbitSpec.php +++ b/spec/PHPCR/Shell/Transport/Transport/JackrabbitSpec.php @@ -7,6 +7,7 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace spec\PHPCR\Shell\Transport\Transport; diff --git a/spec/PHPCR/Shell/Transport/TransportRegistrySpec.php b/spec/PHPCR/Shell/Transport/TransportRegistrySpec.php index 65848219..2cb78c95 100644 --- a/spec/PHPCR/Shell/Transport/TransportRegistrySpec.php +++ b/spec/PHPCR/Shell/Transport/TransportRegistrySpec.php @@ -7,12 +7,13 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace spec\PHPCR\Shell\Transport; -use PhpSpec\ObjectBehavior; use PHPCR\Shell\Transport\TransportInterface; +use PhpSpec\ObjectBehavior; class TransportRegistrySpec extends ObjectBehavior { @@ -23,8 +24,7 @@ public function it_is_initializable() public function it_can_register_transports( TransportInterface $transport - ) - { + ) { $transport->getName()->willReturn('foobar'); $this->register($transport); } @@ -32,22 +32,20 @@ public function it_can_register_transports( public function it_can_return_the_names_of_the_transports( TransportInterface $transport1, TransportInterface $transport2 - ) - { + ) { $transport1->getName()->willReturn('transport1'); $transport2->getName()->willReturn('transport2'); $this->register($transport1); $this->register($transport2); - $this->getTransportNames()->shouldReturn(array( - 'transport1', 'transport2' - )); + $this->getTransportNames()->shouldReturn([ + 'transport1', 'transport2', + ]); } public function it_can_return_a_named_transport_object( TransportInterface $transport - ) - { + ) { $transport->getName()->willReturn('test'); $this->register($transport); diff --git a/src/PHPCR/Shell/Config/Config.php b/src/PHPCR/Shell/Config/Config.php index df770a0c..a3f8952c 100644 --- a/src/PHPCR/Shell/Config/Config.php +++ b/src/PHPCR/Shell/Config/Config.php @@ -7,12 +7,13 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Config; /** - * Configuration profile object + * Configuration profile object. */ class Config implements \ArrayAccess, \Iterator { diff --git a/src/PHPCR/Shell/Config/ConfigManager.php b/src/PHPCR/Shell/Config/ConfigManager.php index f64d29de..e585cea2 100644 --- a/src/PHPCR/Shell/Config/ConfigManager.php +++ b/src/PHPCR/Shell/Config/ConfigManager.php @@ -7,16 +7,17 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Config; -use Symfony\Component\Yaml\Yaml; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Filesystem\Filesystem; +use Symfony\Component\Yaml\Yaml; /** - * Configuration manager + * Configuration manager. * * @author Daniel Leech */ @@ -28,20 +29,20 @@ class ConfigManager * * @var array */ - protected $configKeys = array( + protected $configKeys = [ 'alias', 'phpcrsh', - ); + ]; /** - * Cached configuration + * Cached configuration. * * @var array */ protected $cachedConfig = null; /** - * Filesystem + * Filesystem. * * @var Filesystem */ @@ -70,7 +71,7 @@ public function __construct($questionHelper, Filesystem $filesystem = null) } /** - * Return the configuration directory + * Return the configuration directory. * * @return string */ @@ -106,25 +107,25 @@ public function getConfigDir() private function getDistConfigDir() { - return __DIR__ . '/../Resources/config.dist'; + return __DIR__.'/../Resources/config.dist'; } /** - * Load the configuration + * Load the configuration. */ public function loadConfig() { - $config = array(); + $config = []; $configDir = $this->getConfigDir(); $distConfigDir = $this->getDistConfigDir(); foreach ($this->configKeys as $configKey) { - $fullPath = $configDir . '/' . $configKey . '.yml'; - $fullDistPath = $distConfigDir . '/' . $configKey . '.yml'; - $config[$configKey] = array(); + $fullPath = $configDir.'/'.$configKey.'.yml'; + $fullDistPath = $distConfigDir.'/'.$configKey.'.yml'; + $config[$configKey] = []; - $userConfig = array(); + $userConfig = []; if ($this->filesystem->exists($fullPath)) { $userConfig = Yaml::parse(file_get_contents($fullPath)); } @@ -150,7 +151,7 @@ public function loadConfig() } /** - * Return the configuration + * Return the configuration. * * @return array */ @@ -171,7 +172,7 @@ public function getPhpcrshConfig() } /** - * Initialize a configuration files + * Initialize a configuration files. */ public function initConfig(OutputInterface $output = null, $noInteraction = false) { @@ -189,28 +190,28 @@ public function initConfig(OutputInterface $output = null, $noInteraction = fals $distDir = $this->getDistConfigDir(); if (!$this->filesystem->exists($configDir)) { - $log('[+] Creating directory: ' . $configDir); + $log('[+] Creating directory: '.$configDir); $this->filesystem->mkdir($configDir); } - $configFilenames = array( + $configFilenames = [ 'alias.yml', 'phpcrsh.yml', - ); + ]; foreach ($configFilenames as $configFilename) { - $srcFile = $distDir . '/' . $configFilename; - $destFile = $configDir . '/' . $configFilename; + $srcFile = $distDir.'/'.$configFilename; + $destFile = $configDir.'/'.$configFilename; if (!$this->filesystem->exists($srcFile)) { - throw new \Exception('Dist (source) file "' . $srcFile . '" does not exist.'); + throw new \Exception('Dist (source) file "'.$srcFile.'" does not exist.'); } if ($this->filesystem->exists($destFile)) { if (false === $noInteraction) { $confirmed = $this->questionHelper->askConfirmation( $output, - '"' . $configFilename . '" already exists, do you want to overwrite it?' + '"'.$configFilename.'" already exists, do you want to overwrite it?' ); if (!$confirmed) { @@ -222,7 +223,7 @@ public function initConfig(OutputInterface $output = null, $noInteraction = fals } $this->filesystem->copy($srcFile, $destFile); - $log('[+] Creating file: ' . $destFile); + $log('[+] Creating file: '.$destFile); } } } diff --git a/src/PHPCR/Shell/Config/Exception/FileExistsException.php b/src/PHPCR/Shell/Config/Exception/FileExistsException.php index 04c2d5d0..b7cb2479 100644 --- a/src/PHPCR/Shell/Config/Exception/FileExistsException.php +++ b/src/PHPCR/Shell/Config/Exception/FileExistsException.php @@ -7,6 +7,7 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Config\Exception; diff --git a/src/PHPCR/Shell/Config/Profile.php b/src/PHPCR/Shell/Config/Profile.php index 0771b027..67e4cd60 100644 --- a/src/PHPCR/Shell/Config/Profile.php +++ b/src/PHPCR/Shell/Config/Profile.php @@ -7,19 +7,20 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Config; /** - * Configuration profile object + * Configuration profile object. */ class Profile { - protected $profile = array( - 'transport' => array(), - 'phpcr' => array(), - ); + protected $profile = [ + 'transport' => [], + 'phpcr' => [], + ]; protected $name; @@ -29,7 +30,7 @@ public function __construct($name = null) } /** - * Return the array data for this profile + * Return the array data for this profile. * * @return array */ @@ -49,12 +50,11 @@ protected function validateDomain($domain) } /** - * Set a domain configuration + * Set a domain configuration. * - * @param string $domain + * @param string $domain * @param $key * @param array|null $value - * */ public function set($domain, $key, $value = null) { @@ -67,12 +67,13 @@ public function set($domain, $key, $value = null) } /** - * Get a domain configuration + * Get a domain configuration. * * @param string $domain * @param string $key * * @throws \InvalidArgumentException + * * @return array */ public function get($domain, $key = null) @@ -94,7 +95,7 @@ public function get($domain, $key = null) } /** - * Return the name of this profile + * Return the name of this profile. * * @return string $name */ diff --git a/src/PHPCR/Shell/Config/ProfileLoader.php b/src/PHPCR/Shell/Config/ProfileLoader.php index ed7bf62f..25864162 100644 --- a/src/PHPCR/Shell/Config/ProfileLoader.php +++ b/src/PHPCR/Shell/Config/ProfileLoader.php @@ -7,6 +7,7 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Config; @@ -48,12 +49,12 @@ public function getProfileNames() $dir = $this->getProfileDir(); if (false === $this->filesystem->exists($dir)) { - return array(); + return []; } $files = Finder::create()->files()->name('*.yml')->in($dir); - $profiles = array(); + $profiles = []; foreach ($files as $file) { $profiles[] = substr($file->getBasename(), 0, -4); } diff --git a/src/PHPCR/Shell/Console/Application/EmbeddedApplication.php b/src/PHPCR/Shell/Console/Application/EmbeddedApplication.php index 83139443..7795a5d0 100644 --- a/src/PHPCR/Shell/Console/Application/EmbeddedApplication.php +++ b/src/PHPCR/Shell/Console/Application/EmbeddedApplication.php @@ -7,18 +7,19 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Application; +use PHPCR\Shell\Console\Input\StringInput; use PHPCR\Shell\DependencyInjection\Container; use PHPCR\Shell\PhpcrShell; -use PHPCR\Shell\Console\Input\StringInput; use Symfony\Component\Console\Output\OutputInterface; /** * Subclass of the full ShellApplication for running as an EmbeddedApplication - * (e.g. from with the DoctrinePhpcrBundle) + * (e.g. from with the DoctrinePhpcrBundle). * * @author Daniel Leech */ @@ -34,7 +35,7 @@ public function __construct(Container $container) } /** - * {@inheritDoc} + * {@inheritdoc} */ public function init() { @@ -46,7 +47,7 @@ public function init() } /** - * {@inheritDoc} + * {@inheritdoc} */ protected function getDefaultCommand() { @@ -56,6 +57,7 @@ protected function getDefaultCommand() public function runWithStringInput($stringInput, OutputInterface $output) { $input = new StringInput($stringInput); + return $this->run($input, $output); } } diff --git a/src/PHPCR/Shell/Console/Application/SessionApplication.php b/src/PHPCR/Shell/Console/Application/SessionApplication.php index 01c83784..1d713a86 100644 --- a/src/PHPCR/Shell/Console/Application/SessionApplication.php +++ b/src/PHPCR/Shell/Console/Application/SessionApplication.php @@ -7,16 +7,17 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Application; -use Symfony\Component\Console\Application as BaseApplication; -use Symfony\Component\Console\Input\InputDefinition; -use Symfony\Component\Console\Input\InputInterface; use PHPCR\Shell\Console\Command\ShellCommand; use PHPCR\Shell\DependencyInjection\Container; use PHPCR\Shell\PhpcrShell; +use Symfony\Component\Console\Application as BaseApplication; +use Symfony\Component\Console\Input\InputDefinition; +use Symfony\Component\Console\Input\InputInterface; /** * This application wraps a single command which accepts @@ -46,14 +47,14 @@ public function __construct() public function getDefaultInputDefinition() { - return new InputDefinition(array()); + return new InputDefinition([]); } /** * This application always runs the phpcr_shell command to connect * to the shell. * - * {@inheritDoc} + * {@inheritdoc} */ protected function getCommandName(InputInterface $input) { @@ -61,7 +62,7 @@ protected function getCommandName(InputInterface $input) } /** - * Return the shell application + * Return the shell application. * * @return ShellApplication */ diff --git a/src/PHPCR/Shell/Console/Application/Shell.php b/src/PHPCR/Shell/Console/Application/Shell.php index 2d788588..6b8227cf 100644 --- a/src/PHPCR/Shell/Console/Application/Shell.php +++ b/src/PHPCR/Shell/Console/Application/Shell.php @@ -7,16 +7,17 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Application; +use PHPCR\Shell\Console\Input\StringInput; use Symfony\Component\Console\Application; use Symfony\Component\Console\Output\ConsoleOutput; -use PHPCR\Shell\Console\Input\StringInput; /** - * This is more or less a copy of the Symfony\Component\Shell + * This is more or less a copy of the Symfony\Component\Shell. * * @author Daniel Leech */ @@ -55,7 +56,7 @@ public function run() if ($this->hasReadline) { readline_read_history($this->history); - readline_completion_function(array($this, 'autocompleter')); + readline_completion_function([$this, 'autocompleter']); } $this->output->writeln($this->getHeader()); @@ -106,7 +107,7 @@ protected function getHeader() * * @param string $text The last segment of the entered text * - * @return Boolean|array A list of guessed strings or true + * @return bool|array A list of guessed strings or true */ private function autocompleter($text) { diff --git a/src/PHPCR/Shell/Console/Application/ShellApplication.php b/src/PHPCR/Shell/Console/Application/ShellApplication.php index 2e7f1cc4..ae7d94cc 100644 --- a/src/PHPCR/Shell/Console/Application/ShellApplication.php +++ b/src/PHPCR/Shell/Console/Application/ShellApplication.php @@ -7,10 +7,19 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Application; +use PHPCR\Shell\Config\Profile; +use PHPCR\Shell\Console\Command\Phpcr as CommandPhpcr; +use PHPCR\Shell\Console\Command\Phpcr\BasePhpcrCommand; +use PHPCR\Shell\Console\Command\Shell as CommandShell; +use PHPCR\Shell\Event; +use PHPCR\Shell\Event\ApplicationInitEvent; +use PHPCR\Shell\Event\PhpcrShellEvents; +use PHPCR\Shell\PhpcrShell; use Symfony\Component\Console\Application; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Formatter\OutputFormatter; @@ -20,24 +29,16 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\DependencyInjection\ContainerAwareInterface; use Symfony\Component\EventDispatcher\EventDispatcher; -use PHPCR\Shell\Console\Command\Phpcr as CommandPhpcr; -use PHPCR\Shell\Console\Command\Shell as CommandShell; -use PHPCR\Shell\Event; -use PHPCR\Shell\Event\ApplicationInitEvent; -use PHPCR\Shell\Event\PhpcrShellEvents; -use PHPCR\Shell\Config\Profile; -use PHPCR\Shell\PhpcrShell; -use PHPCR\Shell\Console\Command\Phpcr\BasePhpcrCommand; /** - * Main application for PHPCRSH + * Main application for PHPCRSH. * * @author Daniel Leech */ class ShellApplication extends Application { /** - * @var boolean + * @var bool */ protected $showUnsupported = false; @@ -47,19 +48,19 @@ class ShellApplication extends Application protected $container; /** - * @var boolean + * @var bool */ protected $debug = false; /** - * @var boolean + * @var bool */ protected $initialized = false; /** - * Constructor - name and version inherited from SessionApplication + * Constructor - name and version inherited from SessionApplication. * - * {@inheritDoc} + * {@inheritdoc} */ public function __construct($container) { @@ -73,7 +74,7 @@ public function __construct($container) * If true, show all commands, even if they are unsupported by the * transport. * - * @param boolean $boolean + * @param bool $boolean */ public function setShowUnsupported($boolean) { @@ -81,7 +82,7 @@ public function setShowUnsupported($boolean) } /** - * Initialize the application + * Initialize the application. */ public function init() { @@ -99,7 +100,7 @@ public function init() } /** - * Register the commands used in the shell + * Register the commands used in the shell. */ protected function registerPhpcrCommands() { @@ -193,43 +194,43 @@ protected function registerShellCommands() } /** - * Configure the output formatter + * Configure the output formatter. */ private function configureFormatter(OutputFormatter $formatter) { - $style = new OutputFormatterStyle('yellow', null, array('bold')); + $style = new OutputFormatterStyle('yellow', null, ['bold']); $formatter->setStyle('pathbold', $style); $style = new OutputFormatterStyle('green'); $formatter->setStyle('localname', $style); - $style = new OutputFormatterStyle(null, null, array('bold')); + $style = new OutputFormatterStyle(null, null, ['bold']); $formatter->setStyle('node', $style); - $style = new OutputFormatterStyle('blue', null, array('bold')); + $style = new OutputFormatterStyle('blue', null, ['bold']); $formatter->setStyle('templatenode', $style); - $style = new OutputFormatterStyle('blue', null, array()); + $style = new OutputFormatterStyle('blue', null, []); $formatter->setStyle('templateproperty', $style); - $style = new OutputFormatterStyle(null, null, array()); + $style = new OutputFormatterStyle(null, null, []); $formatter->setStyle('property', $style); - $style = new OutputFormatterStyle('magenta', null, array('bold')); + $style = new OutputFormatterStyle('magenta', null, ['bold']); $formatter->setStyle('node-type', $style); - $style = new OutputFormatterStyle('magenta', null, array()); + $style = new OutputFormatterStyle('magenta', null, []); $formatter->setStyle('property-type', $style); - $style = new OutputFormatterStyle(null, null, array()); + $style = new OutputFormatterStyle(null, null, []); $formatter->setStyle('property-value', $style); - $style = new OutputFormatterStyle(null, 'red', array()); + $style = new OutputFormatterStyle(null, 'red', []); $formatter->setStyle('exception', $style); } /** - * {@inheritDoc} + * {@inheritdoc} */ public function doRun(InputInterface $input, OutputInterface $output) { @@ -245,7 +246,7 @@ public function doRun(InputInterface $input, OutputInterface $output) $input = $event->getInput(); if (!$name) { - $input = new ArrayInput(array('command' => $this->getDefaultCommand())); + $input = new ArrayInput(['command' => $this->getDefaultCommand()]); } try { @@ -260,7 +261,7 @@ public function doRun(InputInterface $input, OutputInterface $output) } /** - * Return the default command + * Return the default command. */ protected function getDefaultCommand() { @@ -271,7 +272,7 @@ protected function getDefaultCommand() * Wrap the add method and do not register commands which are unsupported by * the current transport. * - * {@inheritDoc} + * {@inheritdoc} */ public function add(Command $command) { @@ -299,11 +300,12 @@ public function dispatchProfileInitEvent(InputInterface $sessionInput, OutputInt * If autocomplete is invoked before a command has been run, then * we need to initialize the application (and register the commands). * - * {@inheritDoc} + * {@inheritdoc} */ public function all($namespace = null) { $this->init(); + return parent::all($namespace); } @@ -313,7 +315,7 @@ public function getContainer() } /** - * Return if the shell is in debug mode + * Return if the shell is in debug mode. */ public function isDebug() { @@ -321,7 +323,7 @@ public function isDebug() } /** - * Debug mode -- more verbose exceptions + * Debug mode -- more verbose exceptions. */ public function setDebug($debug) { diff --git a/src/PHPCR/Shell/Console/Command/BaseCommand.php b/src/PHPCR/Shell/Console/Command/BaseCommand.php index 25cf3304..4f4bc8a6 100644 --- a/src/PHPCR/Shell/Console/Command/BaseCommand.php +++ b/src/PHPCR/Shell/Console/Command/BaseCommand.php @@ -7,6 +7,7 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command; diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/AccessControlPrivilegeListCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/AccessControlPrivilegeListCommand.php index 969c2c88..f265f347 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/AccessControlPrivilegeListCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/AccessControlPrivilegeListCommand.php @@ -7,16 +7,17 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; -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; use PHPCR\Shell\Console\Helper\Table; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Output\OutputInterface; class AccessControlPrivilegeListCommand extends BasePhpcrCommand { @@ -26,7 +27,7 @@ protected function configure() $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(<<setHelp(<<<'HERE' NOTE: This command is not supported by Jackrabbit. List the privileges of the current session or the node at the given path. @@ -67,10 +68,10 @@ public function execute(InputInterface $input, OutputInterface $output) } $table = new Table($output); - $table->setHeaders(array('Name')); + $table->setHeaders(['Name']); foreach ($privileges as $privilege) { - $table->addRow(array($privilege->getName())); + $table->addRow([$privilege->getName()]); } } } diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/BasePhpcrCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/BasePhpcrCommand.php index d4b0f901..7df614aa 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/BasePhpcrCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/BasePhpcrCommand.php @@ -7,22 +7,22 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; -use PHPCR\Shell\Console\Helper\RepositoryHelper; use PHPCR\Shell\Console\Command\BaseCommand; /** - * Base command for all PHPCR action commands + * Base command for all PHPCR action commands. * * @author Daniel Leech */ class BasePhpcrCommand extends BaseCommand { - protected $descriptorRequires = array(); - protected $descriptorDequires = array(); + protected $descriptorRequires = []; + protected $descriptorDequires = []; public function requiresDescriptor($descriptorKey, $value = null) { diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/BaseQueryCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/BaseQueryCommand.php index f2383725..18975e49 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/BaseQueryCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/BaseQueryCommand.php @@ -7,14 +7,12 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ 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 PHPCR\Util\QOM\Sql2ToQomQueryConverter; class BaseQueryCommand extends BasePhpcrCommand { diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/LockInfoCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/LockInfoCommand.php index 563bc5f8..8aba5d59 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/LockInfoCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/LockInfoCommand.php @@ -7,15 +7,16 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Input\InputArgument; use PHPCR\RepositoryInterface; use PHPCR\Shell\Console\Helper\Table; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; class LockInfoCommand extends BasePhpcrCommand { @@ -24,7 +25,7 @@ protected function configure() $this->setName('lock:info'); $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(<<setHelp(<<<'HERE' Shows the details of the lock that applies to the node at the specified path. @@ -46,20 +47,20 @@ public function execute(InputInterface $input, OutputInterface $output) $lock = $lockManager->getLock($path); - $info = array( - 'Lock owner' => $lock->getLockOwner(), - 'Lock token' => $lock->getLockToken(), - 'Seconds remaining' => $lock->getSecondsRemaining(), - 'Deep?' => $lock->isDeep() ? 'yes' : 'no', - 'Live?' => $lock->isLove() ? 'yes' : 'no', + $info = [ + 'Lock owner' => $lock->getLockOwner(), + 'Lock token' => $lock->getLockToken(), + 'Seconds remaining' => $lock->getSecondsRemaining(), + 'Deep?' => $lock->isDeep() ? 'yes' : 'no', + 'Live?' => $lock->isLove() ? 'yes' : 'no', 'Owned by current session?' => $lock->isLockOwningSession() ? 'yes' : 'no', - 'Session scoped?' => $lock->isSessionScoped() ? 'yes' : 'no', - ); + 'Session scoped?' => $lock->isSessionScoped() ? 'yes' : 'no', + ]; $table = new Table($output); foreach ($info as $label => $value) { - $table->addRow(array($label, $value)); + $table->addRow([$label, $value]); } $table->render($output); diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/LockLockCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/LockLockCommand.php index 4fe72982..6ea1e201 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/LockLockCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/LockLockCommand.php @@ -7,15 +7,16 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Output\OutputInterface; +use PHPCR\RepositoryInterface; use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; -use PHPCR\RepositoryInterface; +use Symfony\Component\Console\Output\OutputInterface; class LockLockCommand extends BasePhpcrCommand { @@ -28,7 +29,7 @@ protected function configure() $this->addOption('session-scoped', null, InputOption::VALUE_NONE, 'If given, this lock expires with the current session; if not it expires when explicitly or automatically unlocked for some other reason'); $this->addOption('timeout', null, InputOption::VALUE_REQUIRED, 'Desired lock timeout in seconds (servers are free to ignore this value). If not used lock will not timeout'); $this->addOption('owner-info', null, InputOption::VALUE_REQUIRED, ' string containing owner information supplied by the client; servers are free to ignore this value. If none is specified, the implementation chooses one (i.e. user name of current backend authentication credentials'); - $this->setHelp(<<setHelp(<<<'HERE' Places a lock on the node at path. If successful, the node is said to hold the lock. diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/LockRefreshCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/LockRefreshCommand.php index f158cad7..2298276f 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/LockRefreshCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/LockRefreshCommand.php @@ -7,15 +7,16 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; +use PHPCR\RepositoryInterface; use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Input\InputArgument; -use PHPCR\RepositoryInterface; class LockRefreshCommand extends BasePhpcrCommand { @@ -24,7 +25,7 @@ protected function configure() $this->setName('lock:refresh'); $this->setDescription('Refresh the TTL of the lock of the node at the given path'); $this->addArgument('path', InputArgument::REQUIRED, 'Path of node containing the lock to be refreshed'); - $this->setHelp(<<setHelp(<<<'HERE' If this lock's time-to-live is governed by a timer, this command resets that timer so that the lock does not timeout and expire. diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/LockTokenAddCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/LockTokenAddCommand.php index 59f0413e..296466d9 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/LockTokenAddCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/LockTokenAddCommand.php @@ -7,14 +7,15 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; +use PHPCR\RepositoryInterface; +use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Input\InputArgument; -use PHPCR\RepositoryInterface; class LockTokenAddCommand extends BasePhpcrCommand { @@ -23,7 +24,7 @@ protected function configure() $this->setName('lock:token:add'); $this->setDescription('Add a lock token to the current session'); $this->addArgument('lockToken', InputArgument::REQUIRED, 'Lock token'); - $this->setHelp(<<setHelp(<<<'HERE' Adds the specified lock token to the current Session. Holding a lock token makes the current Session the owner of the lock diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/LockTokenListCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/LockTokenListCommand.php index a253bbd7..988924c4 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/LockTokenListCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/LockTokenListCommand.php @@ -7,14 +7,15 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Output\OutputInterface; use PHPCR\RepositoryInterface; use PHPCR\Shell\Console\Helper\Table; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; class LockTokenListCommand extends BasePhpcrCommand { @@ -22,7 +23,7 @@ protected function configure() { $this->setName('lock:token:list'); $this->setDescription('List a lock token to the current session'); - $this->setHelp(<<setHelp(<<<'HERE' Show a list of previously registered tokens. Displays all lock tokens currently held by the @@ -43,10 +44,10 @@ public function execute(InputInterface $input, OutputInterface $output) $lockTokens = $lockManager->getLockTokens(); $table = new Table($output); - $table->setHeaders(array('Token')); + $table->setHeaders(['Token']); foreach ($lockTokens as $token) { - $table->addRow(array($token)); + $table->addRow([$token]); } $table->render($output); diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/LockTokenRemoveCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/LockTokenRemoveCommand.php index 9992f618..66c6cda9 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/LockTokenRemoveCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/LockTokenRemoveCommand.php @@ -7,14 +7,15 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; +use PHPCR\RepositoryInterface; +use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Input\InputArgument; -use PHPCR\RepositoryInterface; class LockTokenRemoveCommand extends BasePhpcrCommand { @@ -23,7 +24,7 @@ protected function configure() $this->setName('lock:token:remove'); $this->setDescription('Remove a lock token to the current session'); $this->addArgument('lockToken', InputArgument::REQUIRED, 'Lock token'); - $this->setHelp(<<setHelp(<<<'HERE' Removes the specified lock token from the current Session. HERE ); diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/LockUnlockCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/LockUnlockCommand.php index 98a8c2bb..d094c655 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/LockUnlockCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/LockUnlockCommand.php @@ -7,14 +7,15 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; +use PHPCR\RepositoryInterface; +use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Input\InputArgument; -use PHPCR\RepositoryInterface; class LockUnlockCommand extends BasePhpcrCommand { @@ -23,7 +24,7 @@ protected function configure() $this->setName('lock:unlock'); $this->setDescription('Unlock the node at the given path'); $this->addArgument('path', InputArgument::REQUIRED, 'Path of node'); - $this->setHelp(<<setHelp(<<<'HERE' Removes the lock on the node at path. Also removes the properties jcr:lockOwner and jcr:lockIsDeep from that diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/NodeCloneCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/NodeCloneCommand.php index 6421e565..0403251b 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/NodeCloneCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/NodeCloneCommand.php @@ -7,14 +7,15 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Output\OutputInterface; class NodeCloneCommand extends BasePhpcrCommand { @@ -26,7 +27,7 @@ protected function configure() $this->addArgument('destPath', InputArgument::REQUIRED, 'Path to destination node'); $this->addArgument('srcWorkspace', InputArgument::OPTIONAL, 'If specified, copy from this workspace'); $this->addOption('remove-existing', null, InputOption::VALUE_NONE, 'Remove existing nodes'); - $this->setHelp(<<setHelp(<<<'HERE' Clones the subgraph at the node srcAbsPath in srcWorkspace to the new location at destAbsPath in the current workspace. diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/NodeCopyCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/NodeCopyCommand.php index 095f5789..9b1b2979 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/NodeCopyCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/NodeCopyCommand.php @@ -7,13 +7,14 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; +use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Input\InputArgument; class NodeCopyCommand extends BasePhpcrCommand { @@ -24,7 +25,7 @@ protected function configure() $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'); - $this->setHelp(<<setHelp(<<<'HERE' Copies a Node including its children to a new location to the given workspace. This method copies the subgraph rooted at, and including, the node at diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/NodeCorrespondingCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/NodeCorrespondingCommand.php index 34f07efd..1204d366 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/NodeCorrespondingCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/NodeCorrespondingCommand.php @@ -7,13 +7,14 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; +use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Input\InputArgument; class NodeCorrespondingCommand extends BasePhpcrCommand { @@ -23,7 +24,7 @@ protected function configure() $this->setDescription('Show the path for the current nodes corresponding path in named workspace'); $this->addArgument('path', InputArgument::REQUIRED, 'Path of node'); $this->addArgument('workspaceName', InputArgument::REQUIRED, 'The name of the workspace'); - $this->setHelp(<<setHelp(<<<'HERE' Returns the absolute path of the node in the specified workspace that corresponds to this node. HERE diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/NodeCreateCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/NodeCreateCommand.php index 975f33ca..1151cd82 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/NodeCreateCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/NodeCreateCommand.php @@ -7,13 +7,14 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; +use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Input\InputArgument; class NodeCreateCommand extends BasePhpcrCommand { @@ -23,7 +24,7 @@ protected function configure() $this->setDescription('Create a node at the current path'); $this->addArgument('path', InputArgument::REQUIRED, 'Path of node to create'); $this->addArgument('primaryNodeTypeName', InputArgument::OPTIONAL, 'Optional name of primary node type to use'); - $this->setHelp(<<setHelp(<<<'HERE' Creates a new node at the specified path This is session-write method, meaning that the addition of the new node diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/NodeEditCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/NodeEditCommand.php index 147fc28d..bbf0b0d8 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/NodeEditCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/NodeEditCommand.php @@ -7,19 +7,20 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Input\InputArgument; +use PHPCR\PathNotFoundException; use PHPCR\Shell\Serializer\NodeNormalizer; -use Symfony\Component\Serializer\Serializer; use PHPCR\Shell\Serializer\YamlEncoder; -use Symfony\Component\Console\Input\InputOption; -use PHPCR\PathNotFoundException; use PHPCR\Util\UUIDHelper; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Serializer\Serializer; class NodeEditCommand extends BasePhpcrCommand { @@ -29,7 +30,7 @@ protected function configure() $this->setDescription('Edit the given node in the EDITOR configured by the system'); $this->addArgument('path', InputArgument::REQUIRED, 'Path of node'); $this->addOption('type', null, InputOption::VALUE_REQUIRED, 'Optional type to use when creating new nodes', 'nt:unstructured'); - $this->setHelp(<<setHelp(<<<'HERE' Edit or create a node at the given path using the default editor as defined by the EDITOR environment variable. When you invoke the command a temporary file in YAML format will be created on the filesystem. This file will @@ -74,9 +75,9 @@ public function execute(InputInterface $input, OutputInterface $output) $noRecurse = true; // for now we only support YAML - $encoders = array(new YamlEncoder()); + $encoders = [new YamlEncoder()]; $nodeNormalizer = new NodeNormalizer(); - $serializer = new Serializer(array($nodeNormalizer), $encoders); + $serializer = new Serializer([$nodeNormalizer], $encoders); $outStr = $serializer->serialize($node, 'yaml'); $tryAgain = false; @@ -87,22 +88,20 @@ public function execute(InputInterface $input, OutputInterface $output) do { $message = ''; if ($error) { - $template = <<deserialize($inStr, 'PHPCR\NodeInterface', 'yaml', array( + $norm = $serializer->deserialize($inStr, 'PHPCR\NodeInterface', 'yaml', [ 'node' => $node, - )); + ]); $tryAgain = false; } catch (\Exception $e) { $error = $e->getMessage(); - $output->writeln('' . $error . ''); + $output->writeln(''.$error.''); if (false === $input->getOption('no-interaction')) { $tryAgain = $dialog->askConfirmation($output, 'Do you want to try again? (y/n)'); } diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/NodeFileImportCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/NodeFileImportCommand.php index 5e8560e2..8d6b028c 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/NodeFileImportCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/NodeFileImportCommand.php @@ -7,16 +7,17 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Input\InputArgument; +use PHPCR\PathNotFoundException; use PHPCR\PropertyType; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; -use PHPCR\PathNotFoundException; +use Symfony\Component\Console\Output\OutputInterface; class NodeFileImportCommand extends BasePhpcrCommand { @@ -34,7 +35,7 @@ protected function configure() $this->addOption('mime-type', null, InputOption::VALUE_REQUIRED, 'Mime type (optional, auto-detected)'); $this->addOption('force', null, InputOption::VALUE_NONE, 'Force overwriting any existing node'); $this->addOption('no-container', null, InputOption::VALUE_NONE, 'Do not wrap in a JCR nt:file, but write directly to the specified property'); - $this->setHelp(<<setHelp(<<<'HERE' Import an external file into the repository. The file will be imported as a node of built-in type nt:file. diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/NodeInfoCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/NodeInfoCommand.php index 5549b383..c891141e 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/NodeInfoCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/NodeInfoCommand.php @@ -7,14 +7,15 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; +use PHPCR\Shell\Console\Helper\Table; +use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Input\InputArgument; -use PHPCR\Shell\Console\Helper\Table; class NodeInfoCommand extends BasePhpcrCommand { @@ -23,7 +24,7 @@ protected function configure() $this->setName('node:info'); $this->setDescription('Show information about the current node'); $this->addArgument('path', InputArgument::REQUIRED, 'Path of node'); - $this->setHelp(<<setHelp(<<<'HERE' Show information about the node(s) at the given path: PHPCRSH> node:info path/to/node @@ -44,7 +45,7 @@ public function execute(InputInterface $input, OutputInterface $output) foreach ($nodes as $node) { $mixins = $node->getMixinNodeTypes(); - $mixinNodeTypeNames = array(); + $mixinNodeTypeNames = []; foreach ($mixins as $mixin) { $mixinNodeTypeNames[] = $mixin->getName(); @@ -66,20 +67,20 @@ public function execute(InputInterface $input, OutputInterface $output) $isLocked = $formatter->formatException($e); } - $info = array( - 'UUID' => $node->hasProperty('jcr:uuid') ? $node->getProperty('jcr:uuid')->getValue() : 'N/A', - 'Index' => $node->getIndex(), + $info = [ + 'UUID' => $node->hasProperty('jcr:uuid') ? $node->getProperty('jcr:uuid')->getValue() : 'N/A', + 'Index' => $node->getIndex(), 'Primary node type' => $node->getPrimaryNodeType()->getName(), - 'Mixin node types' => implode(', ', $mixinNodeTypeNames), - 'Checked out?' => $isCheckedOut, - 'Locked?' => $isLocked, - ); + 'Mixin node types' => implode(', ', $mixinNodeTypeNames), + 'Checked out?' => $isCheckedOut, + 'Locked?' => $isLocked, + ]; - $output->writeln('' . $node->getPath() . ''); + $output->writeln(''.$node->getPath().''); $table = new Table($output); foreach ($info as $label => $value) { - $table->addRow(array($label, $value)); + $table->addRow([$label, $value]); } $table->render($output); diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/NodeLifecycleFollowCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/NodeLifecycleFollowCommand.php index 576a41e8..2322e916 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/NodeLifecycleFollowCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/NodeLifecycleFollowCommand.php @@ -7,15 +7,16 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; +use PHPCR\RepositoryInterface; use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Input\InputArgument; -use PHPCR\RepositoryInterface; class NodeLifecycleFollowCommand extends BasePhpcrCommand { @@ -25,7 +26,7 @@ protected function configure() $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(<<setHelp(<<<'HERE' Causes the lifecycle state of the current node to undergo the specified transition. diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/NodeLifecycleListCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/NodeLifecycleListCommand.php index ce6bb3d1..395a2af6 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/NodeLifecycleListCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/NodeLifecycleListCommand.php @@ -7,14 +7,15 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; +use PHPCR\RepositoryInterface; +use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Input\InputArgument; -use PHPCR\RepositoryInterface; class NodeLifecycleListCommand extends BasePhpcrCommand { @@ -23,7 +24,7 @@ protected function configure() $this->setName('node:lifecycle:list'); $this->setDescription('Returns the list of valid state transitions for this node.'); $this->addArgument('path', InputArgument::REQUIRED, 'Path of node'); - $this->setHelp(<<setHelp(<<<'HERE' Returns the list of valid state transitions for this node. HERE ); @@ -39,7 +40,7 @@ public function execute(InputInterface $input, OutputInterface $output) $transitions = $currentNode->getAllowedLifecycleTransitions(); foreach ($transitions as $transition) { - $output->writeln('' . $transition . ''); + $output->writeln(''.$transition.''); } } } diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/NodeListCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/NodeListCommand.php index f721376c..58867091 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/NodeListCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/NodeListCommand.php @@ -7,24 +7,25 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ 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\PropertyType; use PHPCR\ItemNotFoundException; -use PHPCR\PropertyInterface; use PHPCR\NodeInterface; +use PHPCR\PropertyInterface; +use PHPCR\PropertyType; use PHPCR\Shell\Console\Helper\Table; +use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Output\OutputInterface; class NodeListCommand extends BasePhpcrCommand { - protected $sortOptions = array('none', 'asc', 'desc'); + protected $sortOptions = ['none', 'asc', 'desc']; protected $formatter; protected $textHelper; @@ -46,7 +47,7 @@ protected function configure() 'Sort properties, one of: %s', implode(', ', $this->sortOptions) ), 'asc'); - $this->setHelp(<<setHelp(<<<'HERE' List both or one of the children and properties of this node. Multiple levels can be shown by using the --level option. @@ -92,7 +93,7 @@ public function execute(InputInterface $input, OutputInterface $output) $path = $input->getArgument('path'); try { - $nodes = array($session->getNodeByPathOrIdentifier($path)); + $nodes = [$session->getNodeByPathOrIdentifier($path)]; $filter = null; } catch (\Exception $e) { if (!$globHelper->isGlobbed($session->getAbsPath($path))) { @@ -119,7 +120,7 @@ public function execute(InputInterface $input, OutputInterface $output) foreach ($nodes as $node) { $table = new Table($output); - $this->renderNode($node, $table, array(), $filter); + $this->renderNode($node, $table, [], $filter); if ($table->getNumberOfRows() > 0) { $this->nbNodes++; @@ -142,7 +143,7 @@ public function execute(InputInterface $input, OutputInterface $output) } } - private function renderNode($currentNode, $table, $spacers = array(), $filter = null) + private function renderNode($currentNode, $table, $spacers = [], $filter = null) { if ($this->showChildren) { $this->renderChildren($currentNode, $table, $spacers, $filter); @@ -161,7 +162,7 @@ private function renderChildren($currentNode, $table, $spacers, $filter = null) $nodeType = $currentNode->getPrimaryNodeType(); $childNodeDefinitions = $nodeType->getDeclaredChildNodeDefinitions(); - $childNodeNames = array(); + $childNodeNames = []; foreach ($childNodeDefinitions as $childNodeDefinition) { $childNodeNames[$childNodeDefinition->getName()] = $childNodeDefinition; } @@ -187,11 +188,11 @@ private function renderChildren($currentNode, $table, $spacers, $filter = null) $isLast = count($children) === $i; - $table->addRow(array( - '' . implode('', $spacers) . $this->formatter->formatNodeName($child) . '', + $table->addRow([ + ''.implode('', $spacers).$this->formatter->formatNodeName($child).'', $child->getPrimaryNodeType()->getName(), $primaryItemValue, - )); + ]); if (count($spacers) < $this->maxLevel) { $newSpacers = $spacers; @@ -210,11 +211,11 @@ private function renderChildren($currentNode, $table, $spacers, $filter = null) // render empty schematic children foreach ($childNodeNames as $childNodeName => $childNodeDefinition) { // @todo: Determine and show cardinality, 1..*, *..*, 0..1, etc. - $table->addRow(array( - '' . implode('', $spacers) . '@' . $childNodeName . '', + $table->addRow([ + ''.implode('', $spacers).'@'.$childNodeName.'', implode('|', $childNodeDefinition->getRequiredPrimaryTypeNames()), '', - )); + ]); } } } @@ -233,7 +234,7 @@ private function renderProperties($currentNode, $table, $spacers, $filter = null $nodeType = $currentNode->getPrimaryNodeType(); $propertyDefinitions = $nodeType->getDeclaredPropertyDefinitions(); - $propertyNames = array(); + $propertyNames = []; foreach ($propertyDefinitions as $name => $propertyDefinition) { $propertyNames[$propertyDefinition->getName()] = $propertyDefinition; } @@ -249,27 +250,27 @@ private function renderProperties($currentNode, $table, $spacers, $filter = null $valueCell = $this->formatter->formatValue($property); } catch (\Exception $e) { - $valueCell = '' . $e->getMessage() . ''; + $valueCell = ''.$e->getMessage().''; } - $table->addRow(array( - '' . implode('', $spacers). $name . '', + $table->addRow([ + ''.implode('', $spacers).$name.'', sprintf( '%s (%s)', $this->formatter->getPropertyTypeName($property->getType()), - implode(',', (array) $property->getLength()) ? : '0' + implode(',', (array) $property->getLength()) ?: '0' ), $valueCell, - )); + ]); } if ($this->showTemplate) { foreach ($propertyNames as $propertyName => $property) { - $table->addRow(array( - '' . implode('', $spacers). '@' . $propertyName . '', - '' . strtoupper(PropertyType::nameFromValue($property->getRequiredType())) . '', + $table->addRow([ + ''.implode('', $spacers).'@'.$propertyName.'', + ''.strtoupper(PropertyType::nameFromValue($property->getRequiredType())).'', '', - )); + ]); } } } @@ -279,10 +280,12 @@ private function sort($array) switch ($this->sort) { case 'asc': ksort($array); + return $array; case 'desc': ksort($array); $array = array_reverse($array); + return $array; } diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/NodeMixinAddCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/NodeMixinAddCommand.php index 9760bd0e..0fd3a79e 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/NodeMixinAddCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/NodeMixinAddCommand.php @@ -7,13 +7,14 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; +use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Input\InputArgument; class NodeMixinAddCommand extends BasePhpcrCommand { @@ -23,7 +24,7 @@ protected function configure() $this->setDescription('Add the named mixin to the node (can include wildcards)'); $this->addArgument('path', InputArgument::REQUIRED, 'Path of node'); $this->addArgument('mixinName', InputArgument::REQUIRED, 'The name of the mixin node type to be added'); - $this->setHelp(<<setHelp(<<<'HERE' Adds the mixin node type named mixinName to the node(s) inferred by the path. If this node is already of type mixinName (either due to a previously diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/NodeMixinRemoveCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/NodeMixinRemoveCommand.php index 6e8d1c3c..9122deef 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/NodeMixinRemoveCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/NodeMixinRemoveCommand.php @@ -7,13 +7,14 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; +use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Input\InputArgument; class NodeMixinRemoveCommand extends BasePhpcrCommand { @@ -23,7 +24,7 @@ protected function configure() $this->setDescription('Remove the named mixin to the current node'); $this->addArgument('path', InputArgument::REQUIRED, 'Path of node (can include wildcards)'); $this->addArgument('mixinName', InputArgument::REQUIRED, 'The name of the mixin node type to be removeed'); - $this->setHelp(<<setHelp(<<<'HERE' Removes the specified mixin node type from this node and removes mixinName from this node's jcr:mixinTypes property. diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/NodeMoveCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/NodeMoveCommand.php index 6394edee..82bcbeb7 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/NodeMoveCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/NodeMoveCommand.php @@ -7,14 +7,15 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Input\InputArgument; class NodeMoveCommand extends BasePhpcrCommand { @@ -24,7 +25,7 @@ protected function configure() $this->setDescription('Move a node in the current session'); $this->addArgument('srcPath', InputArgument::REQUIRED, 'The root of the subgraph to be moved.'); $this->addArgument('destPath', InputArgument::REQUIRED, 'The location to which the subgraph is to be moved'); - $this->setHelp(<<setHelp(<<<'HERE' Moves the node at srcPath (and its entire subgraph) to the new location at destPath. diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/NodeOrderBeforeCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/NodeOrderBeforeCommand.php index af24ac74..e57d79c7 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/NodeOrderBeforeCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/NodeOrderBeforeCommand.php @@ -7,13 +7,14 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; +use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Input\InputArgument; class NodeOrderBeforeCommand extends BasePhpcrCommand { @@ -24,7 +25,7 @@ protected function configure() $this->addArgument('path', InputArgument::REQUIRED, 'Path of node'); $this->addArgument('srcChildRelPath', InputArgument::REQUIRED, 'The relative path to the child node to be moved in the ordering'); $this->addArgument('destChildRelPath', InputArgument::REQUIRED, 'The relative path to the child before which the node srcChildRelPath will be placed'); - $this->setHelp(<<setHelp(<<<'HERE' This command is used to change the order of a child node relative to the current node. For example, given that the node /foobar has the children child2 and diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/NodePropertyRemoveCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/NodePropertyRemoveCommand.php index 63f08bac..dab10f41 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/NodePropertyRemoveCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/NodePropertyRemoveCommand.php @@ -7,14 +7,15 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; +use PHPCR\PathNotFoundException; +use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Input\InputArgument; -use PHPCR\PathNotFoundException; class NodePropertyRemoveCommand extends BasePhpcrCommand { @@ -23,7 +24,7 @@ protected function configure() $this->setName('node:property:remove'); $this->setDescription('Remove the property at the given absolute path'); $this->addArgument('absPath', InputArgument::REQUIRED, 'Absolute path to property'); - $this->setHelp(<<setHelp(<<<'HERE' Remove the property from the current session at the given path HERE ); diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/NodePropertySetCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/NodePropertySetCommand.php index 12cbe3b8..3ac731f3 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/NodePropertySetCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/NodePropertySetCommand.php @@ -7,17 +7,18 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; -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\PropertyType; use PHPCR\PathNotFoundException; +use PHPCR\PropertyType; use PHPCR\Util\UUIDHelper; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Output\OutputInterface; class NodePropertySetCommand extends BasePhpcrCommand { @@ -28,7 +29,7 @@ protected function configure() $this->addArgument('path', InputArgument::REQUIRED, 'Path of property - parent path can include wildcards'); $this->addArgument('value', InputArgument::OPTIONAL, 'Value for named property'); $this->addOption('type', null, InputOption::VALUE_REQUIRED, 'Type of named property'); - $this->setHelp(<<setHelp(<<<'HERE' Defines or set a value for a property identified by its name. PHPCRSH> node:property:set . propname "some value" --type="String" diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/NodePropertyShowCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/NodePropertyShowCommand.php index 8ee16c34..8416063b 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/NodePropertyShowCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/NodePropertyShowCommand.php @@ -7,14 +7,15 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; +use PHPCR\PathNotFoundException; +use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Input\InputArgument; -use PHPCR\PathNotFoundException; class NodePropertyShowCommand extends BasePhpcrCommand { @@ -23,7 +24,7 @@ protected function configure() $this->setName('node:property:show'); $this->setDescription('Show the property at the given path'); $this->addArgument('path', InputArgument::REQUIRED, 'Path to property (can include wildcards)'); - $this->setHelp(<<setHelp(<<<'HERE' Show the full value of a property at the given path HERE ); @@ -42,18 +43,18 @@ public function execute(InputInterface $input, OutputInterface $output) $nodes = $session->findNodes($parentPath); if (0 === count($nodes)) { - throw new \Exception('Could not find property(s) at path ' . $path); + throw new \Exception('Could not find property(s) at path '.$path); } foreach ($nodes as $node) { try { - $properties = array($node->getProperty($filter)); + $properties = [$node->getProperty($filter)]; } catch (PathNotFoundException $e) { $properties = $node->getProperties($filter); } if (0 === count($properties)) { - throw new \Exception('Could not find property(s) at path ' . $path); + throw new \Exception('Could not find property(s) at path '.$path); } foreach ($properties as $property) { diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/NodeReferencesCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/NodeReferencesCommand.php index 6467753a..c7fc66fd 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/NodeReferencesCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/NodeReferencesCommand.php @@ -7,15 +7,16 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; +use PHPCR\Shell\Console\Helper\Table; use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Input\InputArgument; -use PHPCR\Shell\Console\Helper\Table; class NodeReferencesCommand extends BasePhpcrCommand { @@ -25,7 +26,7 @@ protected function configure() $this->setDescription('Returns all REFERENCE properties that refer to this node'); $this->addArgument('path', InputArgument::REQUIRED, 'Path of node (can include wildcard)'); $this->addArgument('name', InputArgument::OPTIONAL, 'Limit references to given name'); - $this->setHelp(<<setHelp(<<<'HERE' This command returns all REFERENCE properties that refer to this node, have the specified name and that are accessible through the current Session. @@ -45,33 +46,33 @@ public function execute(InputInterface $input, OutputInterface $output) $nodes = $session->findNodes($path); foreach ($nodes as $node) { - $references = array( - 'weak' => array(), - 'strong' => array(), - ); + $references = [ + 'weak' => [], + 'strong' => [], + ]; $references['weak'] = $node->getWeakReferences($name ?: null); $references['strong'] = $node->getReferences($name ?: null); $table = new Table($output); - $table->setHeaders(array( + $table->setHeaders([ 'Path', 'Property', 'Type', - )); + ]); foreach ($references as $type => $typeReferences) { foreach ($typeReferences as $property) { $nodePath = $property->getParent()->getPath(); - $table->addRow(array( + $table->addRow([ $nodePath, $property->getName(), $type, - )); + ]); } } if (0 !== count($references['weak']) || 0 !== count($references['strong'])) { - $output->writeln('' . $node->getPath() . ''); + $output->writeln(''.$node->getPath().''); $table->render($output); } } diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/NodeRemoveCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/NodeRemoveCommand.php index b95dd021..944a20fd 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/NodeRemoveCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/NodeRemoveCommand.php @@ -7,14 +7,15 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Output\OutputInterface; class NodeRemoveCommand extends BasePhpcrCommand { @@ -24,7 +25,7 @@ protected function configure() $this->setDescription('Remove the node at path (can include wildcards)'); $this->addArgument('path', InputArgument::REQUIRED, 'Path of node'); $this->addOption('shared', null, InputOption::VALUE_NONE, 'Remove nodes in shared set'); - $this->setHelp(<<setHelp(<<<'HERE' Remove the node at the given path. If the `--shared` option is specified then any nodes within this nodes @@ -39,7 +40,7 @@ public function execute(InputInterface $input, OutputInterface $output) $session = $this->get('phpcr.session'); $path = $input->getArgument('path'); $currentPath = $session->getCwd(); - $nodePaths = array(); + $nodePaths = []; // verify that node exists by trying to get it.. $nodes = $session->findNodes($path); @@ -54,7 +55,7 @@ public function execute(InputInterface $input, OutputInterface $output) $references = $node->getReferences(); if (count($references) > 0) { - $paths = array(); + $paths = []; foreach ($references as $reference) { $paths[] = $reference->getPath(); } diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/NodeRenameCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/NodeRenameCommand.php index ddbf8710..c53cfe9d 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/NodeRenameCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/NodeRenameCommand.php @@ -7,13 +7,14 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; +use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Input\InputArgument; class NodeRenameCommand extends BasePhpcrCommand { @@ -23,7 +24,7 @@ protected function configure() $this->setDescription('Rename the node at the current path'); $this->addArgument('path', InputArgument::REQUIRED, 'Path of node'); $this->addArgument('newName', InputArgument::REQUIRED, 'The name of the node to create'); - $this->setHelp(<<setHelp(<<<'HERE' Renames this node to the specified newName. The ordering (if any) of this node among it siblings remains unchanged. diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/NodeSetPrimaryTypeCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/NodeSetPrimaryTypeCommand.php index 89e92049..98465fc0 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/NodeSetPrimaryTypeCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/NodeSetPrimaryTypeCommand.php @@ -7,13 +7,14 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; +use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Input\InputArgument; class NodeSetPrimaryTypeCommand extends BasePhpcrCommand { @@ -23,7 +24,7 @@ protected function configure() $this->setDescription('Set the primary type of the current node'); $this->addArgument('path', InputArgument::REQUIRED, 'Path of node (can include wildcard)'); $this->addArgument('nodeTypeName', InputArgument::REQUIRED, 'New primary node type name'); - $this->setHelp(<<setHelp(<<<'HERE' Changes the primary node type of this node to nodeTypeName. Also immediately changes this node's jcr:primaryType property diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/NodeSharedShowCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/NodeSharedShowCommand.php index 662314a3..50e4f9e2 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/NodeSharedShowCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/NodeSharedShowCommand.php @@ -7,14 +7,15 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; +use PHPCR\RepositoryInterface; +use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Input\InputArgument; -use PHPCR\RepositoryInterface; class NodeSharedShowCommand extends BasePhpcrCommand { @@ -23,7 +24,7 @@ protected function configure() $this->setName('node:shared:show'); $this->setDescription('Show all the nodes are in the shared set of this node'); $this->addArgument('path', InputArgument::REQUIRED, 'Path of node (can include wildcard)'); - $this->setHelp(<<setHelp(<<<'HERE' Lists all nodes that are in the shared set of this node. Shareable nodes are analagous to symbolic links in a linux filesystem and can @@ -43,7 +44,7 @@ public function execute(InputInterface $input, OutputInterface $output) $nodes = $session->findNodes($path); foreach ($nodes as $node) { - $output->writeln('' . $node->getPath() . ''); + $output->writeln(''.$node->getPath().''); $sharedSet = $node->getSharedSet(); foreach ($sharedSet as $sharedNode) { diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/NodeTypeEditCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/NodeTypeEditCommand.php index c9f456ba..f6236bb7 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/NodeTypeEditCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/NodeTypeEditCommand.php @@ -7,17 +7,18 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; +use PHPCR\NodeType\NoSuchNodeTypeException; +use PHPCR\Util\CND\Parser\CndParser; +use PHPCR\Util\CND\Writer\CndWriter; use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Input\InputArgument; 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; class NodeTypeEditCommand extends BasePhpcrCommand { @@ -26,7 +27,7 @@ protected function configure() $this->setName('node-type:edit'); $this->setDescription('Edit or create a node type'); $this->addArgument('nodeTypeName', InputArgument::REQUIRED, 'The name of the node type to edit or create'); - $this->setHelp(<<setHelp(<<<'HERE' Edit the given node type name with the editor defined in the EDITOR environment variable. If the node type does not exist, it will be created. All node types must be prefixed with @@ -52,7 +53,7 @@ public function execute(InputInterface $input, OutputInterface $output) try { $nodeType = $nodeTypeManager->getNodeType($nodeTypeName); $cndWriter = new CndWriter($namespaceRegistry); - $out = $cndWriter->writeString(array($nodeType)); + $out = $cndWriter->writeString([$nodeType]); $message = null; } catch (NoSuchNodeTypeException $e) { $parts = explode(':', $nodeTypeName); @@ -62,7 +63,7 @@ public function execute(InputInterface $input, OutputInterface $output) 'Node type names must be prefixed with a namespace, e.g. ns:foobar' ); } - list($namespace, $name) = $parts; + list($namespace, $name) = $parts; $uri = $session->getNamespaceURI($namespace); // so we will create one .. @@ -70,12 +71,10 @@ public function execute(InputInterface $input, OutputInterface $output) <$namespace ='$uri'> [$namespace:$name] > nt:unstructured -EOT - ; +EOT; $message = <<getMessage(); diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/NodeTypeListCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/NodeTypeListCommand.php index 0fc9da8d..d616051e 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/NodeTypeListCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/NodeTypeListCommand.php @@ -7,14 +7,15 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; +use PHPCR\Shell\Console\Helper\Table; +use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Input\InputArgument; -use PHPCR\Shell\Console\Helper\Table; class NodeTypeListCommand extends BasePhpcrCommand { @@ -23,7 +24,7 @@ protected function configure() $this->setName('node-type:list'); $this->setDescription('List registered node types'); $this->addArgument('filter', InputArgument::OPTIONAL, 'Perl regexp pattern'); - $this->setHelp(<<setHelp(<<<'HERE' List all node types (both primary and mixins) a filter can be optionally passed: PHPCRSH> node-type:list --filter mix:.* @@ -42,20 +43,20 @@ public function execute(InputInterface $input, OutputInterface $output) $nodeTypes = $nodeTypeManager->getAllNodeTypes(); $table = new Table($output); - $table->setHeaders(array('Name', 'Primary Item Name', 'Abstract?', 'Mixin?', 'Queryable?')); + $table->setHeaders(['Name', 'Primary Item Name', 'Abstract?', 'Mixin?', 'Queryable?']); foreach ($nodeTypes as $nodeType) { - if ($filter && !preg_match('{' . $filter . '}', $nodeType->getName())) { + if ($filter && !preg_match('{'.$filter.'}', $nodeType->getName())) { continue; } - $table->addRow(array( + $table->addRow([ $nodeType->getName(), $nodeType->getPrimaryItemName(), $nodeType->isAbstract() ? 'yes' : 'no', $nodeType->isMixin() ? 'yes' : 'no', $nodeType->isQueryable() ? 'yes' : 'no', - )); + ]); } $table->render($output); diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/NodeTypeLoadCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/NodeTypeLoadCommand.php index 63848ca1..89bd886c 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/NodeTypeLoadCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/NodeTypeLoadCommand.php @@ -7,15 +7,16 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ 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\InputInterface; use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Output\OutputInterface; class NodeTypeLoadCommand extends BasePhpcrCommand { @@ -25,7 +26,7 @@ protected function configure() $this->setDescription('Load or create a node type'); $this->addOption('update', null, InputOption::VALUE_NONE, 'Update existing node type'); $this->addArgument('cndFile', InputArgument::REQUIRED, 'The name file containing the CND data'); - $this->setHelp(<<setHelp(<<<'HERE' This command allows to register node types in the repository that are defined in a CND (Compact Namespace and Node Type Definition) file as used by jackrabbit. diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/NodeTypeShowCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/NodeTypeShowCommand.php index 618b028d..ac8b6668 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/NodeTypeShowCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/NodeTypeShowCommand.php @@ -7,15 +7,16 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; +use PHPCR\NodeType\NoSuchNodeTypeException; +use PHPCR\Util\CND\Writer\CndWriter; +use Symfony\Component\Console\Input\InputArgument; 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 NodeTypeShowCommand extends BasePhpcrCommand { @@ -24,7 +25,7 @@ protected function configure() $this->setName('node-type:show'); $this->setDescription('Show the CND of a node type'); $this->addArgument('nodeTypeName', InputArgument::REQUIRED, 'The name of the node type to show'); - $this->setHelp(<<setHelp(<<<'HERE' Show the CND (Compact Node Definition) of a given node type. HERE ); @@ -45,7 +46,7 @@ public function execute(InputInterface $input, OutputInterface $output) 'The node type "%s" does not exist', $nodeTypeName)); } $cndWriter = new CndWriter($namespaceRegistry); - $out = $cndWriter->writeString(array($nodeType)); + $out = $cndWriter->writeString([$nodeType]); $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 534890d8..d7133532 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/NodeTypeUnregisterCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/NodeTypeUnregisterCommand.php @@ -7,13 +7,14 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; +use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Input\InputArgument; class NodeTypeUnregisterCommand extends BasePhpcrCommand { @@ -22,7 +23,7 @@ protected function configure() $this->setName('node-type:unregister'); $this->setDescription('Unregister a node type UNSUPPORTED / TODO'); $this->addArgument('nodeTypeName', InputArgument::REQUIRED, 'The name of the node type to unregister'); - $this->setHelp(<<setHelp(<<<'HERE' Unregisters the specified node type HERE ); @@ -38,6 +39,6 @@ public function execute(InputInterface $input, OutputInterface $output) $namespaceRegistry = $workspace->getNamespaceRegistry(); $nodeTypeManager = $workspace->getNodeTypeManager(); - $nodeType = $nodeTypeManager->unregisterNodeTypes(array($nodeTypeName)); + $nodeType = $nodeTypeManager->unregisterNodeTypes([$nodeTypeName]); } } diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/NodeUpdateCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/NodeUpdateCommand.php index e876364a..64de3f34 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/NodeUpdateCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/NodeUpdateCommand.php @@ -7,13 +7,14 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; +use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Input\InputArgument; class NodeUpdateCommand extends BasePhpcrCommand { @@ -23,7 +24,7 @@ protected function configure() $this->setDescription('Updates a node corresponding to the given path in the given workspace'); $this->addArgument('path', InputArgument::REQUIRED, 'Path of node (can include wildcards)'); $this->addArgument('srcWorkspace', InputArgument::REQUIRED, 'The name of the source workspace'); - $this->setHelp(<<setHelp(<<<'HERE' Updates a node corresponding to the current one in the given workspace. If this node does have a corresponding node in the workspace @@ -52,7 +53,7 @@ public function execute(InputInterface $input, OutputInterface $output) $nodes = $session->findNodes($path); foreach ($nodes as $node) { - $output->writeln('' . $node->getPath() . ''); + $output->writeln(''.$node->getPath().''); $node->update($srcWorkspace); } } diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/QueryCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/QueryCommand.php index cbe50e07..82d116e2 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/QueryCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/QueryCommand.php @@ -7,15 +7,16 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Input\InputArgument; class QueryCommand extends BasePhpcrCommand { @@ -27,7 +28,7 @@ protected function configure() $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(<<setHelp(<<<'EOT' Execute an SQL query. This command differs from select in that it is executed conventionally and not literally. The advantage is that you can specify a specific query language and additional options: @@ -52,7 +53,7 @@ public function execute(InputInterface $input, OutputInterface $output) throw new \InvalidArgumentException(sprintf( '"%s" is an invalid query language, valid query languages are:%s', $language, - PHP_EOL . ' -' . implode(PHP_EOL . ' - ', $supportedQueryLanguages) + PHP_EOL.' -'.implode(PHP_EOL.' - ', $supportedQueryLanguages) )); } diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/QueryDeleteCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/QueryDeleteCommand.php index 9b62237a..ae820c5d 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/QueryDeleteCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/QueryDeleteCommand.php @@ -7,14 +7,15 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; +use PHPCR\Util\QOM\Sql2ToQomQueryConverter; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use PHPCR\Util\QOM\Sql2ToQomQueryConverter; class QueryDeleteCommand extends BaseQueryCommand { @@ -23,7 +24,7 @@ protected function configure() $this->setName('delete'); $this->setDescription('Execute a DELETE query (non standard)'); $this->addArgument('query'); - $this->setHelp(<<setHelp(<<<'EOT' Execute a DELETE query. Unlike other commands you can enter a query literally: DELETE FROM [nt:unstructured] WHERE title = 'foo'; @@ -49,7 +50,7 @@ public function execute(InputInterface $input, OutputInterface $output) $session = $this->get('phpcr.session'); $qm = $session->getWorkspace()->getQueryManager(); - $sql = 'SELECT * FROM' . substr($sql, 11); + $sql = 'SELECT * FROM'.substr($sql, 11); $selectParser = new Sql2ToQomQueryConverter($qm->getQOMFactory()); $query = $selectParser->parse($sql); diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/QuerySelectCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/QuerySelectCommand.php index 74f35b1d..1b50bf5e 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/QuerySelectCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/QuerySelectCommand.php @@ -7,6 +7,7 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; @@ -22,7 +23,7 @@ protected function configure() $this->setName('select'); $this->setDescription('Execute a SELECT query (JCR-SQL2)'); $this->addArgument('query'); - $this->setHelp(<<setHelp(<<<'EOT' Execute a JCR-SQL2 query. Unlike other commands you can enter a query literally: SELECT * FROM [nt:unstructured]; diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/QueryUpdateCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/QueryUpdateCommand.php index 79848749..8a93ca12 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/QueryUpdateCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/QueryUpdateCommand.php @@ -7,15 +7,15 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; +use PHPCR\Shell\Query\UpdateParser; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use PHPCR\Shell\Query\UpdateParser; -use PHPCR\Shell\Query\UpdateProcessor; class QueryUpdateCommand extends BaseQueryCommand { @@ -29,7 +29,7 @@ protected function configure() $this->setName('update'); $this->setDescription('Execute an UPDATE query (non-standard)'); $this->addArgument('query'); - $this->setHelp(<<setHelp(<<<'EOT' Execute a PHPCR-Shell JCR-SQL2 update query. You can enter a query literally: UPDATE [nt:unstructured] AS a SET title = 'foobar' WHERE a.title = 'barfoo'; diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/RepositoryDescriptorListCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/RepositoryDescriptorListCommand.php index d810d2f7..12a9fe5d 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/RepositoryDescriptorListCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/RepositoryDescriptorListCommand.php @@ -7,14 +7,15 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; +use PHPCR\Shell\Console\Helper\Table; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use PHPCR\Shell\Console\Helper\Table; class RepositoryDescriptorListCommand extends BasePhpcrCommand { @@ -22,7 +23,7 @@ protected function configure() { $this->setName('repository:descriptor:list'); $this->setDescription('List the descriptors for the current repository'); - $this->setHelp(<<setHelp(<<<'HERE' Repositories indicate support for the JCR specification via. descriptors. This command lists all of the descriptor keys and values for the current repository. HERE @@ -36,7 +37,7 @@ public function execute(InputInterface $input, OutputInterface $output) $keys = $repository->getDescriptorKeys(); $table = new Table($output); - $table->setHeaders(array('Key', 'Value', 'Standard?')); + $table->setHeaders(['Key', 'Value', 'Standard?']); foreach ($keys as $key) { $descriptor = $repository->getDescriptor($key); @@ -44,11 +45,11 @@ public function execute(InputInterface $input, OutputInterface $output) if (is_array($descriptor)) { $descriptor = implode(', ', $this->getDescriptorValue($descriptor)); } - $table->addRow(array( + $table->addRow([ $key, $this->getDescriptorValue($descriptor), $isStandard ? 'yes' : 'no', - )); + ]); } $table->render($output); diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/RetentionHoldAddCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/RetentionHoldAddCommand.php index f309455f..00907b7b 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/RetentionHoldAddCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/RetentionHoldAddCommand.php @@ -7,15 +7,16 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Output\OutputInterface; +use PHPCR\RepositoryInterface; use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; -use PHPCR\RepositoryInterface; +use Symfony\Component\Console\Output\OutputInterface; class RetentionHoldAddCommand extends BasePhpcrCommand { @@ -26,7 +27,7 @@ protected function configure() $this->addArgument('absPath', InputArgument::REQUIRED, 'Absolute path to node to which we want to add a hold'); $this->addArgument('name', InputArgument::REQUIRED, 'Name of hold to add'); $this->addOption('deep', null, InputOption::VALUE_NONE, 'Apply hold also to the children of specified node.'); - $this->setHelp(<<setHelp(<<<'HERE' Places a hold on the existing node at absPath. If the is-deep is true the hold applies to this node and its diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/RetentionHoldListCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/RetentionHoldListCommand.php index 01416452..8f75997e 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/RetentionHoldListCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/RetentionHoldListCommand.php @@ -7,15 +7,16 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Input\InputArgument; use PHPCR\RepositoryInterface; use PHPCR\Shell\Console\Helper\Table; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; class RetentionHoldListCommand extends BasePhpcrCommand { @@ -24,7 +25,7 @@ protected function configure() $this->setName('retention:hold:list'); $this->setDescription('List retention holds at given absolute path UNSUPPORTED'); $this->addArgument('absPath', InputArgument::REQUIRED, 'Absolute path to node to which we want to add a hold'); - $this->setHelp(<<setHelp(<<<'HERE' Lists all hold object names that have been added to the existing node at absPath. HERE @@ -41,10 +42,10 @@ public function execute(InputInterface $input, OutputInterface $output) $holds = $retentionManager->getHolds($absPath); $table = new Table($output); - $table->setHeaders(array('Name')); + $table->setHeaders(['Name']); foreach ($holds as $hold) { - $table->addRow(array($hold->getName())); + $table->addRow([$hold->getName()]); } $table->render($output); diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/RetentionHoldRemoveCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/RetentionHoldRemoveCommand.php index 65ed6d79..74e13ff7 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/RetentionHoldRemoveCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/RetentionHoldRemoveCommand.php @@ -7,14 +7,15 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; +use PHPCR\RepositoryInterface; +use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Input\InputArgument; -use PHPCR\RepositoryInterface; class RetentionHoldRemoveCommand extends BasePhpcrCommand { @@ -24,7 +25,7 @@ protected function configure() $this->setDescription('Removes a retention hold UNSUPPORTED'); $this->addArgument('absPath', InputArgument::REQUIRED, 'Absolute path to node to which we want to remove a hold'); $this->addArgument('name', InputArgument::REQUIRED, 'Name of hold to remove'); - $this->setHelp(<<setHelp(<<<'HERE' Removes the specified hold from the node at absPath. The removal does not take effect until a save is performed. @@ -42,7 +43,7 @@ public function execute(InputInterface $input, OutputInterface $output) $name = $input->getArgument('name'); $holds = $retentionManager->getHolds($absPath); - $indexed = array(); + $indexed = []; foreach ($holds as $hold) { $indexed[$hold->getName()] = $hold; } diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/RetentionPolicyGetCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/RetentionPolicyGetCommand.php index 85450e22..d7ed9a0b 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/RetentionPolicyGetCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/RetentionPolicyGetCommand.php @@ -7,14 +7,15 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; +use PHPCR\RepositoryInterface; +use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Input\InputArgument; -use PHPCR\RepositoryInterface; class RetentionPolicyGetCommand extends BasePhpcrCommand { @@ -23,7 +24,7 @@ protected function configure() $this->setName('retention:policy:get'); $this->setDescription('Get a retention policy for specified node UNSUPPORTED'); $this->addArgument('absPath', InputArgument::REQUIRED, 'Absolute path to node'); - $this->setHelp(<<setHelp(<<<'HERE' Gets the retention policy of a node identified by its path. HERE ); diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/RetentionPolicyRemoveCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/RetentionPolicyRemoveCommand.php index 9e43c1db..a5149c87 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/RetentionPolicyRemoveCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/RetentionPolicyRemoveCommand.php @@ -7,14 +7,15 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; +use PHPCR\RepositoryInterface; +use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Input\InputArgument; -use PHPCR\RepositoryInterface; class RetentionPolicyRemoveCommand extends BasePhpcrCommand { @@ -23,7 +24,7 @@ protected function configure() $this->setName('retention:policy:remove'); $this->setDescription('Remove a retention policy for specified node UNSUPPORTED'); $this->addArgument('absPath', InputArgument::REQUIRED, 'Absolute path to node'); - $this->setHelp(<<setHelp(<<<'HERE' Removes the retention policy of a node identified by its path. HERE ); diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/SessionExportCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/SessionExportCommand.php index face0e67..2add3660 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/SessionExportCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/SessionExportCommand.php @@ -7,15 +7,16 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Output\OutputInterface; +use PHPCR\Util\PathHelper; use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; -use PHPCR\Util\PathHelper; +use Symfony\Component\Console\Output\OutputInterface; class SessionExportCommand extends BasePhpcrCommand { @@ -29,7 +30,7 @@ protected function configure() $this->addOption('skip-binary', null, InputOption::VALUE_NONE, 'Skip binary properties'); $this->addOption('document', null, InputOption::VALUE_NONE, 'Export the document view'); $this->addOption('pretty', null, InputOption::VALUE_NONE, 'Export in human readable format'); - $this->setHelp(<<setHelp(<<<'HERE' Export the node at the given path to the named XML file. By default the entire subgraph of the node will be exported unless the --no-recurse option diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/SessionImpersonateCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/SessionImpersonateCommand.php index b762c0de..c3f663fb 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/SessionImpersonateCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/SessionImpersonateCommand.php @@ -7,15 +7,16 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; +use PHPCR\SimpleCredentials; use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Input\InputArgument; -use PHPCR\SimpleCredentials; class SessionImpersonateCommand extends BasePhpcrCommand { @@ -24,7 +25,7 @@ protected function configure() $this->setName('session:impersonate'); $this->setDescription('Impersonate the given user'); $this->addArgument('username', InputArgument::REQUIRED, 'Username of user to impersonate'); - $this->setHelp(<<setHelp(<<<'HERE' Note: This command is not implemented by any of the transports currently. Returns a new session in accordance with the specified (new) diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/SessionImportCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/SessionImportCommand.php index 41f97283..72b238f0 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/SessionImportCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/SessionImportCommand.php @@ -7,25 +7,25 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ 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 PHPCR\Util\PathHelper; use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; -use PHPCR\Util\PathHelper; +use Symfony\Component\Console\Output\OutputInterface; class SessionImportCommand extends BasePhpcrCommand { - protected $uuidBehaviors = array( + protected $uuidBehaviors = [ 'create-new', 'collision-remove-existing', 'collision-replace-existing', 'collision-throw', - ); + ]; protected function configure() { @@ -34,7 +34,7 @@ protected function configure() $this->addArgument('parentAbsPath', InputArgument::REQUIRED, 'Path of node to export'); $this->addArgument('file', InputArgument::REQUIRED, 'File to import from'); $this->addOption('uuid-behavior', null, InputOption::VALUE_REQUIRED, 'UUID behavior', 'create-new'); - $this->setHelp(<<setHelp(<<<'HERE' Import the specified XML document into the current session as a child of the node specified by the parentAbsPath argument. @@ -89,7 +89,7 @@ public function execute(InputInterface $input, OutputInterface $output) throw new \Exception(sprintf( "The specified uuid behavior \"%s\" is invalid, you should use one of:\n%s", $uuidBehavior, - ' - ' . implode("\n - ", $this->uuidBehaviors) + ' - '.implode("\n - ", $this->uuidBehaviors) )); } @@ -101,7 +101,7 @@ public function execute(InputInterface $input, OutputInterface $output) PathHelper::assertValidAbsolutePath($parentAbsPath); - $uuidBehavior = constant('\PHPCR\ImportUUIDBehaviorInterface::IMPORT_UUID_' . strtoupper(str_replace('-', '_', $uuidBehavior))); + $uuidBehavior = constant('\PHPCR\ImportUUIDBehaviorInterface::IMPORT_UUID_'.strtoupper(str_replace('-', '_', $uuidBehavior))); $session->importXml($parentAbsPath, $file, $uuidBehavior); } diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/SessionInfoCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/SessionInfoCommand.php index 4b09d0a4..21137f46 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/SessionInfoCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/SessionInfoCommand.php @@ -7,14 +7,15 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; +use PHPCR\Shell\Console\Helper\Table; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use PHPCR\Shell\Console\Helper\Table; class SessionInfoCommand extends BasePhpcrCommand { @@ -22,7 +23,7 @@ protected function configure() { $this->setName('session:info'); $this->setDescription('Display information about current session'); - $this->setHelp(<<setHelp(<<<'HERE' The command shows some basic information about the current session. HERE ); @@ -33,24 +34,24 @@ public function execute(InputInterface $input, OutputInterface $output) $session = $this->get('phpcr.session'); $repository = $session->getRepository(); - $info = array( - 'user id' => $session->getUserID(), - 'live' => $session->isLive() ? 'yes' : 'no', - 'workspace name' => $session->getWorkspace()->getName(), - 'jcr repository name' => $repository->getDescriptor('jcr.repository.name'), - 'jcr repository vendor' => $repository->getDescriptor('jcr.repository.vendor'), + $info = [ + 'user id' => $session->getUserID(), + 'live' => $session->isLive() ? 'yes' : 'no', + 'workspace name' => $session->getWorkspace()->getName(), + 'jcr repository name' => $repository->getDescriptor('jcr.repository.name'), + 'jcr repository vendor' => $repository->getDescriptor('jcr.repository.vendor'), 'jcr repository version' => $repository->getDescriptor('jcr.repository.version'), - ); + ]; foreach ($session->getAttributeNames() as $attributeName) { $attribute = $session->getAttribute($attributeName); } $table = new Table($output); - $table->setHeaders(array('Key', 'Value')); + $table->setHeaders(['Key', 'Value']); foreach ($info as $key => $value) { - $table->addRow(array($key, $value)); + $table->addRow([$key, $value]); } $table->render($output); diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/SessionLoginCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/SessionLoginCommand.php index 6c72d15c..b11c6493 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/SessionLoginCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/SessionLoginCommand.php @@ -7,13 +7,14 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; +use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Input\InputArgument; class SessionLoginCommand extends BasePhpcrCommand { @@ -24,7 +25,7 @@ protected function configure() $this->addArgument('userId', InputArgument::REQUIRED, 'Unique identifier of user'); $this->addArgument('password', InputArgument::REQUIRED, 'Password'); $this->addArgument('workspaceName', InputArgument::OPTIONAL, 'Optional workspace name'); - $this->setHelp(<<setHelp(<<<'HERE' Login to a session. HERE ); diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/SessionLogoutCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/SessionLogoutCommand.php index 9fefa9f8..d6efc76e 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/SessionLogoutCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/SessionLogoutCommand.php @@ -7,6 +7,7 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; @@ -21,7 +22,7 @@ protected function configure() { $this->setName('session:logout'); $this->setDescription('Logout of the current session'); - $this->setHelp(<<setHelp(<<<'HERE' Releases all resources associated with this Session. This command should be called when a Session is no longer needed. diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/SessionNamespaceListCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/SessionNamespaceListCommand.php index e85d9552..c0abaf03 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/SessionNamespaceListCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/SessionNamespaceListCommand.php @@ -7,13 +7,14 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; +use PHPCR\Shell\Console\Helper\Table; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use PHPCR\Shell\Console\Helper\Table; class SessionNamespaceListCommand extends BasePhpcrCommand { @@ -21,7 +22,7 @@ protected function configure() { $this->setName('session:namespace:list'); $this->setDescription('List all namespace prefix to URI mappings in current session'); - $this->setHelp(<<setHelp(<<<'HERE' List all namespace prefix to URI mappings in current session HERE ); @@ -33,11 +34,11 @@ public function execute(InputInterface $input, OutputInterface $output) $prefixes = $session->getNamespacePrefixes(); $table = new Table($output); - $table->setHeaders(array('Prefix', 'URI')); + $table->setHeaders(['Prefix', 'URI']); foreach ($prefixes as $prefix) { $uri = $session->getNamespaceURI($prefix); - $table->addRow(array($prefix, $uri)); + $table->addRow([$prefix, $uri]); } $table->render($output); diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/SessionNamespaceSetCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/SessionNamespaceSetCommand.php index c5882454..1a9b7293 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/SessionNamespaceSetCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/SessionNamespaceSetCommand.php @@ -7,13 +7,14 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; +use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Input\InputArgument; class SessionNamespaceSetCommand extends BasePhpcrCommand { @@ -23,7 +24,7 @@ protected function configure() $this->setDescription('Set a namespace in the current session'); $this->addArgument('prefix', InputArgument::REQUIRED, 'The namespace prefix to be set as identifier'); $this->addArgument('uri', InputArgument::REQUIRED, 'The location of the namespace definition (usually a URI'); - $this->setHelp(<<setHelp(<<<'HERE' Sets the name of a namespace prefix. Within the scope of this Session, this method maps uri to prefix. The diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/SessionRefreshCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/SessionRefreshCommand.php index 897acfc8..a1ef575f 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/SessionRefreshCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/SessionRefreshCommand.php @@ -7,13 +7,14 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Output\OutputInterface; class SessionRefreshCommand extends BasePhpcrCommand { @@ -22,7 +23,7 @@ protected function configure() $this->setName('session:refresh'); $this->setDescription('Refresh the current session'); $this->addOption('keep-changes', null, InputOption::VALUE_NONE, 'Keep any changes that have been made in this session'); - $this->setHelp(<<setHelp(<<<'HERE' Reloads the current session. If the --keep-changes option is not given then this command discards diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/SessionSaveCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/SessionSaveCommand.php index 0d128cfd..79ca1c4f 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/SessionSaveCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/SessionSaveCommand.php @@ -7,6 +7,7 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; @@ -20,7 +21,7 @@ protected function configure() { $this->setName('session:save'); $this->setDescription('Save the current session'); - $this->setHelp(<<setHelp(<<<'HERE' Validates all pending changes currently recorded in this Session. If validation of all pending changes succeeds, then this change diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/VersionCheckinCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/VersionCheckinCommand.php index 1b40766e..5e6d3b7f 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/VersionCheckinCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/VersionCheckinCommand.php @@ -7,14 +7,15 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; +use PHPCR\RepositoryInterface; +use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Input\InputArgument; -use PHPCR\RepositoryInterface; class VersionCheckinCommand extends BasePhpcrCommand { @@ -23,7 +24,7 @@ protected function configure() $this->setName('version:checkin'); $this->setDescription('Checkin (commit) a node version'); $this->addArgument('path', InputArgument::REQUIRED, 'Absolute path to node'); - $this->setHelp(<<setHelp(<<<'HERE' Creates for the versionable node at path a new version with a system generated version name and returns that version (which will be the new base version of this node). Sets the jcr:checkedOut property to false @@ -70,6 +71,6 @@ public function execute(InputInterface $input, OutputInterface $output) $version = $versionManager->checkin($node->getPath()); - $output->writeln('Version: ' . $version->getName()); + $output->writeln('Version: '.$version->getName()); } } diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/VersionCheckoutCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/VersionCheckoutCommand.php index f9aba993..991d3824 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/VersionCheckoutCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/VersionCheckoutCommand.php @@ -7,14 +7,15 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; +use PHPCR\RepositoryInterface; +use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Input\InputArgument; -use PHPCR\RepositoryInterface; class VersionCheckoutCommand extends BasePhpcrCommand { @@ -23,7 +24,7 @@ protected function configure() $this->setName('version:checkout'); $this->setDescription('Checkout a node version and enable changes to be made'); $this->addArgument('path', InputArgument::REQUIRED, 'Absolute path to node'); - $this->setHelp(<<setHelp(<<<'HERE' Sets the versionable node at path to checked-out status by setting its jcr:isCheckedOut property to true. Under full versioning it also sets the jcr:predecessors property to be a reference to the current base diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/VersionCheckpointCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/VersionCheckpointCommand.php index b1c3975c..c4a6171c 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/VersionCheckpointCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/VersionCheckpointCommand.php @@ -7,14 +7,15 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; +use PHPCR\RepositoryInterface; +use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Input\InputArgument; -use PHPCR\RepositoryInterface; class VersionCheckpointCommand extends BasePhpcrCommand { @@ -23,7 +24,7 @@ protected function configure() $this->setName('version:checkpoint'); $this->setDescription('Checkin and then checkout a node'); $this->addArgument('path', InputArgument::REQUIRED, 'Path to node'); - $this->setHelp(<<setHelp(<<<'HERE' Performs a version:checkin followed by a version:checkout on the versionable node at path @@ -45,6 +46,6 @@ public function execute(InputInterface $input, OutputInterface $output) $versionManager = $workspace->getVersionManager(); $version = $versionManager->checkpoint($node->getPath()); - $output->writeln('Version: ' . $version->getName()); + $output->writeln('Version: '.$version->getName()); } } diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/VersionHistoryCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/VersionHistoryCommand.php index 6282bc22..52c3fd5e 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/VersionHistoryCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/VersionHistoryCommand.php @@ -7,15 +7,16 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Input\InputArgument; use PHPCR\RepositoryInterface; use PHPCR\Shell\Console\Helper\Table; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; class VersionHistoryCommand extends BasePhpcrCommand { @@ -24,7 +25,7 @@ protected function configure() $this->setName('version:history'); $this->setDescription('Show version history of node at given absolute path'); $this->addArgument('path', InputArgument::REQUIRED, 'Absolute path to node'); - $this->setHelp(<<setHelp(<<<'HERE' Lists the version history of the node given at path. HERE ); @@ -48,13 +49,13 @@ public function execute(InputInterface $input, OutputInterface $output) $versions = $history->getAllVersions(); - $table->setHeaders(array('Name', 'Created')); + $table->setHeaders(['Name', 'Created']); foreach ($versions as $name => $version) { - $table->addRow(array( + $table->addRow([ $name, $version->getCreated()->format('Y-m-d H:i:s'), - )); + ]); } $table->render($output); diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/VersionRemoveCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/VersionRemoveCommand.php index 89f313c7..079c14f6 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/VersionRemoveCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/VersionRemoveCommand.php @@ -7,14 +7,15 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; +use PHPCR\RepositoryInterface; +use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Input\InputArgument; -use PHPCR\RepositoryInterface; class VersionRemoveCommand extends BasePhpcrCommand { @@ -24,7 +25,7 @@ protected function configure() $this->setDescription('Remove a node version'); $this->addArgument('path', InputArgument::REQUIRED, 'Path to node'); $this->addArgument('versionName', InputArgument::REQUIRED, 'Name of version to remove'); - $this->setHelp(<<setHelp(<<<'HERE' Removes the named version from this version history and automatically repairs the version graph. diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/VersionRestoreCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/VersionRestoreCommand.php index d9f83312..c506d165 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/VersionRestoreCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/VersionRestoreCommand.php @@ -7,15 +7,16 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Output\OutputInterface; +use PHPCR\RepositoryInterface; use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; -use PHPCR\RepositoryInterface; +use Symfony\Component\Console\Output\OutputInterface; class VersionRestoreCommand extends BasePhpcrCommand { @@ -26,7 +27,7 @@ protected function configure() $this->addArgument('path', InputArgument::REQUIRED, 'Path to node'); $this->addArgument('versionName', InputArgument::REQUIRED, 'Name of version to retore'); $this->addOption('remove-existing', null, InputOption::VALUE_NONE, 'Flag that governs what happens in case of identifier collision'); - $this->setHelp(<<setHelp(<<<'HERE' Attempt to restore an old version of a node. The versionName should correspond to a version name as revealed by diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/WorkspaceCreateCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/WorkspaceCreateCommand.php index f9dbd4f1..93e868ae 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/WorkspaceCreateCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/WorkspaceCreateCommand.php @@ -7,14 +7,15 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Input\InputArgument; class WorkspaceCreateCommand extends BasePhpcrCommand { @@ -24,7 +25,7 @@ protected function configure() $this->setDescription('Create a new workspace'); $this->addArgument('name', InputArgument::REQUIRED, 'Name of new workspace'); $this->addArgument('srcWorkspace', InputArgument::OPTIONAL, 'If specified, clone from this workspace'); - $this->setHelp(<<setHelp(<<<'HERE' Creates a new Workspace with the specified name. The new workspace is empty, meaning it contains only root node. diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/WorkspaceDeleteCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/WorkspaceDeleteCommand.php index 231180b6..ad50ddce 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/WorkspaceDeleteCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/WorkspaceDeleteCommand.php @@ -7,13 +7,14 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; +use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Input\InputArgument; class WorkspaceDeleteCommand extends BasePhpcrCommand { @@ -23,7 +24,7 @@ protected function configure() $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(<<setHelp(<<<'HERE' Deletes the workspace with the specified name from the repository, deleting all content within it. HERE diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/WorkspaceListCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/WorkspaceListCommand.php index 384d0bf6..647e6d2b 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/WorkspaceListCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/WorkspaceListCommand.php @@ -7,14 +7,15 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; +use PHPCR\Shell\Console\Helper\Table; +use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Input\InputArgument; -use PHPCR\Shell\Console\Helper\Table; class WorkspaceListCommand extends BasePhpcrCommand { @@ -23,7 +24,7 @@ protected function configure() $this->setName('workspace:list'); $this->setDescription('Lists workspaces in the current repository'); $this->addArgument('srcWorkspace', InputArgument::OPTIONAL, 'If specified, clone from this workspace'); - $this->setHelp(<<setHelp(<<<'HERE' Lists the workspaces accessible to the current user. The current workspace is indicated by an asterix (*). @@ -46,12 +47,12 @@ public function execute(InputInterface $input, OutputInterface $output) $availableWorkspaces = $workspace->getAccessibleWorkspaceNames(); $table = new Table($output); - $table->setHeaders(array('Name')); + $table->setHeaders(['Name']); foreach ($availableWorkspaces as $availableWorkspace) { if ($availableWorkspace == $workspace->getName()) { $availableWorkspace .= ' *'; } - $table->addRow(array($availableWorkspace)); + $table->addRow([$availableWorkspace]); } $table->render($output); diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/WorkspaceNamespaceListCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/WorkspaceNamespaceListCommand.php index bfbd4b56..d979ab95 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/WorkspaceNamespaceListCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/WorkspaceNamespaceListCommand.php @@ -7,13 +7,14 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; +use PHPCR\Shell\Console\Helper\Table; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use PHPCR\Shell\Console\Helper\Table; class WorkspaceNamespaceListCommand extends BasePhpcrCommand { @@ -21,7 +22,7 @@ protected function configure() { $this->setName('workspace:namespace:list'); $this->setDescription('List all namespace prefix to URI mappings in current workspace'); - $this->setHelp(<<setHelp(<<<'HERE' List all namespace prefix to URI mappings in current workspace HERE ); @@ -36,11 +37,11 @@ public function execute(InputInterface $input, OutputInterface $output) $prefixes = $namespaceRegistry->getPrefixes(); $table = new Table($output); - $table->setHeaders(array('Prefix', 'URI')); + $table->setHeaders(['Prefix', 'URI']); foreach ($prefixes as $prefix) { $uri = $namespaceRegistry->getURI($prefix); - $table->addRow(array($prefix, $uri)); + $table->addRow([$prefix, $uri]); } $table->render($output); diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/WorkspaceNamespaceRegisterCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/WorkspaceNamespaceRegisterCommand.php index 82c05176..cc4c8b86 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/WorkspaceNamespaceRegisterCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/WorkspaceNamespaceRegisterCommand.php @@ -7,13 +7,14 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; +use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Input\InputArgument; class WorkspaceNamespaceRegisterCommand extends BasePhpcrCommand { @@ -23,7 +24,7 @@ protected function configure() $this->setDescription('Sets a one-to-one mapping between prefix and uri in the global namespace'); $this->addArgument('prefix', InputArgument::REQUIRED, 'The namespace prefix to be mapped'); $this->addArgument('uri', InputArgument::REQUIRED, 'The URI to be mapped'); - $this->setHelp(<<setHelp(<<<'HERE' List all namespace prefix to URI mappings in current session HERE ); diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/WorkspaceNamespaceUnregisterCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/WorkspaceNamespaceUnregisterCommand.php index f896ba7f..7282735e 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/WorkspaceNamespaceUnregisterCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/WorkspaceNamespaceUnregisterCommand.php @@ -7,13 +7,14 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; +use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Input\InputArgument; class WorkspaceNamespaceUnregisterCommand extends BasePhpcrCommand { @@ -22,7 +23,7 @@ protected function configure() $this->setName('workspace:namespace:unregister'); $this->setDescription('Unregister a namespace'); $this->addArgument('uri', InputArgument::REQUIRED, 'The URI to be removed'); - $this->setHelp(<<setHelp(<<<'HERE' Removes the specified namespace URI from namespace registry. The following restrictions apply: diff --git a/src/PHPCR/Shell/Console/Command/Phpcr/WorkspaceUseCommand.php b/src/PHPCR/Shell/Console/Command/Phpcr/WorkspaceUseCommand.php index fa039143..b42c02eb 100644 --- a/src/PHPCR/Shell/Console/Command/Phpcr/WorkspaceUseCommand.php +++ b/src/PHPCR/Shell/Console/Command/Phpcr/WorkspaceUseCommand.php @@ -7,13 +7,14 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Phpcr; +use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Input\InputArgument; class WorkspaceUseCommand extends BasePhpcrCommand { @@ -23,7 +24,7 @@ protected function configure() $this->setDescription('Change the current workspace'); $this->addArgument('name', InputArgument::REQUIRED, 'Name of workspace to use'); $this->addArgument('srcWorkspace', InputArgument::OPTIONAL, 'If specified, clone from this workspace'); - $this->setHelp(<<setHelp(<<<'HERE' Change the workspace. HERE ); diff --git a/src/PHPCR/Shell/Console/Command/Shell/AliasListCommand.php b/src/PHPCR/Shell/Console/Command/Shell/AliasListCommand.php index c7925e12..dd6c6eaf 100644 --- a/src/PHPCR/Shell/Console/Command/Shell/AliasListCommand.php +++ b/src/PHPCR/Shell/Console/Command/Shell/AliasListCommand.php @@ -7,14 +7,15 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Shell; use PHPCR\Shell\Console\Command\BaseCommand; +use PHPCR\Shell\Console\Helper\Table; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use PHPCR\Shell\Console\Helper\Table; class AliasListCommand extends BaseCommand { @@ -22,7 +23,7 @@ public function configure() { $this->setName('shell:alias:list'); $this->setDescription('List all the registered aliases'); - $this->setHelp(<<setHelp(<<<'EOT' List the aliases as defined in ~/.phpcrsh/aliases.yml. EOT ); @@ -34,10 +35,10 @@ public function execute(InputInterface $input, OutputInterface $output) $aliases = $config->getConfig('alias'); $table = new Table($output); - $table->setHeaders(array('Alias', 'Command')); + $table->setHeaders(['Alias', 'Command']); foreach ($aliases as $alias => $command) { - $table->addRow(array($alias, $command)); + $table->addRow([$alias, $command]); } $table->render($output); diff --git a/src/PHPCR/Shell/Console/Command/Shell/ClearCommand.php b/src/PHPCR/Shell/Console/Command/Shell/ClearCommand.php index 9a4c82f4..f98925b4 100644 --- a/src/PHPCR/Shell/Console/Command/Shell/ClearCommand.php +++ b/src/PHPCR/Shell/Console/Command/Shell/ClearCommand.php @@ -7,6 +7,7 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Shell; @@ -21,7 +22,7 @@ public function configure() { $this->setName('shell:clear'); $this->setDescription('Clear the screen'); - $this->setHelp(<<setHelp(<<<'EOT' Clear the screen EOT ); diff --git a/src/PHPCR/Shell/Console/Command/Shell/ConfigInitCommand.php b/src/PHPCR/Shell/Console/Command/Shell/ConfigInitCommand.php index 88db13b6..f42ca560 100644 --- a/src/PHPCR/Shell/Console/Command/Shell/ConfigInitCommand.php +++ b/src/PHPCR/Shell/Console/Command/Shell/ConfigInitCommand.php @@ -7,6 +7,7 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Shell; @@ -23,7 +24,7 @@ public function configure() { $this->setName('shell:config:init'); $this->setDescription('Initialize a local configuration with default values'); - $this->setHelp(<<setHelp(<<<'EOT' Initialize a new configuration folder, .phpcrsh in the users HOME directory. EOT ); diff --git a/src/PHPCR/Shell/Console/Command/Shell/ConfigReloadCommand.php b/src/PHPCR/Shell/Console/Command/Shell/ConfigReloadCommand.php index cf2ba52e..419c8199 100644 --- a/src/PHPCR/Shell/Console/Command/Shell/ConfigReloadCommand.php +++ b/src/PHPCR/Shell/Console/Command/Shell/ConfigReloadCommand.php @@ -7,6 +7,7 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Shell; @@ -23,7 +24,7 @@ public function configure() { $this->setName('shell:config:reload'); $this->setDescription('Reload the configuration'); - $this->setHelp(<<setHelp(<<<'EOT' Reload the configuration EOT ); diff --git a/src/PHPCR/Shell/Console/Command/Shell/ExitCommand.php b/src/PHPCR/Shell/Console/Command/Shell/ExitCommand.php index 6f796a89..543b602e 100644 --- a/src/PHPCR/Shell/Console/Command/Shell/ExitCommand.php +++ b/src/PHPCR/Shell/Console/Command/Shell/ExitCommand.php @@ -7,6 +7,7 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Shell; diff --git a/src/PHPCR/Shell/Console/Command/Shell/PathChangeCommand.php b/src/PHPCR/Shell/Console/Command/Shell/PathChangeCommand.php index 6dd206bb..bef67137 100644 --- a/src/PHPCR/Shell/Console/Command/Shell/PathChangeCommand.php +++ b/src/PHPCR/Shell/Console/Command/Shell/PathChangeCommand.php @@ -7,6 +7,7 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Shell; @@ -31,9 +32,9 @@ public function execute(InputInterface $input, OutputInterface $output) $path = $input->getArgument('path'); try { $session->chdir($path); - $output->writeln('' . $session->getCwd() . ''); + $output->writeln(''.$session->getCwd().''); } catch (PathNotFoundException $e) { - $output->writeln('' . $e->getMessage() . ''); + $output->writeln(''.$e->getMessage().''); } } } diff --git a/src/PHPCR/Shell/Console/Command/Shell/PathShowCommand.php b/src/PHPCR/Shell/Console/Command/Shell/PathShowCommand.php index f2b48144..52c79ece 100644 --- a/src/PHPCR/Shell/Console/Command/Shell/PathShowCommand.php +++ b/src/PHPCR/Shell/Console/Command/Shell/PathShowCommand.php @@ -7,13 +7,14 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Shell; +use PHPCR\Shell\Console\Command\BaseCommand; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use PHPCR\Shell\Console\Command\BaseCommand; class PathShowCommand extends BaseCommand { @@ -26,7 +27,7 @@ protected function configure() public function execute(InputInterface $input, OutputInterface $output) { $output->writeln( - '' . $this->get('phpcr.session')->getCwd() . '' + ''.$this->get('phpcr.session')->getCwd().'' ); } } diff --git a/src/PHPCR/Shell/Console/Command/Shell/ProfileShowCommand.php b/src/PHPCR/Shell/Console/Command/Shell/ProfileShowCommand.php index c3b19b42..a7da5a8f 100644 --- a/src/PHPCR/Shell/Console/Command/Shell/ProfileShowCommand.php +++ b/src/PHPCR/Shell/Console/Command/Shell/ProfileShowCommand.php @@ -7,14 +7,15 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command\Shell; use PHPCR\Shell\Console\Command\BaseCommand; +use PHPCR\Shell\Console\Helper\Table; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use PHPCR\Shell\Console\Helper\Table; class ProfileShowCommand extends BaseCommand { @@ -24,7 +25,7 @@ public function configure() { $this->setName('shell:profile:show'); $this->setDescription('Show the current profile configuration'); - $this->setHelp(<<setHelp(<<<'EOT' Display the currently loaded profile configuration EOT ); @@ -38,22 +39,21 @@ public function execute(InputInterface $input, OutputInterface $output) $output->writeln('NOTE: The profile may include information not relating to your current transport'); $output->writeln(''); foreach ($profile->toArray() as $domain => $config) { - $output->writeln('' . $domain . ''); + $output->writeln(''.$domain.''); $table = new Table($output); - $table->setHeaders(array('Key', 'Value')); + $table->setHeaders(['Key', 'Value']); foreach ($config as $key => $value) { if ($key === 'db_password') { $value = '***'; } - $table->addRow(array( + $table->addRow([ $key, - is_scalar($value) ? $value : json_encode($value) - )); + is_scalar($value) ? $value : json_encode($value), + ]); } $table->render($output); } - } } diff --git a/src/PHPCR/Shell/Console/Command/ShellCommand.php b/src/PHPCR/Shell/Console/Command/ShellCommand.php index e6f227ff..b9b0cdef 100644 --- a/src/PHPCR/Shell/Console/Command/ShellCommand.php +++ b/src/PHPCR/Shell/Console/Command/ShellCommand.php @@ -7,21 +7,22 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Command; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Input\InputOption; -use PHPCR\Shell\Console\Application\ShellApplication; use PHPCR\Shell\Console\Application\Shell; +use PHPCR\Shell\Console\Application\ShellApplication; use PHPCR\Shell\Console\Input\StringInput; +use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Output\OutputInterface; /** - * The shell command is the command used to configure the shell session + * The shell command is the command used to configure the shell session. * * @author Daniel Leech */ @@ -46,41 +47,41 @@ public function __construct(ShellApplication $application) } /** - * {@inheritDoc} + * {@inheritdoc} */ public function configure() { $this->setName('phpcr_shell'); - $this->setDefinition(array( - new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display this help message.'), - new InputOption('--verbose', '-v', InputOption::VALUE_NONE, 'Increase verbosity of messages.'), - new InputOption('--version', '-V', InputOption::VALUE_NONE, 'Display this application version.'), - new InputOption('--ansi', '', InputOption::VALUE_NONE, 'Force ANSI output.'), - new InputOption('--no-ansi', '', InputOption::VALUE_NONE, 'Disable ANSI output.'), - - new InputOption('--transport', '-t', InputOption::VALUE_REQUIRED, 'Transport to use.'), - new InputOption('--phpcr-username', '-pu', InputOption::VALUE_REQUIRED, 'PHPCR Username.', 'admin'), - new InputOption('--phpcr-password', '-pp', InputOption::VALUE_OPTIONAL, 'PHPCR Password.', 'admin'), - new InputOption('--db-username', '-du', InputOption::VALUE_REQUIRED, 'Database Username.', 'root'), - new InputOption('--db-name', '-dn', InputOption::VALUE_REQUIRED, 'Database Name.', 'phpcr'), - new InputOption('--db-password', '-dp', InputOption::VALUE_OPTIONAL, 'Database Password.'), - new InputOption('--db-host', '-dh', InputOption::VALUE_REQUIRED, 'Database Host.', 'localhost'), - new InputOption('--db-driver', '-dd', InputOption::VALUE_REQUIRED, 'Database Transport.', 'pdo_mysql'), - new InputOption('--db-path', '-dP', InputOption::VALUE_REQUIRED, 'Database Path.'), - new InputOption('--no-interaction', null, InputOption::VALUE_NONE, 'Turn off interaction (for testing purposes)'), - new InputOption('--repo-url', '-url', InputOption::VALUE_REQUIRED, 'URL of repository (e.g. for jackrabbit).', 'http://localhost:8080/server/'), - new InputOption('--repo-path', '-path', InputOption::VALUE_REQUIRED, 'Path to repository (e.g. for Jackalope FS).', '/home/myuser/www/myproject/app/data'), - - new InputOption('--profile', '-p', InputOption::VALUE_OPTIONAL, 'Speicfy a profile name, use wit --transport to update or create'), - new InputOption('--unsupported', null, InputOption::VALUE_NONE, 'Show all commands, including commands not supported by the repository'), - new InputOption('--command', null, InputOption::VALUE_REQUIRED|InputOption::VALUE_IS_ARRAY, 'Run the given command'), + $this->setDefinition([ + new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display this help message.'), + new InputOption('--verbose', '-v', InputOption::VALUE_NONE, 'Increase verbosity of messages.'), + new InputOption('--version', '-V', InputOption::VALUE_NONE, 'Display this application version.'), + new InputOption('--ansi', '', InputOption::VALUE_NONE, 'Force ANSI output.'), + new InputOption('--no-ansi', '', InputOption::VALUE_NONE, 'Disable ANSI output.'), + + new InputOption('--transport', '-t', InputOption::VALUE_REQUIRED, 'Transport to use.'), + new InputOption('--phpcr-username', '-pu', InputOption::VALUE_REQUIRED, 'PHPCR Username.', 'admin'), + new InputOption('--phpcr-password', '-pp', InputOption::VALUE_OPTIONAL, 'PHPCR Password.', 'admin'), + new InputOption('--db-username', '-du', InputOption::VALUE_REQUIRED, 'Database Username.', 'root'), + new InputOption('--db-name', '-dn', InputOption::VALUE_REQUIRED, 'Database Name.', 'phpcr'), + new InputOption('--db-password', '-dp', InputOption::VALUE_OPTIONAL, 'Database Password.'), + new InputOption('--db-host', '-dh', InputOption::VALUE_REQUIRED, 'Database Host.', 'localhost'), + new InputOption('--db-driver', '-dd', InputOption::VALUE_REQUIRED, 'Database Transport.', 'pdo_mysql'), + new InputOption('--db-path', '-dP', InputOption::VALUE_REQUIRED, 'Database Path.'), + new InputOption('--no-interaction', null, InputOption::VALUE_NONE, 'Turn off interaction (for testing purposes)'), + new InputOption('--repo-url', '-url', InputOption::VALUE_REQUIRED, 'URL of repository (e.g. for jackrabbit).', 'http://localhost:8080/server/'), + new InputOption('--repo-path', '-path', InputOption::VALUE_REQUIRED, 'Path to repository (e.g. for Jackalope FS).', '/home/myuser/www/myproject/app/data'), + + new InputOption('--profile', '-p', InputOption::VALUE_OPTIONAL, 'Speicfy a profile name, use wit --transport to update or create'), + new InputOption('--unsupported', null, InputOption::VALUE_NONE, 'Show all commands, including commands not supported by the repository'), + new InputOption('--command', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Run the given command'), new InputArgument('workspace', InputArgument::OPTIONAL, 'Workspace to start with', 'default'), - )); + ]); } /** - * {@inheritDoc} + * {@inheritdoc} */ public function execute(InputInterface $input, OutputInterface $output) { diff --git a/src/PHPCR/Shell/Console/Helper/EditorHelper.php b/src/PHPCR/Shell/Console/Helper/EditorHelper.php index cccf084c..6942937f 100644 --- a/src/PHPCR/Shell/Console/Helper/EditorHelper.php +++ b/src/PHPCR/Shell/Console/Helper/EditorHelper.php @@ -7,15 +7,16 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Helper; -use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\Console\Helper\Helper; +use Symfony\Component\Filesystem\Filesystem; /** - * Helper for launching external editor + * Helper for launching external editor. * * @author Daniel Leech */ @@ -46,7 +47,7 @@ public function fromString($string, $extension = null) $tmpName = tempnam($dir, ''); if ($extension) { - $tmpName .= '.' . $extension; + $tmpName .= '.'.$extension; } file_put_contents($tmpName, $string); @@ -56,7 +57,7 @@ public function fromString($string, $extension = null) throw new \RuntimeException('No EDITOR environment variable set.'); } - system($editor . ' ' . $tmpName . ' > `tty`'); + system($editor.' '.$tmpName.' > `tty`'); $contents = file_get_contents($tmpName); $fs->remove($tmpName); @@ -88,7 +89,7 @@ public function fromStringWithMessage($string, $message, $messagePrefix = '# ', $line = next($res); } - $out = array(); + $out = []; while ($line) { $out[] = $line; diff --git a/src/PHPCR/Shell/Console/Helper/NodeHelper.php b/src/PHPCR/Shell/Console/Helper/NodeHelper.php index de2401a7..b485dc1e 100644 --- a/src/PHPCR/Shell/Console/Helper/NodeHelper.php +++ b/src/PHPCR/Shell/Console/Helper/NodeHelper.php @@ -7,24 +7,25 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Helper; -use Symfony\Component\Console\Helper\Helper; use PHPCR\NodeInterface; +use Symfony\Component\Console\Helper\Helper; /** - * Helper for nodes + * Helper for nodes. * * @author Daniel Leech */ class NodeHelper extends Helper { /** - * Return true if the given node has the given mixinType + * Return true if the given node has the given mixinType. * - * @return boolean + * @return bool */ public function nodeHasMixinType($node, $mixinTypeName) { @@ -40,7 +41,7 @@ public function nodeHasMixinType($node, $mixinTypeName) } /** - * Return true if the given node is versionable + * Return true if the given node is versionable. */ public function assertNodeIsVersionable(NodeInterface $node) { diff --git a/src/PHPCR/Shell/Console/Helper/PathHelper.php b/src/PHPCR/Shell/Console/Helper/PathHelper.php index b8ba4b52..1d63465f 100644 --- a/src/PHPCR/Shell/Console/Helper/PathHelper.php +++ b/src/PHPCR/Shell/Console/Helper/PathHelper.php @@ -7,6 +7,7 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Helper; @@ -15,7 +16,7 @@ use Symfony\Component\Console\Helper\Helper; /** - * Phpcr path helper + * Phpcr path helper. * * @author Daniel Leech */ @@ -38,7 +39,7 @@ public function getNodeName($path) } /** - * {@inheritDoc} + * {@inheritdoc} */ public function getName() { diff --git a/src/PHPCR/Shell/Console/Helper/RepositoryHelper.php b/src/PHPCR/Shell/Console/Helper/RepositoryHelper.php index c8d6c14c..9ba57b02 100644 --- a/src/PHPCR/Shell/Console/Helper/RepositoryHelper.php +++ b/src/PHPCR/Shell/Console/Helper/RepositoryHelper.php @@ -7,12 +7,13 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Helper; -use Symfony\Component\Console\Helper\Helper; use PHPCR\Shell\Phpcr\SessionManager; +use Symfony\Component\Console\Helper\Helper; class RepositoryHelper extends Helper { @@ -33,7 +34,7 @@ public function __construct(SessionManager $sessionManager) /** * Return true if the sessionManager supports the given descriptor - * which relates to a descriptor key + * which relates to a descriptor key. * * @param string $descriptor */ diff --git a/src/PHPCR/Shell/Console/Helper/ResultFormatterHelper.php b/src/PHPCR/Shell/Console/Helper/ResultFormatterHelper.php index 44f35819..414988e7 100644 --- a/src/PHPCR/Shell/Console/Helper/ResultFormatterHelper.php +++ b/src/PHPCR/Shell/Console/Helper/ResultFormatterHelper.php @@ -7,21 +7,21 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Helper; -use Symfony\Component\Console\Helper\Helper; -use PHPCR\Query\QueryResultInterface; -use Symfony\Component\Console\Output\OutputInterface; -use PHPCR\PropertyType; use PHPCR\NodeInterface; use PHPCR\PropertyInterface; +use PHPCR\PropertyType; +use PHPCR\Query\QueryResultInterface; use PHPCR\Shell\Config\Config; -use PHPCR\Shell\Console\Helper\Table; +use Symfony\Component\Console\Helper\Helper; +use Symfony\Component\Console\Output\OutputInterface; /** - * Provide methods for formatting PHPCR objects + * Provide methods for formatting PHPCR objects. * * @TODO: Rename this to PhpcrFormatterHelper */ @@ -37,7 +37,7 @@ public function __construct(TextHelper $textHelper, Config $config) } /** - * {@inheritDoc} + * {@inheritdoc} */ public function getName() { @@ -46,7 +46,7 @@ public function getName() /** * Return the name of a property from its enumeration (i.e. - * the value of its CONSTANT) + * the value of its CONSTANT). * * @return string */ @@ -61,20 +61,20 @@ public function getPropertyTypeName($typeInteger) } /** - * Render a table with the results of the given QueryResultInterface + * Render a table with the results of the given QueryResultInterface. */ public function formatQueryResult(QueryResultInterface $result, OutputInterface $output, $elapsed) { $table = new Table($output); - $table->setHeaders(array_merge(array( + $table->setHeaders(array_merge([ 'Path', 'Index', - ), $result->getColumnNames())); + ], $result->getColumnNames())); foreach ($result->getRows() as $row) { - $values = array_merge(array( + $values = array_merge([ $row->getPath(), - ), $row->getValues()); + ], $row->getValues()); foreach ($values as &$value) { $value = $this->textHelper->truncate($value, 255); @@ -98,17 +98,17 @@ public function formatValue(PropertyInterface $property, $showBinary = false, $t { $values = $property->getValue(); if (false === $property->isMultiple()) { - $values = array($values); + $values = [$values]; } - $return = array(); + $return = []; foreach ($values as $value) { switch (intval($property->getType())) { - case PropertyType::UNDEFINED : + case PropertyType::UNDEFINED: $return[] = '#UNDEFINED#'; - case PropertyType::BINARY : + case PropertyType::BINARY: if ($showBinary) { - $lines = array(); + $lines = []; $pointer = $value; while (($line = fgets($pointer)) !== false) { $lines[] = $line; @@ -119,39 +119,40 @@ public function formatValue(PropertyInterface $property, $showBinary = false, $t } return '(binary data)'; - case PropertyType::BOOLEAN : + case PropertyType::BOOLEAN: $return[] = $value ? 'true' : 'false'; break; - case PropertyType::DATE : + case PropertyType::DATE: $return[] = $value->format('c'); break; - case PropertyType::REFERENCE : - case PropertyType::WEAKREFERENCE : + case PropertyType::REFERENCE: + case PropertyType::WEAKREFERENCE: $return[] = sprintf( '%s (%s)', $this->textHelper->truncate($value->getPath(), 255), $value->getIdentifier() ); break; - case PropertyType::URI : - case PropertyType::STRING : + case PropertyType::URI: + case PropertyType::STRING: $return[] = $truncate ? $this->textHelper->truncate($value) : $value; break; - case PropertyType::NAME : - case PropertyType::LONG : - case PropertyType::DOUBLE : - case PropertyType::DECIMAL : - case PropertyType::PATH : + case PropertyType::NAME: + case PropertyType::LONG: + case PropertyType::DOUBLE: + case PropertyType::DECIMAL: + case PropertyType::PATH: $return[] = $value; break; default: - throw new \RuntimeException('Unknown type ' . $property->getType()); + throw new \RuntimeException('Unknown type '.$property->getType()); } } if ($property->isMultiple()) { return implode("\n", array_map(function ($value) { static $index = 0; + return sprintf('[%d] %s', $index++, $value); }, $return)); } @@ -161,7 +162,7 @@ public function formatValue(PropertyInterface $property, $showBinary = false, $t public function formatNodePropertiesInline(NodeInterface $node) { - $out = array(); + $out = []; foreach ($node->getProperties() as $property) { $out[] = sprintf('%s: %s', diff --git a/src/PHPCR/Shell/Console/Helper/Table.php b/src/PHPCR/Shell/Console/Helper/Table.php index 25d269fe..109d3023 100644 --- a/src/PHPCR/Shell/Console/Helper/Table.php +++ b/src/PHPCR/Shell/Console/Helper/Table.php @@ -1,5 +1,15 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ + namespace PHPCR\Shell\Console\Helper; use Symfony\Component\Console\Helper\Table as OriginalTable; diff --git a/src/PHPCR/Shell/Console/Helper/TextHelper.php b/src/PHPCR/Shell/Console/Helper/TextHelper.php index 0cf356e8..007ec0a7 100644 --- a/src/PHPCR/Shell/Console/Helper/TextHelper.php +++ b/src/PHPCR/Shell/Console/Helper/TextHelper.php @@ -7,6 +7,7 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Helper; @@ -14,7 +15,7 @@ use Symfony\Component\Console\Helper\Helper; /** - * Helper for text plain text formatting + * Helper for text plain text formatting. * * @author Daniel Leech */ @@ -22,12 +23,13 @@ class TextHelper extends Helper { /** * @todo: Make this configurable - * @var integer + * + * @var int */ protected $truncateLength = 75; /** - * {@inheritDoc} + * {@inheritdoc} */ public function getName() { @@ -35,12 +37,12 @@ public function getName() } /** - * Truncate the given string + * 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 + * @param string $string String to truncate + * @param int $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 */ @@ -54,7 +56,7 @@ public function truncate($string, $length = null, $alignment = null, $delimStrin $delimString = $delimString === null ? '...' : $delimString; $delimLen = strlen($delimString); - if (!in_array($alignment, array('left', 'right'))) { + if (!in_array($alignment, ['left', 'right'])) { throw new \InvalidArgumentException( 'Alignment must either be "left" or "right"' ); @@ -70,9 +72,9 @@ public function truncate($string, $length = null, $alignment = null, $delimStrin if (strlen($string) > $length) { $offset = $length - $delimLen; if ('left' === $alignment) { - $string = substr($string, 0, $offset) . $delimString; + $string = substr($string, 0, $offset).$delimString; } else { - $string = $delimString . substr($string, + $string = $delimString.substr($string, strlen($string) - $offset ); } diff --git a/src/PHPCR/Shell/Console/Input/AutoComplete.php b/src/PHPCR/Shell/Console/Input/AutoComplete.php index bc9f8628..aa50750e 100644 --- a/src/PHPCR/Shell/Console/Input/AutoComplete.php +++ b/src/PHPCR/Shell/Console/Input/AutoComplete.php @@ -7,6 +7,7 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Input; @@ -15,7 +16,7 @@ use PHPCR\Shell\Phpcr\PhpcrSession; /** - * Class for autocompleting commands + * Class for autocompleting commands. * * @author Daniel Leech */ diff --git a/src/PHPCR/Shell/Console/Input/StringInput.php b/src/PHPCR/Shell/Console/Input/StringInput.php index d3160276..2d92bd6a 100644 --- a/src/PHPCR/Shell/Console/Input/StringInput.php +++ b/src/PHPCR/Shell/Console/Input/StringInput.php @@ -7,6 +7,7 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Input; @@ -15,7 +16,7 @@ /** * Extend the Symfony StringInput class to provide additional accessors - * and methods + * and methods. * * @author Daniel Leech */ @@ -26,24 +27,24 @@ class StringInput extends BaseInput protected $isQuery = false; /** - * {@inheritDoc} + * {@inheritdoc} */ public function __construct($command) { $this->rawCommand = trim($command); if (strpos(strtolower($this->rawCommand), 'select') === 0) { - $command = 'select' . substr($command, 6); + $command = 'select'.substr($command, 6); $this->isQuery = true; } if (strpos(strtolower($this->rawCommand), 'update') === 0) { - $command = 'update' . substr($command, 6); + $command = 'update'.substr($command, 6); $this->isQuery = true; } if (strpos(strtolower($this->rawCommand), 'delete') === 0) { - $command = 'delete' . substr($command, 6); + $command = 'delete'.substr($command, 6); $this->isQuery = true; } @@ -51,7 +52,7 @@ public function __construct($command) } /** - * Return the raw command string without any parsing + * Return the raw command string without any parsing. * * (useful for returning the full SQL query for example) * @@ -70,9 +71,9 @@ public function validate() } /** - * Do not validate if the command is a query + * Do not validate if the command is a query. * - * {@inheritDoc} + * {@inheritdoc} */ protected function parse() { @@ -105,9 +106,9 @@ public function getTokens() /** * Return true if this command sounds like a query, i.e. - * if it begins with "select " + * if it begins with "select ". * - * @return boolean + * @return bool */ protected function isQuery() { diff --git a/src/PHPCR/Shell/DependencyInjection/Container.php b/src/PHPCR/Shell/DependencyInjection/Container.php index e54e71a1..1484f93d 100644 --- a/src/PHPCR/Shell/DependencyInjection/Container.php +++ b/src/PHPCR/Shell/DependencyInjection/Container.php @@ -7,13 +7,14 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\DependencyInjection; -use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\DependencyInjection\ContainerBuilder; use PHPCR\Shell\PhpcrShell; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Reference; class Container extends ContainerBuilder { @@ -22,11 +23,11 @@ class Container extends ContainerBuilder /** * @var array Transports */ - protected $transports = array( + protected $transports = [ 'transport.transport.doctrinedbal' => 'PHPCR\Shell\Transport\Transport\DoctrineDbal', - 'transport.transport.jackrabbit' => 'PHPCR\Shell\Transport\Transport\Jackrabbit', - 'transport.transport.fs' => 'PHPCR\Shell\Transport\Transport\JackalopeFs', - ); + 'transport.transport.jackrabbit' => 'PHPCR\Shell\Transport\Transport\Jackrabbit', + 'transport.transport.fs' => 'PHPCR\Shell\Transport\Transport\JackalopeFs', + ]; public function __construct($mode = PhpcrShell::MODE_STANDALONE) { @@ -66,7 +67,7 @@ public function registerConfig() $this->register('config.profile_loader', 'PHPCR\Shell\Config\ProfileLoader') ->addArgument(new Reference('config.manager')); $this->register('config.config.phpcrsh', 'PHPCR\Shell\Config\Config') - ->setFactory([ new Reference('config.manager'), 'getPhpcrshConfig' ]); + ->setFactory([new Reference('config.manager'), 'getPhpcrshConfig']); } public function registerPhpcr() @@ -79,7 +80,7 @@ public function registerPhpcr() $registry = $this->register('phpcr.transport_registry', 'PHPCR\Shell\Transport\TransportRegistry'); foreach (array_keys($this->transports) as $transportId) { - $registry->addMethodCall('register', array(new Reference($transportId))); + $registry->addMethodCall('register', [new Reference($transportId)]); } $this->register('phpcr.session_manager.active', 'PHPCR\Shell\Phpcr\SessionManager') @@ -95,8 +96,8 @@ public function registerPhpcr() $repositoryDefinition = $this->register('phpcr.repository'); $sessionDefinition = $this->register('phpcr.session'); - $repositoryDefinition->setFactory([ new Reference('phpcr.session_manager'), 'getRepository' ]); - $sessionDefinition->setFactory([ new Reference('phpcr.session_manager'), 'getSession' ]); + $repositoryDefinition->setFactory([new Reference('phpcr.session_manager'), 'getRepository']); + $sessionDefinition->setFactory([new Reference('phpcr.session_manager'), 'getSession']); $this->register('dtl.glob.helper', 'DTL\Glob\GlobHelper'); } @@ -148,7 +149,7 @@ public function registerEvent() $dispatcher = $this->register('event.dispatcher', 'Symfony\Component\EventDispatcher\EventDispatcher'); foreach (array_keys($this->findTaggedServiceIds('event.subscriber')) as $id) { - $dispatcher->addMethodCall('addSubscriber', array(new Reference($id))); + $dispatcher->addMethodCall('addSubscriber', [new Reference($id)]); } } diff --git a/src/PHPCR/Shell/Event/ApplicationInitEvent.php b/src/PHPCR/Shell/Event/ApplicationInitEvent.php index a566227b..dff48dbc 100644 --- a/src/PHPCR/Shell/Event/ApplicationInitEvent.php +++ b/src/PHPCR/Shell/Event/ApplicationInitEvent.php @@ -7,12 +7,13 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Event; -use Symfony\Component\EventDispatcher\Event; use Symfony\Component\Console\Application; +use Symfony\Component\EventDispatcher\Event; /** * This event is fired when the main shell application diff --git a/src/PHPCR/Shell/Event/CommandExceptionEvent.php b/src/PHPCR/Shell/Event/CommandExceptionEvent.php index 096c48cb..4ed77dd1 100644 --- a/src/PHPCR/Shell/Event/CommandExceptionEvent.php +++ b/src/PHPCR/Shell/Event/CommandExceptionEvent.php @@ -7,13 +7,14 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Event; -use Symfony\Component\EventDispatcher\Event; -use Symfony\Component\Console\Output\OutputInterface; use PHPCR\Shell\Console\Application\ShellApplication; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\EventDispatcher\Event; class CommandExceptionEvent extends Event { diff --git a/src/PHPCR/Shell/Event/CommandPreRunEvent.php b/src/PHPCR/Shell/Event/CommandPreRunEvent.php index 5a5613be..e642a037 100644 --- a/src/PHPCR/Shell/Event/CommandPreRunEvent.php +++ b/src/PHPCR/Shell/Event/CommandPreRunEvent.php @@ -7,6 +7,7 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Event; diff --git a/src/PHPCR/Shell/Event/PhpcrShellEvents.php b/src/PHPCR/Shell/Event/PhpcrShellEvents.php index 1edb360d..95fbbf9d 100644 --- a/src/PHPCR/Shell/Event/PhpcrShellEvents.php +++ b/src/PHPCR/Shell/Event/PhpcrShellEvents.php @@ -7,34 +7,35 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Event; /** - * Events for Phpcr Shell + * Events for Phpcr Shell. * * @author Daniel Leech */ class PhpcrShellEvents { /** - * Fired when an exception is thrown + * Fired when an exception is thrown. */ const COMMAND_EXCEPTION = 'command.exception'; /** - * Fired before a command is executed + * Fired before a command is executed. */ const COMMAND_PRE_RUN = 'command.pre_run'; /** - * Fired when the application is initialized + * Fired when the application is initialized. */ const APPLICATION_INIT = 'application.init'; /** - * Fired when the profile needs to be populated + * Fired when the profile needs to be populated. */ const PROFILE_INIT = 'profile.init'; } diff --git a/src/PHPCR/Shell/Event/ProfileInitEvent.php b/src/PHPCR/Shell/Event/ProfileInitEvent.php index f833c215..093703d9 100644 --- a/src/PHPCR/Shell/Event/ProfileInitEvent.php +++ b/src/PHPCR/Shell/Event/ProfileInitEvent.php @@ -7,14 +7,15 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Event; use PHPCR\Shell\Config\Profile; -use Symfony\Component\EventDispatcher\Event; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\EventDispatcher\Event; /** * Event that is fired when the Profile needs to be initialized. diff --git a/src/PHPCR/Shell/Phpcr/PhpcrSession.php b/src/PHPCR/Shell/Phpcr/PhpcrSession.php index 113aae0a..2b43eeb8 100644 --- a/src/PHPCR/Shell/Phpcr/PhpcrSession.php +++ b/src/PHPCR/Shell/Phpcr/PhpcrSession.php @@ -7,18 +7,19 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Phpcr; -use PHPCR\SessionInterface; +use DTL\Glob\Finder\PhpcrTraversalFinder; use PHPCR\CredentialsInterface; -use PHPCR\Util\UUIDHelper; use PHPCR\PathNotFoundException; -use DTL\Glob\Finder\PhpcrTraversalFinder; +use PHPCR\SessionInterface; +use PHPCR\Util\UUIDHelper; /** - * Custom session wrapper for PHPCR Shell + * Custom session wrapper for PHPCR Shell. * * Supports current-working-directory etc. * @@ -38,7 +39,7 @@ public function __construct(SessionInterface $session, $finder = null) /** * Allow underlying session to be changed - * For example when changing workspaces + * For example when changing workspaces. * * @param SessionInterface $session */ @@ -157,7 +158,7 @@ public function getAbsTargetPath($srcPath, $targetPath) public function getAbsPaths($paths) { - $newPaths = array(); + $newPaths = []; foreach ($paths as $path) { $newPaths[] = $this->getAbsPath($path); } @@ -171,12 +172,12 @@ public function getAbsPaths($paths) * * @param string $pathOrId * - * @return NodeInterface - * * @throws PathNotFoundException if no accessible node is found at the specified path. * @throws ItemNotFoundException if no node with the specified * identifier exists or if this Session does not have read access to * the node with the specified identifier. + * + * @return NodeInterface */ public function getNodeByPathOrIdentifier($pathOrId) { diff --git a/src/PHPCR/Shell/Phpcr/SessionManager.php b/src/PHPCR/Shell/Phpcr/SessionManager.php index 40cb547a..1f4f3be4 100644 --- a/src/PHPCR/Shell/Phpcr/SessionManager.php +++ b/src/PHPCR/Shell/Phpcr/SessionManager.php @@ -7,31 +7,32 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Phpcr; +use PHPCR\SessionInterface; use PHPCR\Shell\Config\Profile; -use PHPCR\SimpleCredentials; use PHPCR\Shell\Transport\TransportRegistryInterface; -use PHPCR\SessionInterface; +use PHPCR\SimpleCredentials; /** - * PHPCR Session Manager + * PHPCR Session Manager. * * @author Daniel Leech */ class SessionManager { /** - * Active PHPCR session + * Active PHPCR session. * * @var \PHPCR\SessionInterface */ protected $session; /** - * The transport registry + * The transport registry. * * @var TransportRegistryInterface */ @@ -60,9 +61,7 @@ public function setSession(SessionInterface $session) } /** - * Initialize the PHPCR session - * - * @access private + * Initialize the PHPCR session. */ private function initSession() { @@ -85,7 +84,7 @@ private function initSession() } /** - * Change the current workspace + * Change the current workspace. * * @param string $workspaceName */ @@ -98,7 +97,7 @@ public function changeWorkspace($workspaceName) } /** - * Login (again) + * Login (again). * * @param string $username * @param string $password @@ -134,7 +133,7 @@ public function getSession() } /** - * Proxy for getting the repository (make mocking easier) + * Proxy for getting the repository (make mocking easier). * * @return \PHPCR\RepositoryInterface */ diff --git a/src/PHPCR/Shell/PhpcrShell.php b/src/PHPCR/Shell/PhpcrShell.php index d9fae152..77b4d7a6 100644 --- a/src/PHPCR/Shell/PhpcrShell.php +++ b/src/PHPCR/Shell/PhpcrShell.php @@ -7,18 +7,19 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell; -use PHPCR\Shell\Console\Application\SessionApplication; use PHPCR\SessionInterface; -use PHPCR\Shell\DependencyInjection\Container; +use PHPCR\Shell\Console\Application\SessionApplication; use PHPCR\Shell\Console\Application\Shell; +use PHPCR\Shell\DependencyInjection\Container; use PHPCR\Shell\Phpcr\PhpcrSession; /** - * PHPCRShell entry point + * PHPCRShell entry point. * * @author Daniel Leech */ @@ -32,9 +33,10 @@ class PhpcrShell const MODE_STANDALONE = 'standalon'; /** - * Create a new embedded shell + * Create a new embedded shell. + * + * @param SessionInterface $session * - * @param SessionInterface $session * @return Shell */ public static function createEmbeddedShell(SessionInterface $session) @@ -48,9 +50,10 @@ public static function createEmbeddedShell(SessionInterface $session) /** * Create a new (non-interactive) embedded application (e.g. for running - * single commands) + * single commands). + * + * @param SessionInterface $session * - * @param SessionInterface $session * @return EmbeddedApplication */ public static function createEmbeddedApplication(SessionInterface $session) @@ -63,7 +66,7 @@ public static function createEmbeddedApplication(SessionInterface $session) } /** - * Create a new standalone shell application + * Create a new standalone shell application. * * @return SessionApplication */ diff --git a/src/PHPCR/Shell/Query/ColumnOperand.php b/src/PHPCR/Shell/Query/ColumnOperand.php index 8f62aee9..fdba6cc2 100644 --- a/src/PHPCR/Shell/Query/ColumnOperand.php +++ b/src/PHPCR/Shell/Query/ColumnOperand.php @@ -7,6 +7,7 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Query; diff --git a/src/PHPCR/Shell/Query/FunctionOperand.php b/src/PHPCR/Shell/Query/FunctionOperand.php index 9479abe2..4eaf7bc7 100644 --- a/src/PHPCR/Shell/Query/FunctionOperand.php +++ b/src/PHPCR/Shell/Query/FunctionOperand.php @@ -7,12 +7,13 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Query; -use PHPCR\Query\RowInterface; use PHPCR\Query\InvalidQueryException; +use PHPCR\Query\RowInterface; /** * Simple class to represent function operands in query @@ -32,7 +33,7 @@ public function __construct($functionName, $arguments) } /** - * Replace the Operand objects with their evaluations + * Replace the Operand objects with their evaluations. * * @param array Array of function closures * @param RowInterface $row @@ -44,14 +45,14 @@ private function replaceColumnOperands($functionMap, RowInterface $row) $this->arguments[$key] = $row->getNode($value->getSelectorName())->getPropertyValue($value->getPropertyName()); } - if ($value instanceof FunctionOperand) { + if ($value instanceof self) { $this->arguments[$key] = $value->execute($functionMap, $row, $value); } } } /** - * Evaluate the result of the function + * Evaluate the result of the function. * * @param array Array of function closures * @param RowInterface $row @@ -78,9 +79,10 @@ public function execute($functionMap, $row) } /** - * Used as callback for closure functions + * Used as callback for closure functions. * * @param array Array of values which must be scalars + * * @throws InvalidArgumentException */ public function validateScalarArray($array) @@ -103,7 +105,7 @@ public function validateScalarArray($array) } /** - * Return the name of the function to execute + * Return the name of the function to execute. * * @return string */ @@ -113,7 +115,7 @@ public function getFunctionName() } /** - * Return the functions arguments + * Return the functions arguments. * * @return mixed */ diff --git a/src/PHPCR/Shell/Query/UpdateParser.php b/src/PHPCR/Shell/Query/UpdateParser.php index 497d4a89..ac0aa72c 100644 --- a/src/PHPCR/Shell/Query/UpdateParser.php +++ b/src/PHPCR/Shell/Query/UpdateParser.php @@ -7,14 +7,15 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Query; use PHPCR\Query\InvalidQueryException; use PHPCR\Query\QOM\SourceInterface; -use PHPCR\Util\QOM\Sql2ToQomQueryConverter; use PHPCR\Util\QOM\Sql2Scanner; +use PHPCR\Util\QOM\Sql2ToQomQueryConverter; /** * Parse "UPDATE" queries. @@ -49,8 +50,8 @@ private function doParse($sql2) $this->sql2 = $sql2; $source = null; $constraint = null; - $updates = array(); - $applies = array(); + $updates = []; + $applies = []; while ($this->scanner->lookupNextToken() !== '') { switch (strtoupper($this->scanner->lookupNextToken())) { @@ -71,7 +72,7 @@ private function doParse($sql2) $constraint = $this->parseConstraint(); break; default: - throw new InvalidQueryException('Expected end of query, got "' . $this->scanner->lookupNextToken() . '" in ' . $this->sql2); + throw new InvalidQueryException('Expected end of query, got "'.$this->scanner->lookupNextToken().'" in '.$this->sql2); } } @@ -81,7 +82,7 @@ private function doParse($sql2) $query = $this->factory->createQuery($source, $constraint); - $res = new \ArrayObject(array($query, $updates, $constraint, $applies)); + $res = new \ArrayObject([$query, $updates, $constraint, $applies]); return $res; } @@ -89,7 +90,7 @@ private function doParse($sql2) /** * Parse the SET section of the query, returning * an array containing the property names ( , @@ -101,14 +102,14 @@ private function doParse($sql2) */ private function parseUpdates() { - $updates = array(); + $updates = []; while (true) { - $property = array( + $property = [ 'selector' => null, - 'name' => null, - 'value' => null, - ); + 'name' => null, + 'value' => null, + ]; // parse left side $selectorName = $this->scanner->fetchNextToken(); @@ -181,7 +182,7 @@ private function parseOperand() private function parseApply() { - $functions = array(); + $functions = []; while (true) { $token = strtoupper($this->scanner->lookupNextToken()); @@ -209,17 +210,17 @@ private function parseFunction() $functionName = $this->scanner->fetchNextToken(); $this->scanner->expectToken('('); - $args = array(); + $args = []; $next = true; while ($next && $next !== ')') { $args[] = $this->parseOperand(); $next = $this->scanner->fetchNextToken(); - if (!in_array($next, array(',', ')', ''))) { + if (!in_array($next, [',', ')', ''])) { throw new InvalidQueryException(sprintf('Invalid function argument delimiter "%s" in "%s"', $next, $this->sql2)); } } - return array($functionName, $args); + return [$functionName, $args]; } } diff --git a/src/PHPCR/Shell/Query/UpdateProcessor.php b/src/PHPCR/Shell/Query/UpdateProcessor.php index 5f7bf694..dc85c360 100644 --- a/src/PHPCR/Shell/Query/UpdateProcessor.php +++ b/src/PHPCR/Shell/Query/UpdateProcessor.php @@ -7,6 +7,7 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Query; @@ -15,20 +16,20 @@ use Symfony\Component\ExpressionLanguage\ExpressionLanguage; /** - * Processor for node updates + * Processor for node updates. */ class UpdateProcessor { /** - * Functions available when calling SET + * Functions available when calling SET. * * @var \Closure[] */ - private $functionMap = array(); + private $functionMap = []; public function __construct(ExpressionLanguage $expressionLanguage) { - $this->functionMapApply = array( + $this->functionMapApply = [ 'mixin_add' => function ($operand, $row, $mixinName) { $node = $row->getNode(); $node->addMixin($mixinName); @@ -40,15 +41,15 @@ public function __construct(ExpressionLanguage $expressionLanguage) $node->removeMixin($mixinName); } }, - ); + ]; - $this->functionMapSet = array( + $this->functionMapSet = [ 'expr' => function ($operand, $row, $expression) use ($expressionLanguage) { return $expressionLanguage->evaluate( $expression, - array( + [ 'row' => $row, - ) + ] ); }, 'array_replace' => function ($operand, $row, $v, $x, $y) { @@ -61,7 +62,7 @@ public function __construct(ExpressionLanguage $expressionLanguage) return $v; }, - 'array_remove' => function ($operand, $row, $v, $x) { + 'array_remove' => function ($operand, $row, $v, $x) { foreach ($v as $key => $value) { if ($value === $x) { unset($v[$key]); @@ -106,11 +107,11 @@ public function __construct(ExpressionLanguage $expressionLanguage) return array_values($current); }, - ); + ]; } /** - * Update a node indicated in $propertyData in $row + * Update a node indicated in $propertyData in $row. * * @param PHPCR\Query\RowInterface * @param array diff --git a/src/PHPCR/Shell/Query/Validator.php b/src/PHPCR/Shell/Query/Validator.php index f64047e3..6dd2d1dc 100644 --- a/src/PHPCR/Shell/Query/Validator.php +++ b/src/PHPCR/Shell/Query/Validator.php @@ -7,14 +7,16 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ + namespace \PHPCR\Shell\Query; class Validator { /** - * Assert that queries are terminated with ";" + * Assert that queries are terminated with ";". * * @param string $sql2 */ diff --git a/src/PHPCR/Shell/Serializer/NodeNormalizer.php b/src/PHPCR/Shell/Serializer/NodeNormalizer.php index d7fef286..07c0534a 100644 --- a/src/PHPCR/Shell/Serializer/NodeNormalizer.php +++ b/src/PHPCR/Shell/Serializer/NodeNormalizer.php @@ -7,26 +7,27 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Serializer; -use Symfony\Component\Serializer\Normalizer\NormalizerInterface; use PHPCR\NodeInterface; +use PHPCR\PropertyInterface; use PHPCR\PropertyType; -use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Exception\InvalidArgumentException; -use PHPCR\PropertyInterface; +use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; +use Symfony\Component\Serializer\Normalizer\NormalizerInterface; /** - * Normalizer for PHPCR Nodes + * Normalizer for PHPCR Nodes. * * @author Daniel Leech */ class NodeNormalizer implements NormalizerInterface, DenormalizerInterface { protected $allowBinary; - protected $notes = array(); + protected $notes = []; public function __construct($allowBinary = false) { @@ -39,11 +40,11 @@ public function getNotes() } /** - * {@inheritDoc} + * {@inheritdoc} */ - public function normalize($node, $format = null, array $context = array()) + public function normalize($node, $format = null, array $context = []) { - $res = array(); + $res = []; foreach ($node->getProperties() as $property) { if (false === $this->isPropertyEditable($property)) { @@ -55,11 +56,11 @@ public function normalize($node, $format = null, array $context = array()) $propertyValue = $property->getValue(); $propertyName = $property->getName(); - if (in_array($property->getType(), array(PropertyType::REFERENCE, PropertyType::WEAKREFERENCE))) { - $nodeUuids = array(); + if (in_array($property->getType(), [PropertyType::REFERENCE, PropertyType::WEAKREFERENCE])) { + $nodeUuids = []; if (false === is_array($propertyValue)) { - $propertyValue = array($propertyValue); + $propertyValue = [$propertyValue]; } foreach ($propertyValue as $node) { @@ -72,17 +73,17 @@ public function normalize($node, $format = null, array $context = array()) } } - $res[$propertyName] = array( - 'type' => PropertyType::nameFromValue($propertyType), + $res[$propertyName] = [ + 'type' => PropertyType::nameFromValue($propertyType), 'value' => $propertyValue, - ); + ]; } return $res; } /** - * {@inheritDoc} + * {@inheritdoc} */ public function supportsNormalization($data, $format = null) { @@ -90,9 +91,9 @@ public function supportsNormalization($data, $format = null) } /** - * {@inheritDoc} + * {@inheritdoc} */ - public function denormalize($data, $class, $format = null, array $context = array()) + public function denormalize($data, $class, $format = null, array $context = []) { if (!$data) { throw new \InvalidArgumentException( @@ -108,7 +109,7 @@ public function denormalize($data, $class, $format = null, array $context = arra $node = $context['node']; - $errors = array(); + $errors = []; // Update / remove existing properties foreach ($node->getProperties() as $property) { @@ -163,7 +164,7 @@ public function denormalize($data, $class, $format = null, array $context = arra } /** - * {@inheritDoc} + * {@inheritdoc} */ public function supportsDenormalization($data, $type, $format = null) { @@ -172,7 +173,7 @@ public function supportsDenormalization($data, $type, $format = null) /** * If the value is a scalar value convert it into - * an array with default values + * an array with default values. * * @param mixed * @@ -181,21 +182,21 @@ public function supportsDenormalization($data, $type, $format = null) private function normalizeDatum($value) { if (is_scalar($value)) { - return array( + return [ 'value' => $value, - 'type' => null, - ); + 'type' => null, + ]; } return $value; } /** - * Return false if property type is not editable + * Return false if property type is not editable. * * (e.g. property type is binary) * - * @return boolean + * @return bool */ private function isPropertyEditable(PropertyInterface $property) { diff --git a/src/PHPCR/Shell/Serializer/YamlEncoder.php b/src/PHPCR/Shell/Serializer/YamlEncoder.php index f57851c2..2665978c 100644 --- a/src/PHPCR/Shell/Serializer/YamlEncoder.php +++ b/src/PHPCR/Shell/Serializer/YamlEncoder.php @@ -7,32 +7,33 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Serializer; -use Symfony\Component\Yaml\Yaml; -use Symfony\Component\Serializer\Encoder\EncoderInterface; use Symfony\Component\Serializer\Encoder\DecoderInterface; +use Symfony\Component\Serializer\Encoder\EncoderInterface; +use Symfony\Component\Yaml\Yaml; /** - * Encodes YAML data + * Encodes YAML data. * * @author Daniel Leech */ class YamlEncoder implements EncoderInterface, DecoderInterface { /** - * Encodes PHP data to a YAML string + * Encodes PHP data to a YAML string. * * {@inheritdoc} */ - public function encode($data, $format, array $context = array()) + public function encode($data, $format, array $context = []) { return Yaml::dump($data); } - public function decode($data, $format, array $context = array()) + public function decode($data, $format, array $context = []) { $arr = Yaml::parse($data); diff --git a/src/PHPCR/Shell/Subscriber/AliasSubscriber.php b/src/PHPCR/Shell/Subscriber/AliasSubscriber.php index bcccbe2f..58324b8b 100644 --- a/src/PHPCR/Shell/Subscriber/AliasSubscriber.php +++ b/src/PHPCR/Shell/Subscriber/AliasSubscriber.php @@ -7,15 +7,16 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Subscriber; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use PHPCR\Shell\Event\PhpcrShellEvents; -use PHPCR\Shell\Event\CommandPreRunEvent; -use PHPCR\Shell\Console\Input\StringInput; use PHPCR\Shell\Config\ConfigManager; +use PHPCR\Shell\Console\Input\StringInput; +use PHPCR\Shell\Event\CommandPreRunEvent; +use PHPCR\Shell\Event\PhpcrShellEvents; +use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** * Check to see if the input references a command alias and @@ -37,9 +38,9 @@ public function __construct(ConfigManager $configManager) public static function getSubscribedEvents() { - return array( + return [ PhpcrShellEvents::COMMAND_PRE_RUN => 'handleAlias', - ); + ]; } /** diff --git a/src/PHPCR/Shell/Subscriber/AutoSaveSubscriber.php b/src/PHPCR/Shell/Subscriber/AutoSaveSubscriber.php index 89e6e533..aee25682 100644 --- a/src/PHPCR/Shell/Subscriber/AutoSaveSubscriber.php +++ b/src/PHPCR/Shell/Subscriber/AutoSaveSubscriber.php @@ -7,16 +7,17 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Subscriber; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Symfony\Component\Console\Event\ConsoleTerminateEvent; use Symfony\Component\Console\ConsoleEvents; +use Symfony\Component\Console\Event\ConsoleTerminateEvent; +use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** - * Automatically save on console terminate event + * Automatically save on console terminate event. * * @author Daniel Leech */ @@ -24,9 +25,9 @@ class AutoSaveSubscriber implements EventSubscriberInterface { public static function getSubscribedEvents() { - return array( + return [ ConsoleEvents::TERMINATE => 'handleTerminate', - ); + ]; } public function handleTerminate(ConsoleTerminateEvent $event) diff --git a/src/PHPCR/Shell/Subscriber/ConfigInitSubscriber.php b/src/PHPCR/Shell/Subscriber/ConfigInitSubscriber.php index 330e552c..914bcc4d 100644 --- a/src/PHPCR/Shell/Subscriber/ConfigInitSubscriber.php +++ b/src/PHPCR/Shell/Subscriber/ConfigInitSubscriber.php @@ -7,18 +7,19 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Subscriber; -use PHPCR\Shell\Event\PhpcrShellEvents; +use PHPCR\Shell\Config\ConfigManager; use PHPCR\Shell\Event\ApplicationInitEvent; +use PHPCR\Shell\Event\PhpcrShellEvents; use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use PHPCR\Shell\Config\ConfigManager; /** * Subscriber to initialize the configuration if it does not - * already exist upon application initialization + * already exist upon application initialization. * * @author Daniel Leech */ @@ -33,9 +34,9 @@ public function __construct(ConfigManager $configManager) public static function getSubscribedEvents() { - return array( + return [ PhpcrShellEvents::APPLICATION_INIT => 'handleApplicationInit', - ); + ]; } public function handleApplicationInit(ApplicationInitEvent $event) diff --git a/src/PHPCR/Shell/Subscriber/ExceptionSubscriber.php b/src/PHPCR/Shell/Subscriber/ExceptionSubscriber.php index 26d1ab61..0c9fb111 100644 --- a/src/PHPCR/Shell/Subscriber/ExceptionSubscriber.php +++ b/src/PHPCR/Shell/Subscriber/ExceptionSubscriber.php @@ -7,18 +7,19 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Subscriber; use Jackalope\NotImplementedException; use PHPCR\Shell\Event\CommandExceptionEvent; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; use PHPCR\Shell\Event\PhpcrShellEvents; use PHPCR\UnsupportedRepositoryOperationException; +use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** - * Try and better handle exceptions + * Try and better handle exceptions. * * @author Daniel Leech */ @@ -26,9 +27,9 @@ class ExceptionSubscriber implements EventSubscriberInterface { public static function getSubscribedEvents() { - return array( + return [ PhpcrShellEvents::COMMAND_EXCEPTION => 'handleException', - ); + ]; } public function handleException(CommandExceptionEvent $event) @@ -42,13 +43,13 @@ public function handleException(CommandExceptionEvent $event) } if ($exception instanceof NotImplementedException) { - $output->writeln('Not implemented: ' . $exception->getMessage() . ''); + $output->writeln('Not implemented: '.$exception->getMessage().''); } - $output->writeln('[' . get_class($exception) .'] ' . $exception->getMessage() . ''); + $output->writeln('['.get_class($exception).'] '.$exception->getMessage().''); if ($application->isDebug()) { - $output->writeln('' . $exception->getTraceAsString() . ''); + $output->writeln(''.$exception->getTraceAsString().''); } } } diff --git a/src/PHPCR/Shell/Subscriber/ProfileFromSessionInputSubscriber.php b/src/PHPCR/Shell/Subscriber/ProfileFromSessionInputSubscriber.php index 25a01f5f..f018805e 100644 --- a/src/PHPCR/Shell/Subscriber/ProfileFromSessionInputSubscriber.php +++ b/src/PHPCR/Shell/Subscriber/ProfileFromSessionInputSubscriber.php @@ -7,21 +7,22 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Subscriber; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; use PHPCR\Shell\Event\PhpcrShellEvents; use PHPCR\Shell\Event\ProfileInitEvent; +use Symfony\Component\EventDispatcher\EventSubscriberInterface; class ProfileFromSessionInputSubscriber implements EventSubscriberInterface { public static function getSubscribedEvents() { - return array( + return [ PhpcrShellEvents::PROFILE_INIT => 'handleProfileInit', - ); + ]; } public function handleProfileInit(ProfileInitEvent $e) @@ -29,22 +30,22 @@ public function handleProfileInit(ProfileInitEvent $e) $profile = $e->getProfile(); $input = $e->getInput(); - $transportOptions = array( - 'transport' => 'name', + $transportOptions = [ + 'transport' => 'name', 'db-username' => 'db_username', - 'db-name' => 'db_name', + 'db-name' => 'db_name', 'db-password' => 'db_password', - 'db-host' => 'db_host', - 'db-path' => 'db_path', - 'db-driver' => 'db_driver', - 'repo-url' => 'repo_url', - 'repo-path' => 'repo_path', - ); - - $phpcrOptions = array( + 'db-host' => 'db_host', + 'db-path' => 'db_path', + 'db-driver' => 'db_driver', + 'repo-url' => 'repo_url', + 'repo-path' => 'repo_path', + ]; + + $phpcrOptions = [ 'phpcr-username' => 'username', 'phpcr-password' => 'password', - ); + ]; foreach ($transportOptions as $optionName => $configName) { $value = $input->getOption($optionName); @@ -62,7 +63,7 @@ public function handleProfileInit(ProfileInitEvent $e) 'DB file "%s" does not exist.', $value)); } - $value = realpath(dirname($value)) . DIRECTORY_SEPARATOR . basename($value); + $value = realpath(dirname($value)).DIRECTORY_SEPARATOR.basename($value); break; default: // all good diff --git a/src/PHPCR/Shell/Subscriber/ProfileLoaderSubscriber.php b/src/PHPCR/Shell/Subscriber/ProfileLoaderSubscriber.php index 5fc16ea7..8225b176 100644 --- a/src/PHPCR/Shell/Subscriber/ProfileLoaderSubscriber.php +++ b/src/PHPCR/Shell/Subscriber/ProfileLoaderSubscriber.php @@ -1,15 +1,25 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ + namespace PHPCR\Shell\Subscriber; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use PHPCR\Shell\Config\Profile; +use PHPCR\Shell\Config\ProfileLoader; use PHPCR\Shell\Event\PhpcrShellEvents; use PHPCR\Shell\Event\ProfileInitEvent; use Symfony\Component\Console\Helper\QuestionHelper; -use PHPCR\Shell\Config\ProfileLoader; use Symfony\Component\Console\Output\OutputInterface; -use PHPCR\Shell\Config\Profile; use Symfony\Component\Console\Question\Question; +use Symfony\Component\EventDispatcher\EventSubscriberInterface; class ProfileLoaderSubscriber implements EventSubscriberInterface { @@ -18,9 +28,9 @@ class ProfileLoaderSubscriber implements EventSubscriberInterface public static function getSubscribedEvents() { - return array( + return [ PhpcrShellEvents::PROFILE_INIT => 'handleProfileInit', - ); + ]; } public function __construct(ProfileLoader $profileLoader, $questionHelper) @@ -48,7 +58,7 @@ public function handleProfileInit(ProfileInitEvent $e) if (count($profileNames) === 0) { $output->writeln('No transport specified, and no profiles available.'); - $output->writeln(<<writeln(<<<'EOT' You must specify the connection parameters, for example: diff --git a/src/PHPCR/Shell/Subscriber/ProfileWriterSubscriber.php b/src/PHPCR/Shell/Subscriber/ProfileWriterSubscriber.php index c147234b..5e605bdc 100644 --- a/src/PHPCR/Shell/Subscriber/ProfileWriterSubscriber.php +++ b/src/PHPCR/Shell/Subscriber/ProfileWriterSubscriber.php @@ -7,15 +7,16 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Subscriber; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use PHPCR\Shell\Config\ProfileLoader; use PHPCR\Shell\Event\PhpcrShellEvents; use PHPCR\Shell\Event\ProfileInitEvent; use Symfony\Component\Console\Helper\QuestionHelper; -use PHPCR\Shell\Config\ProfileLoader; +use Symfony\Component\EventDispatcher\EventSubscriberInterface; class ProfileWriterSubscriber implements EventSubscriberInterface { @@ -24,9 +25,9 @@ class ProfileWriterSubscriber implements EventSubscriberInterface public static function getSubscribedEvents() { - return array( + return [ PhpcrShellEvents::PROFILE_INIT => 'handleProfileInit', - ); + ]; } public function __construct(ProfileLoader $profileLoader, $questionHelper) diff --git a/src/PHPCR/Shell/Test/ApplicationTester.php b/src/PHPCR/Shell/Test/ApplicationTester.php index 8dad7b1a..2d508ea8 100644 --- a/src/PHPCR/Shell/Test/ApplicationTester.php +++ b/src/PHPCR/Shell/Test/ApplicationTester.php @@ -7,17 +7,18 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Test; +use PHPCR\Shell\Console\Application\ShellApplication; +use PHPCR\Shell\Console\Input\StringInput; use Symfony\Component\Console\Application; use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\StreamOutput; -use PHPCR\Shell\Console\Input\StringInput; -use PHPCR\Shell\Console\Application\ShellApplication; /** * Eases the testing of console applications. @@ -62,9 +63,9 @@ public function __construct(Application $application, ShellApplication $shellApp * @param array $input An array of arguments and options * @param array $options An array of options * - * @return integer The command exit code + * @return int The command exit code */ - public function run(array $input, $options = array()) + public function run(array $input, $options = []) { $this->input = new ArrayInput($input); @@ -88,7 +89,7 @@ public function run(array $input, $options = array()) /** * Gets the display returned by the last execution of the application. * - * @param Boolean $normalize Whether to normalize end of lines to \n or not + * @param bool $normalize Whether to normalize end of lines to \n or not * * @return string The display */ diff --git a/src/PHPCR/Shell/Test/CliContext.php b/src/PHPCR/Shell/Test/CliContext.php index bc533720..ddb8bd0b 100644 --- a/src/PHPCR/Shell/Test/CliContext.php +++ b/src/PHPCR/Shell/Test/CliContext.php @@ -7,30 +7,22 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Test; -use Jackalope\RepositoryFactoryJackrabbit; -use PHPCR\SimpleCredentials; -use PHPCR\Util\NodeHelper; -use Symfony\Component\Filesystem\Filesystem; -use PHPCR\PathNotFoundException; -use PHPCR\Util\PathHelper; -use PHPCR\PropertyInterface; -use PHPCR\PropertyType; -use Behat\Behat\Context\SnippetAcceptingContext; use Behat\Behat\Context\Context; -use PHPCR\NodeInterface; +use Behat\Behat\Context\SnippetAcceptingContext; use Behat\Gherkin\Node\PyStringNode; -use Behat\Gherkin\Node\TableNode; +use Symfony\Component\Filesystem\Filesystem; /** * Features context. */ class CliContext implements Context, SnippetAcceptingContext { - private $output = array(); + private $output = []; private $rootPath; private $lastExitCode; private $fixturesDir; @@ -43,18 +35,18 @@ class CliContext implements Context, SnippetAcceptingContext */ public function beforeScenario() { - $this->output = array(); + $this->output = []; - $this->rootPath = realpath(__DIR__ . '/../../../..'); - $dir = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'phpcr-shell' . DIRECTORY_SEPARATOR . + $this->rootPath = realpath(__DIR__.'/../../../..'); + $dir = sys_get_temp_dir().DIRECTORY_SEPARATOR.'phpcr-shell'.DIRECTORY_SEPARATOR. md5(microtime() * rand(0, 10000)); $this->fixturesDir = realpath(__DIR__.'/../../../../features/fixtures/'); $this->workingDir = $dir; - putenv('PHPCRSH_HOME=' . $dir); + putenv('PHPCRSH_HOME='.$dir); mkdir($this->workingDir, 0777, true); - mkdir($this->workingDir . '/profiles'); + mkdir($this->workingDir.'/profiles'); chdir($this->workingDir); $this->filesystem = new Filesystem(); } @@ -67,7 +59,7 @@ public function beforeScenario() public static function cleanTestFolders() { $fs = new Filesystem(); - $fs->remove(sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'phpcr-shell'); + $fs->remove(sys_get_temp_dir().DIRECTORY_SEPARATOR.'phpcr-shell'); } private function exec($command) @@ -91,7 +83,7 @@ public function execShell($argsAndOptions) public function printOutput() { foreach ($this->output as $line) { - echo $line . PHP_EOL; + echo $line.PHP_EOL; } } @@ -100,7 +92,7 @@ public function printOutput() */ public function iHaveTheFollowingProfile($profileName, PyStringNode $text) { - file_put_contents($this->workingDir . '/profiles/' . $profileName . '.yml', $text->getRaw()); + file_put_contents($this->workingDir.'/profiles/'.$profileName.'.yml', $text->getRaw()); } /** @@ -109,10 +101,10 @@ public function iHaveTheFollowingProfile($profileName, PyStringNode $text) public function initializeDoctrineDbal() { $this->filesystem->copy( - $this->fixturesDir . '/jackalope-doctrine-dbal-cli-config.php', - $this->workingDir . '/cli-config.php' + $this->fixturesDir.'/jackalope-doctrine-dbal-cli-config.php', + $this->workingDir.'/cli-config.php' ); - $this->exec($this->rootPath . '/vendor/jackalope/jackalope-doctrine-dbal/bin/jackalope jackalope:init:dbal --force'); + $this->exec($this->rootPath.'/vendor/jackalope/jackalope-doctrine-dbal/bin/jackalope jackalope:init:dbal --force'); } /** diff --git a/src/PHPCR/Shell/Test/ContextBase.php b/src/PHPCR/Shell/Test/ContextBase.php index 6e631a1c..c9d71708 100644 --- a/src/PHPCR/Shell/Test/ContextBase.php +++ b/src/PHPCR/Shell/Test/ContextBase.php @@ -7,23 +7,24 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Test; +use Behat\Behat\Context\Context; +use Behat\Behat\Context\SnippetAcceptingContext; +use Behat\Gherkin\Node\PyStringNode; +use Behat\Gherkin\Node\TableNode; use Jackalope\RepositoryFactoryJackrabbit; -use PHPCR\SimpleCredentials; -use PHPCR\Util\NodeHelper; -use Symfony\Component\Filesystem\Filesystem; +use PHPCR\NodeInterface; use PHPCR\PathNotFoundException; -use PHPCR\Util\PathHelper; use PHPCR\PropertyInterface; use PHPCR\PropertyType; -use Behat\Behat\Context\SnippetAcceptingContext; -use Behat\Behat\Context\Context; -use PHPCR\NodeInterface; -use Behat\Gherkin\Node\PyStringNode; -use Behat\Gherkin\Node\TableNode; +use PHPCR\SimpleCredentials; +use PHPCR\Util\NodeHelper; +use PHPCR\Util\PathHelper; +use Symfony\Component\Filesystem\Filesystem; /** * Features context. @@ -36,7 +37,7 @@ abstract class ContextBase implements Context, SnippetAcceptingContext protected $currentWorkspaceName = 'default'; /** - * Return the application tester + * Return the application tester. */ abstract protected function createTester(); @@ -48,7 +49,7 @@ abstract protected function createTester(); */ public function beforeScenario() { - $dir = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'phpcr-shell' . DIRECTORY_SEPARATOR . + $dir = sys_get_temp_dir().DIRECTORY_SEPARATOR.'phpcr-shell'.DIRECTORY_SEPARATOR. md5(microtime() * rand(0, 10000)); $this->workingDir = $dir; @@ -67,7 +68,7 @@ public function beforeScenario() public static function cleanTestFolders() { $fs = new Filesystem(); - $fs->remove(sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'phpcr-shell'); + $fs->remove(sys_get_temp_dir().DIRECTORY_SEPARATOR.'phpcr-shell'); } protected function getSession($workspaceName = null, $force = false) @@ -76,7 +77,7 @@ protected function getSession($workspaceName = null, $force = false) $workspaceName = $this->currentWorkspaceName; } - static $sessions = array(); + static $sessions = []; if (false === $force && isset($sessions[$workspaceName])) { $session = $sessions[$workspaceName]; @@ -84,9 +85,9 @@ protected function getSession($workspaceName = null, $force = false) return $session; } - $params = array( + $params = [ 'jackalope.jackrabbit_uri' => 'http://localhost:8080/server/', - ); + ]; $factory = new RepositoryFactoryJackrabbit(); $repository = $factory->getRepository($params); @@ -120,7 +121,7 @@ private function getFixtureFilename($filename) { $fixtureFile = realpath(__DIR__).'/../../../../features/fixtures/'.$filename; if (!file_exists($fixtureFile)) { - throw new \Exception('Fixtures do not exist at ' . $fixtureFile); + throw new \Exception('Fixtures do not exist at '.$fixtureFile); } return $fixtureFile; @@ -128,7 +129,7 @@ private function getFixtureFilename($filename) private function getWorkingFilePath($filename) { - return $this->workingDir . DIRECTORY_SEPARATOR . $filename; + return $this->workingDir.DIRECTORY_SEPARATOR.$filename; } private function executeCommand($command) @@ -244,10 +245,10 @@ public function theCommandShouldNotFail() $exitCode = $this->applicationTester->getLastExitCode(); if ($exitCode != 0) { - throw new \Exception('Command failed: (' . $exitCode . ') ' . $this->getOutput()); + throw new \Exception('Command failed: ('.$exitCode.') '.$this->getOutput()); } - \PHPUnit_Framework_Assert::assertEquals(0, $exitCode, 'Command exited with code: ' . $exitCode); + \PHPUnit_Framework_Assert::assertEquals(0, $exitCode, 'Command exited with code: '.$exitCode); } /** @@ -257,7 +258,7 @@ public function theCommandShouldFail() { $exitCode = $this->applicationTester->getLastExitCode(); - \PHPUnit_Framework_Assert::assertNotEquals(0, $exitCode, 'Command exited with code ' . $exitCode); + \PHPUnit_Framework_Assert::assertNotEquals(0, $exitCode, 'Command exited with code '.$exitCode); } /** @@ -270,6 +271,7 @@ public function theCommandShouldFailWithMessage($arg1) \PHPUnit_Framework_Assert::assertEquals($arg1, $output); } + /** * @Given /^the file "([^"]*)" should exist$/ */ @@ -347,13 +349,13 @@ public function theFollowingNodesShouldExist(TableNode $table) try { $node = $session->getNode($row[0]); } catch (PathNotFoundException $e) { - throw new PathNotFoundException('Node ' . $row[0] . ' not found'); + throw new PathNotFoundException('Node '.$row[0].' not found'); } } } /** - * Depends on session:info command + * Depends on session:info command. * * @Then /^I should not be logged into the session$/ */ @@ -391,7 +393,7 @@ public function thereShouldExistANodeAt($arg1) try { $session->getNode($arg1); } catch (PathNotFoundException $e) { - throw new \Exception('Node does at path ' . $arg1 . ' does not exist.'); + throw new \Exception('Node does at path '.$arg1.' does not exist.'); } } @@ -405,7 +407,7 @@ public function thereShouldExistANodeAtBefore($arg1, $arg2) try { $node = $session->getNode($arg2); } catch (PathNotFoundException $e) { - throw new \Exception('Node does at path ' . $arg1 . ' does not exist.'); + throw new \Exception('Node does at path '.$arg1.' does not exist.'); } $parent = $session->getNode(PathHelper::getParentPath($arg2)); @@ -421,7 +423,7 @@ public function thereShouldExistANodeAtBefore($arg1, $arg2) } if (null === $targetNode) { - throw new \Exception('Could not find child node ' . $arg1); + throw new \Exception('Could not find child node '.$arg1); } \PHPUnit_Framework_Assert::assertEquals($arg2, $afterNode->getPath()); @@ -442,7 +444,7 @@ public function theNodeAtShouldHaveTheMixin($arg1, $arg2) } } - throw new \Exception('Node "' . $arg1 . '" does not have node type "' . $arg2 . '"'); + throw new \Exception('Node "'.$arg1.'" does not have node type "'.$arg2.'"'); } /** @@ -456,7 +458,7 @@ public function theNodeAtShouldNotHaveTheMixin($arg1, $arg2) foreach ($mixinNodeTypes as $mixinNodeType) { if ($mixinNodeType->getName() == $arg2) { - throw new \Exception('Node "' . $arg1 . '" has the node type "' . $arg2 . '"'); + throw new \Exception('Node "'.$arg1.'" has the node type "'.$arg2.'"'); } } } @@ -470,7 +472,7 @@ public function thereShouldNotExistANodeAt($arg1) try { $session->getNode($arg1); - throw new \Exception('Node at path ' . $arg1 . ' exists.'); + throw new \Exception('Node at path '.$arg1.' exists.'); } catch (PathNotFoundException $e) { // good.. not does not exist } @@ -503,7 +505,7 @@ public function thereShouldNotExistAPropertyAt($arg1) try { $session->getProperty($arg1); - throw new \Exception('Property exists at "' . $arg1 . '"'); + throw new \Exception('Property exists at "'.$arg1.'"'); } catch (PathNotFoundException $e) { // good } @@ -514,7 +516,7 @@ public function thereShouldNotExistAPropertyAt($arg1) */ public function theEnvironmentVariableIsSetTo($arg1, $arg2) { - putenv($arg1 . '=' . $arg2); + putenv($arg1.'='.$arg2); } /** @@ -545,6 +547,7 @@ public function iCreateANodeAt($arg1) NodeHelper::createPath($session, $arg1); $session->save(); } + /** * @Given /^there should exist a workspace called "([^"]*)"$/ */ @@ -644,7 +647,7 @@ public function thereShouldNotExistANodeTypeNamed($arg1) } catch (\Exception $e) { } - throw new \Exception('Node type ' . $arg1 . ' exists'); + throw new \Exception('Node type '.$arg1.' exists'); } /** @@ -652,18 +655,18 @@ public function thereShouldNotExistANodeTypeNamed($arg1) */ public function iHaveAnEditorWhichProducesTheFollowing(PyStringNode $string) { - $tmpFile = $this->workingDir . DIRECTORY_SEPARATOR . 'fake-editor-file'; - $editorFile = $this->workingDir . DIRECTORY_SEPARATOR . 'fakeed'; + $tmpFile = $this->workingDir.DIRECTORY_SEPARATOR.'fake-editor-file'; + $editorFile = $this->workingDir.DIRECTORY_SEPARATOR.'fakeed'; file_put_contents($tmpFile, $string->getRaw()); chmod($tmpFile, 0777); - $script = array(); + $script = []; $script[] = '#!/bin/bash'; $script[] = 'FILE=$1'; - $script[] = 'cat ' . $tmpFile . ' > $FILE'; + $script[] = 'cat '.$tmpFile.' > $FILE'; file_put_contents($editorFile, implode("\n", $script)); chmod($editorFile, 0777); - putenv('EDITOR=' . $editorFile); + putenv('EDITOR='.$editorFile); } /** @@ -681,7 +684,7 @@ public function theCurrentNodeShouldBe($arg1) { $this->executeCommand('shell:path:show'); $cnp = $this->applicationTester->getLastLine(); - \PHPUnit_Framework_Assert::assertEquals($arg1, $cnp, 'Current path is ' . $arg1); + \PHPUnit_Framework_Assert::assertEquals($arg1, $cnp, 'Current path is '.$arg1); } /** @@ -719,7 +722,7 @@ public function thePrimaryTypeOfShouldBe($arg1, $arg2) $session = $this->getSession(); $node = $session->getNode($arg1); $primaryTypeName = $node->getPrimaryNodeType()->getName(); - \PHPUnit_Framework_Assert::assertEquals($arg2, $primaryTypeName, 'Node type of ' . $arg1 . ' is ' . $arg2); + \PHPUnit_Framework_Assert::assertEquals($arg2, $primaryTypeName, 'Node type of '.$arg1.' is '.$arg2); } /** diff --git a/src/PHPCR/Shell/Test/EmbeddedContext.php b/src/PHPCR/Shell/Test/EmbeddedContext.php index 4c4f00d7..9f3a619e 100644 --- a/src/PHPCR/Shell/Test/EmbeddedContext.php +++ b/src/PHPCR/Shell/Test/EmbeddedContext.php @@ -7,16 +7,17 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Test; +use PHPCR\Shell\DependencyInjection\Container; use PHPCR\Shell\Phpcr\PhpcrSession; use PHPCR\Shell\PhpcrShell; -use PHPCR\Shell\DependencyInjection\Container; /** - * Features context + * Features context. * * Start the shell in the embedded context */ diff --git a/src/PHPCR/Shell/Test/StandaloneContext.php b/src/PHPCR/Shell/Test/StandaloneContext.php index 11247ab8..bf143d46 100644 --- a/src/PHPCR/Shell/Test/StandaloneContext.php +++ b/src/PHPCR/Shell/Test/StandaloneContext.php @@ -7,6 +7,7 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Test; @@ -23,13 +24,13 @@ protected function createTester() $sessionApplication = new SessionApplication(); $shellApplication = $sessionApplication->getShellApplication(); $tester = new ApplicationTester($sessionApplication, $shellApplication); - $tester->run(array( - '--transport' => 'jackrabbit', + $tester->run([ + '--transport' => 'jackrabbit', '--no-interaction' => true, - '--unsupported' => true, // test all the commands, even if they are unsupported (we test for the fail) - ), array( + '--unsupported' => true, // test all the commands, even if they are unsupported (we test for the fail) + ], [ 'interactive' => true, - )); + ]); return $tester; } diff --git a/src/PHPCR/Shell/Transport/Transport/DoctrineDbal.php b/src/PHPCR/Shell/Transport/Transport/DoctrineDbal.php index 1ed9edd2..d6071615 100644 --- a/src/PHPCR/Shell/Transport/Transport/DoctrineDbal.php +++ b/src/PHPCR/Shell/Transport/Transport/DoctrineDbal.php @@ -7,14 +7,15 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Transport\Transport; use Doctrine\DBAL\DriverManager; use Jackalope\RepositoryFactoryDoctrineDBAL; -use PHPCR\Shell\Transport\TransportInterface; use PHPCR\Shell\Config\Config; +use PHPCR\Shell\Transport\TransportInterface; class DoctrineDbal implements TransportInterface { @@ -25,19 +26,19 @@ public function getName() public function getRepository(Config $config) { - $connection = DriverManager::getConnection($ops = array( - 'user' => $config['db_username'], + $connection = DriverManager::getConnection($ops = [ + 'user' => $config['db_username'], 'password' => $config['db_password'], - 'host' => $config['db_host'], - 'driver' => $config['db_driver'], - 'dbname' => $config['db_name'], - 'path' => $config['db_path'], - )); + 'host' => $config['db_host'], + 'driver' => $config['db_driver'], + 'dbname' => $config['db_name'], + 'path' => $config['db_path'], + ]); $factory = new RepositoryFactoryDoctrineDBAL(); - $repository = $factory->getRepository(array( + $repository = $factory->getRepository([ 'jackalope.doctrine_dbal_connection' => $connection, - )); + ]); return $repository; } diff --git a/src/PHPCR/Shell/Transport/Transport/JackalopeFs.php b/src/PHPCR/Shell/Transport/Transport/JackalopeFs.php index 8f56cd1e..59f5b553 100644 --- a/src/PHPCR/Shell/Transport/Transport/JackalopeFs.php +++ b/src/PHPCR/Shell/Transport/Transport/JackalopeFs.php @@ -7,13 +7,14 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Transport\Transport; -use PHPCR\Shell\Transport\TransportInterface; use Jackalope\RepositoryFactoryFilesystem; use PHPCR\Shell\Config\Config; +use PHPCR\Shell\Transport\TransportInterface; class JackalopeFs implements TransportInterface { @@ -24,9 +25,9 @@ public function getName() public function getRepository(Config $config) { - $params = array( + $params = [ 'path' => $config['repo_path'], - ); + ]; $factory = new RepositoryFactoryFilesystem(); $repository = $factory->getRepository($params); diff --git a/src/PHPCR/Shell/Transport/Transport/Jackrabbit.php b/src/PHPCR/Shell/Transport/Transport/Jackrabbit.php index 51e8a2fc..e5089c7d 100644 --- a/src/PHPCR/Shell/Transport/Transport/Jackrabbit.php +++ b/src/PHPCR/Shell/Transport/Transport/Jackrabbit.php @@ -7,13 +7,14 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Transport\Transport; use Jackalope\RepositoryFactoryJackrabbit; -use PHPCR\Shell\Transport\TransportInterface; use PHPCR\Shell\Config\Config; +use PHPCR\Shell\Transport\TransportInterface; class Jackrabbit implements TransportInterface { @@ -24,9 +25,9 @@ public function getName() public function getRepository(Config $config) { - $params = array( + $params = [ 'jackalope.jackrabbit_uri' => $config['repo_url'], - ); + ]; $factory = new RepositoryFactoryJackrabbit(); $repository = $factory->getRepository($params); diff --git a/src/PHPCR/Shell/Transport/TransportInterface.php b/src/PHPCR/Shell/Transport/TransportInterface.php index 9b1f4809..12beacaf 100644 --- a/src/PHPCR/Shell/Transport/TransportInterface.php +++ b/src/PHPCR/Shell/Transport/TransportInterface.php @@ -7,6 +7,7 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Transport; @@ -14,7 +15,7 @@ use PHPCR\Shell\Config\Config; /** - * All phpcr-shell transports must implement this interface + * All phpcr-shell transports must implement this interface. * * @author Daniel Leech */ diff --git a/src/PHPCR/Shell/Transport/TransportRegistry.php b/src/PHPCR/Shell/Transport/TransportRegistry.php index b84cadee..7177afd7 100644 --- a/src/PHPCR/Shell/Transport/TransportRegistry.php +++ b/src/PHPCR/Shell/Transport/TransportRegistry.php @@ -7,13 +7,14 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Transport; class TransportRegistry implements TransportRegistryInterface { - protected $transports = array(); + protected $transports = []; public function register(TransportInterface $transport) { diff --git a/src/PHPCR/Shell/Transport/TransportRegistryInterface.php b/src/PHPCR/Shell/Transport/TransportRegistryInterface.php index fe2e32d6..94d73d03 100644 --- a/src/PHPCR/Shell/Transport/TransportRegistryInterface.php +++ b/src/PHPCR/Shell/Transport/TransportRegistryInterface.php @@ -7,12 +7,13 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Transport; /** - * Interface for transport factory + * Interface for transport factory. * * Note that transport registry is a bit of a misnomer - * logically it would be RepositoryFactoryInitializerInterface, @@ -23,14 +24,14 @@ interface TransportRegistryInterface { /** - * Return all of the registered transport names + * Return all of the registered transport names. * * @return array */ public function getTransportNames(); /** - * Return the transport with the given name + * Return the transport with the given name. * * @param string $name * diff --git a/tests/PHPCR/Shell/Helper/EditorHelperTest.php b/tests/PHPCR/Shell/Helper/EditorHelperTest.php index cec4ddda..777cd65d 100644 --- a/tests/PHPCR/Shell/Helper/EditorHelperTest.php +++ b/tests/PHPCR/Shell/Helper/EditorHelperTest.php @@ -7,6 +7,7 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Helper; @@ -23,14 +24,14 @@ public function setUp() public function testFromValue() { - $res = $this->helper->fromString(<<helper->fromString(<<<'EOT' One Two Three EOT ); - $this->assertEquals(<<assertEquals(<<<'EOT' One Two Three @@ -50,19 +51,19 @@ public function testFromValueNoEditor() public function provideFromStringWithMessage() { - return array( - array( - <<node->getMixinNodeTypes()->willReturn([ - $this->nodeType1->reveal() + $this->nodeType1->reveal(), ]); $this->node->getPath()->willReturn('/'); diff --git a/tests/PHPCR/Shell/Helper/TextHelperTest.php b/tests/PHPCR/Shell/Helper/TextHelperTest.php index 54341e00..7998d47a 100644 --- a/tests/PHPCR/Shell/Helper/TextHelperTest.php +++ b/tests/PHPCR/Shell/Helper/TextHelperTest.php @@ -7,6 +7,7 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Console\Helper; @@ -22,51 +23,51 @@ public function setUp() public function provideTruncate() { - return array( - array( + return [ + [ 'this is some text', 5, null, null, - 'th...' - ), - array( + 'th...', + ], + [ 'this is some text', 5, 'right', null, '...xt', - ), - array( + ], + [ 'this is some text', 5, 'right', '-', '-text', - ), - array( + ], + [ 'th', 5, 'right', '-', 'th', - ), - array( + ], + [ 'this is some more text', 5, 'right', '-----', '-----', - ), - array( + ], + [ 'this is some more text', 5, 'right', '--------', '-----', 'Delimiter length "8" cannot be greater', - ), - ); + ], + ]; } /** diff --git a/tests/PHPCR/Shell/Phpcr/PhpcrSessionTest.php b/tests/PHPCR/Shell/Phpcr/PhpcrSessionTest.php index 9f4a3741..7b6327a2 100644 --- a/tests/PHPCR/Shell/Phpcr/PhpcrSessionTest.php +++ b/tests/PHPCR/Shell/Phpcr/PhpcrSessionTest.php @@ -7,11 +7,11 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ namespace PHPCR\Shell\Phpcr; -use PHPCR\SessionInterface; use PHPCR\PathNotFoundException; class PhpcrSessionTest extends \Phpunit_Framework_TestCase @@ -24,15 +24,15 @@ public function setUp() public function provideChdir() { - return array( - array('/', '/', '/'), - array('/', 'cms', '/cms'), - array('/', '/cms', '/cms'), - array('/cms', 'foo', '/cms/foo'), - array('/cms', '..', '/'), - array('/', '..', '/'), - array('/cms/foobar/foo', '..', '/cms/foobar'), - ); + return [ + ['/', '/', '/'], + ['/', 'cms', '/cms'], + ['/', '/cms', '/cms'], + ['/cms', 'foo', '/cms/foo'], + ['/cms', '..', '/'], + ['/', '..', '/'], + ['/cms/foobar/foo', '..', '/cms/foobar'], + ]; } /** @@ -47,15 +47,15 @@ public function testChdir($cwd, $path, $expected) public function provideAbsPath() { - return array( - array('/', '/', '/'), - array('/', 'cms', '/cms'), - array('/', '/cms', '/cms'), - array('/cms', 'foo', '/cms/foo'), - array('/cms', '', '/cms'), - array('/cms', null, '/cms'), - array('/cms', '.', '/cms'), - ); + return [ + ['/', '/', '/'], + ['/', 'cms', '/cms'], + ['/', '/cms', '/cms'], + ['/cms', 'foo', '/cms/foo'], + ['/cms', '', '/cms'], + ['/cms', null, '/cms'], + ['/cms', '.', '/cms'], + ]; } /** @@ -70,9 +70,9 @@ public function testAbsPath($cwd, $path, $expected) public function provideMv() { - return array( - array('/', 'foo', 'bar', '/foo', '/bar') - ); + return [ + ['/', 'foo', 'bar', '/foo', '/bar'], + ]; } /**