feat: Updated sabre/dev dependency to 3.2.3
- feat: Updated nestbot/carbon to 2.0.0 - fix: Replaced zendframework/zend-validator with laminas/laminas-validator - fix: Replaced zendframework/zend-stdlib with laminas/laminas-stdlib
This commit is contained in:
@@ -10,83 +10,83 @@ use Aerex\TaskwarriorPlugin\Exceptions\TaskwarriorCommandException;
|
||||
|
||||
|
||||
class TodoStrategy implements IStrategy {
|
||||
private $config;
|
||||
private $config;
|
||||
|
||||
public function __construct(Config $config){
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
public function count($uuid){
|
||||
$cmd[] = $this->config->getTaskBin();
|
||||
$cmd[] = sprintf('%s count', $uuid);
|
||||
return $this->executeCommand($cmd);
|
||||
}
|
||||
|
||||
public function modify($task){
|
||||
$cmd[] = $this->config->getTaskBin();
|
||||
|
||||
$uuid = $task->getUuid();
|
||||
$taskJson = $task->convertToArray();
|
||||
|
||||
// Append modify command
|
||||
$cmd[] = sprintf(' %s modify ', $uuid);
|
||||
|
||||
$document = $task->getDescription();
|
||||
|
||||
// Append as first modifier description if set
|
||||
|
||||
if(isset($document)){
|
||||
$cmd[] = $document;
|
||||
public function __construct(Config $config){
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
// Append on modifiers
|
||||
foreach($taskJson as $prop => $value){
|
||||
if(isset($value) && $value != null){
|
||||
$cmd[] = sprintf(' %s: %s ', $prop, $value);
|
||||
public function count($uuid){
|
||||
$cmd[] = $this->config->getTaskBin();
|
||||
$cmd[] = sprintf('%s count', $uuid);
|
||||
return $this->executeCommand($cmd);
|
||||
}
|
||||
|
||||
public function modify($task){
|
||||
$cmd[] = $this->config->getTaskBin();
|
||||
|
||||
$uuid = $task->getUuid();
|
||||
$taskJson = $task->convertToArray();
|
||||
|
||||
// Append modify command
|
||||
$cmd[] = sprintf(' %s modify ', $uuid);
|
||||
|
||||
$document = $task->getDescription();
|
||||
|
||||
// Append as first modifier description if set
|
||||
|
||||
if(isset($document)){
|
||||
$cmd[] = $document;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->executeCommand($cmd);
|
||||
|
||||
}
|
||||
|
||||
public function add(Task $task){
|
||||
$cmd[] = $this->config->getTaskBin();
|
||||
$cmd[] = 'add';
|
||||
|
||||
if($task->getDescription() != null){
|
||||
$cmd[] = sprintf('"%s"', (string)$task->getDescription());
|
||||
}
|
||||
|
||||
if($task->getCategories() != null){
|
||||
$categories = implode(' +', (string)$task->getCategories());
|
||||
$cmd[] = $categories;
|
||||
}
|
||||
|
||||
if($task->getDue() != null){
|
||||
$cmd[] = sprintf("due:%s",$task->getDue('Y-m-dTH:i:s'));
|
||||
}
|
||||
|
||||
if($task->getRecurrence() != null){
|
||||
$rrule = $task->getRecurrence()->getParts();
|
||||
$cmd[] = sprintf('recur:%s', $rrule['FREQ']);
|
||||
if(isset($rrule['UNTIL'])){
|
||||
$cmd[] = sprintf('until:%s', $rrule['UNTIL']);
|
||||
// Append on modifiers
|
||||
foreach($taskJson as $prop => $value){
|
||||
if(isset($value) && $value != null){
|
||||
$cmd[] = sprintf(' %s: %s ', $prop, $value);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->executeCommand($cmd);
|
||||
|
||||
}
|
||||
|
||||
if($task->getStatus() != null){
|
||||
$cmd[] = sprintf('status:%s', (string)$task->getStatus());
|
||||
public function add(Task $task){
|
||||
$cmd[] = $this->config->getTaskBin();
|
||||
$cmd[] = 'add';
|
||||
|
||||
if($task->getDescription() != null){
|
||||
$cmd[] = sprintf('"%s"', (string)$task->getDescription());
|
||||
}
|
||||
|
||||
if($task->getCategories() != null){
|
||||
$categories = implode(' +', (string)$task->getCategories());
|
||||
$cmd[] = $categories;
|
||||
}
|
||||
|
||||
if($task->getDue() != null){
|
||||
$cmd[] = sprintf("due:%s",$task->getDue('Y-m-dTH:i:s'));
|
||||
}
|
||||
|
||||
if($task->getRecurrence() != null){
|
||||
$rrule = $task->getRecurrence()->getParts();
|
||||
$cmd[] = sprintf('recur:%s', $rrule['FREQ']);
|
||||
if(isset($rrule['UNTIL'])){
|
||||
$cmd[] = sprintf('until:%s', $rrule['UNTIL']);
|
||||
}
|
||||
}
|
||||
|
||||
if($task->getStatus() != null){
|
||||
$cmd[] = sprintf('status:%s', (string)$task->getStatus());
|
||||
}
|
||||
|
||||
return $this->executeCommand($cmd);
|
||||
}
|
||||
|
||||
return $this->executeCommand($cmd);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private function executeCommand($command){
|
||||
$rcOptions = $this->config->getOptions();
|
||||
private function executeCommand($command){
|
||||
$rcOptions = $this->config->getOptions();
|
||||
|
||||
foreach ($rcOptions as $rcOption) {
|
||||
$command[] = $rcOption;
|
||||
@@ -109,7 +109,7 @@ private function executeCommand($command){
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user