Browse Source

a-[Console] added some phpdoc

Fabien Potencier 14 năm trước cách đây
mục cha
commit
2547bbffc3
1 tập tin đã thay đổi với 18 bổ sung0 xóa
  1. 18 0
      src/Symfony/Component/Console/Command/Command.php

+ 18 - 0
src/Symfony/Component/Console/Command/Command.php

@@ -81,12 +81,18 @@ class Command
     /**
      * Executes the current command.
      *
+     * This method is not abstract because you can use this class
+     * as a concrete class. In this case, instead of defining the
+     * execute() method, you set the code to execute by passing
+     * a Closure to the setCode() method.
+     *
      * @param InputInterface  $input  An InputInterface instance
      * @param OutputInterface $output An OutputInterface instance
      *
      * @return integer 0 if everything went fine, or an error code
      *
      * @throws \LogicException When this abstract class is not implemented
+     * @see    setCode()
      */
     protected function execute(InputInterface $input, OutputInterface $output)
     {
@@ -119,8 +125,15 @@ class Command
     /**
      * Runs the command.
      *
+     * The code to execute is either defined directly with the
+     * setCode() method or by overriding the execute() method
+     * in a sub-class.
+     *
      * @param InputInterface  $input  An InputInterface instance
      * @param OutputInterface $output An OutputInterface instance
+     *
+     * @see setCode()
+     * @see execute()
      */
     public function run(InputInterface $input, OutputInterface $output)
     {
@@ -154,9 +167,14 @@ class Command
     /**
      * Sets the code to execute when running this command.
      *
+     * If this method is used, it overrides the code defined
+     * in the execute() method.
+     *
      * @param \Closure $code A \Closure
      *
      * @return Command The current instance
+     *
+     * @see execute()
      */
     public function setCode(\Closure $code)
     {