-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Console] application/command as text/xml/whatever decoupling #7454
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
da67c12
f239b1c
bebf1eb
43b5e5c
acc7414
774794c
2066a9b
47fa194
8b56eb1
27aa872
30d8807
9964838
ef6d8ba
389101a
84be8de
ce5c0fd
49a4612
20c10a5
9c7b358
d3ec073
d70e086
ce60fb7
28f082e
cbb8105
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,8 @@ | |
|
||
namespace Symfony\Component\Console\Command; | ||
|
||
use Symfony\Component\Console\Descriptor\DescriptorProvider; | ||
use Symfony\Component\Console\Descriptor\TextDescriptor; | ||
use Symfony\Component\Console\Descriptor\XmlDescriptor; | ||
use Symfony\Component\Console\Input\InputDefinition; | ||
use Symfony\Component\Console\Input\InputOption; | ||
use Symfony\Component\Console\Input\InputArgument; | ||
|
@@ -565,9 +566,9 @@ public function getHelper($name) | |
*/ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This also requires a BC layer |
||
public function asText() | ||
{ | ||
$descriptor = new DescriptorProvider(); | ||
$descriptor = new TextDescriptor(); | ||
|
||
return $descriptor->get($this, 'txt')->describe($this); | ||
return $descriptor->describeCommand($this); | ||
} | ||
|
||
/** | ||
|
@@ -581,17 +582,9 @@ public function asText() | |
*/ | ||
public function asXml($asDom = false) | ||
{ | ||
$provider = new DescriptorProvider(); | ||
$descriptor = $provider->get($this, 'xml'); | ||
$descriptor = new XmlDescriptor(); | ||
|
||
if ($asDom) { | ||
$dom = new \DOMDocument('1.0', 'UTF-8'); | ||
$descriptor->buildDocument($dom, $this); | ||
|
||
return $dom; | ||
} | ||
|
||
return $descriptor->describe($this); | ||
return $descriptor->describeCommand($this, array('as_dom' => $asDom)); | ||
} | ||
|
||
private function validateName($name) | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,62 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\Console\Descriptor; | ||
|
||
use Symfony\Component\Console\Application; | ||
use Symfony\Component\Console\Command\Command; | ||
use Symfony\Component\Console\Input\InputArgument; | ||
use Symfony\Component\Console\Input\InputDefinition; | ||
use Symfony\Component\Console\Input\InputOption; | ||
|
||
/** | ||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com> | ||
* Descriptor interface. | ||
* | ||
* @author Jean-François Simon <contact@jfsimon.fr> | ||
*/ | ||
interface DescriptorInterface | ||
{ | ||
/** | ||
* Configures descriptor with description options. | ||
* @param InputArgument $argument | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As this is the interface, you must add some description of the methods. |
||
* | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you remove the blank lines between @param lines? |
||
* @param array $options Description options | ||
* @param array $options | ||
* | ||
* @return DescriptorInterface | ||
* @return string|mixed | ||
*/ | ||
public function configure(array $options); | ||
public function describeInputArgument(InputArgument $argument, array $options = array()); | ||
|
||
/** | ||
* Returns given object's representation. | ||
* @param InputOption $option | ||
* | ||
* @param object $object The object to describe | ||
* @param array $options | ||
* | ||
* @return string The object formatted description | ||
* @return string|mixed | ||
*/ | ||
public function describe($object); | ||
public function describeInputOption(InputOption $option, array $options = array()); | ||
|
||
/** | ||
* Tests if this descriptor supports given object. | ||
* @param InputDefinition $definition | ||
* | ||
* @param object $object The object to describe | ||
* @param array $options | ||
* | ||
* @return boolean | ||
* @return string|mixed | ||
*/ | ||
public function supports($object); | ||
public function describeInputDefinition(InputDefinition $definition, array $options = array()); | ||
|
||
/** | ||
* Returns descriptor's format name. | ||
* @param Command $command | ||
* | ||
* @return string The format name | ||
*/ | ||
public function getFormat(); | ||
|
||
/** | ||
* Returns true if output formatting is used. | ||
* @param array $options | ||
* | ||
* @return boolean | ||
* @return string|mixed | ||
*/ | ||
public function useFormatting(); | ||
public function describeCommand(Command $command, array $options = array()); | ||
|
||
/** | ||
* @param DescriptorProvider $descriptorProvider | ||
* @param Application $application | ||
* | ||
* @param array $options | ||
* | ||
* @return string|mixed | ||
*/ | ||
public function setDescriptorProvider(DescriptorProvider $descriptorProvider); | ||
public function describeApplication(Application $application, array $options = array()); | ||
} |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you need to provide a BC layer to avoid the BC break