Altax\Command\Command::__construct PHP Method

__construct() public method

public __construct ( $definedTask )
    public function __construct($definedTask)
    {
        $this->definedTask = $definedTask;
        $this->setName($this->definedTask->getName());
        parent::__construct();
        // Override the command name.
        $this->setName($this->definedTask->getName());
        // Override the command description.
        if ($this->definedTask->hasDescription()) {
            $this->setDescription($this->definedTask->getDescription());
        }
    }

Usage Example

 public function __construct($definedTask)
 {
     if (!$definedTask->hasClosure()) {
         throw new \RuntimeException("The task don't have a closure");
     }
     parent::__construct($definedTask);
 }