22
33namespace PHPCR \Util \Console \Command ;
44
5- use PHPCR \SessionInterface ;
65use Symfony \Component \Console \Command \Command ;
6+ use Symfony \Component \Console \Input \InputInterface ;
77use Symfony \Component \Console \Input \InputOption ;
8- use PHPCR \Util \Console \Helper \PhpcrCliHelper ;
8+ use Symfony \Component \Console \Output \OutputInterface ;
9+
10+ use PHPCR \SessionInterface ;
11+ use PHPCR \Util \Console \Helper \PhpcrHelper ;
912use PHPCR \Util \Console \Helper \PhpcrConsoleDumperHelper ;
1013
1114/**
@@ -24,67 +27,22 @@ abstract class BaseCommand extends Command
2427 */
2528 protected function getPhpcrSession ()
2629 {
27- return $ this ->getHelper ( ' phpcr ' )->getSession ();
30+ return $ this ->getPhpcrHelper ( )->getSession ();
2831 }
2932
3033 /**
31- * @return PhpcrCliHelper
34+ * @return PhpcrHelper
3235 */
33- protected function getPhpcrCliHelper ()
36+ protected function getPhpcrHelper ()
3437 {
35- if (!$ this ->phpcrCliHelper ) {
36- $ this ->phpcrCliHelper = new PhpcrCliHelper ($ this ->getPhpcrSession ());
37- }
38-
39- return $ this ->phpcrCliHelper ;
38+ return $ this ->getHelperSet ()->get ('phpcr ' );
4039 }
4140
4241 /**
4342 * @return PhpcrConsoleDumperHelper
4443 */
4544 protected function getPhpcrConsoleDumperHelper ()
4645 {
47- if (!$ this ->phpcrConsoleDumperHelper ) {
48- $ this ->phpcrConsoleDumperHelper = new PhpcrConsoleDumperHelper ();
49- }
50-
51- return $ this ->phpcrConsoleDumperHelper ;
52- }
53-
54- public function setPhpcrConsoleDumperHelper ($ consoleDumperHelper )
55- {
56- $ this ->phpcrConsoleDumperHelper = $ consoleDumperHelper ;
57- }
58-
59- /**
60- * Hack to enable overriding for unit tests.
61- */
62- public function setPhpcrCliHelper (PhpcrCliHelper $ helper )
63- {
64- $ this ->phpcrCliHelper = $ helper ;
65- }
66-
67- public function configureNodeManipulationInput ()
68- {
69- $ this ->addOption ('set-prop ' , 'p ' ,
70- InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY ,
71- 'Set node property on nodes use foo=bar '
72- );
73- $ this ->addOption ('remove-prop ' , 'r ' ,
74- InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY ,
75- 'Remove property from nodes '
76- );
77- $ this ->addOption ('add-mixin ' , null ,
78- InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY ,
79- 'Add a mixin to the nodes '
80- );
81- $ this ->addOption ('remove-mixin ' , null ,
82- InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY ,
83- 'Remove mixin from the nodes '
84- );
85- $ this ->addOption ('apply-closure ' , null ,
86- InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY ,
87- 'Apply a closure to each node, closures are passed PHPCR\Session and PHPCR\NodeInterface '
88- );
46+ return $ this ->getHelperSet ()->get ('phpcr_console_dumper ' );
8947 }
9048}
0 commit comments