This commit is contained in:
DavidBadura
2015-04-23 21:28:57 +00:00
parent 4ebaee91aa
commit da2d664f58
6 changed files with 187 additions and 73 deletions

View File

@@ -195,7 +195,7 @@ class QueryBuilder
*/
public function getFilter()
{
return implode(' ', $this->filter);
return $this->filter;
}
/**
@@ -203,7 +203,7 @@ class QueryBuilder
*/
public function getResult()
{
$result = $this->taskManager->filter($this->getFilter());
$result = $this->taskManager->filter($this->filter);
return $result->matching($this->criteria);
}

View File

@@ -79,7 +79,7 @@ class TaskManager
return $this->tasks[$uuid];
}
$tasks = $this->filterAll($uuid);
$tasks = $this->filter($uuid);
if (count($tasks) == 0) {
return null;
@@ -96,7 +96,7 @@ class TaskManager
* @param string $filter
* @return Task[]|ArrayCollection
*/
public function filterAll($filter = null)
public function filter($filter = null)
{
$result = $this->export($filter);
@@ -119,9 +119,9 @@ class TaskManager
* @param string|array $filter
* @return Task[]|ArrayCollection
*/
public function filter($filter = null)
public function filterPending($filter = null)
{
return $this->filterAll($filter . ' status:pending');
return $this->filter(array_merge((array)$filter, ['status:pending']));
}
/**
@@ -219,15 +219,6 @@ class TaskManager
return $errors;
}
/**
* @param Task $task
*/
public function refresh(Task $task)
{
$clean = $this->export($task->getUuid())[0];
$this->merge($task, $clean);
}
/**
*
*/
@@ -277,6 +268,15 @@ class TaskManager
->getResult();
}
/**
* @param Task $task
*/
private function refresh(Task $task)
{
$clean = $this->export($task->getUuid())[0];
$this->merge($task, $clean);
}
/**
* @param string|array $filter
* @return Task[]

View File

@@ -47,7 +47,7 @@ class Taskwarrior
}
/**
* @param string $filter
* @param string|string[] $filter
*/
public function delete($filter)
{
@@ -55,7 +55,7 @@ class Taskwarrior
}
/**
* @param string $filter
* @param string|string[] $filter
*/
public function done($filter)
{
@@ -63,7 +63,7 @@ class Taskwarrior
}
/**
* @param string $filter
* @param string|string[] $filter
*/
public function start($filter)
{
@@ -71,7 +71,7 @@ class Taskwarrior
}
/**
* @param string $filter
* @param string|string[] $filter
*/
public function stop($filter)
{
@@ -88,7 +88,7 @@ class Taskwarrior
/**
* @param array $params
* @param string $filter
* @param string|string[] $filter
*/
public function modify(array $params, $filter = null)
{
@@ -96,7 +96,7 @@ class Taskwarrior
}
/**
* @param string $filter
* @param string|string[] $filter
* @return array
*/
public function projects($filter = null)
@@ -107,7 +107,7 @@ class Taskwarrior
}
/**
* @param string $filter
* @param string|string[] $filter
* @return array
*/
public function tags($filter = null)
@@ -146,7 +146,7 @@ class Taskwarrior
}
/**
* @param string $filter
* @param string|string[] $filter
* @return string
*/
public function export($filter = null)
@@ -156,7 +156,7 @@ class Taskwarrior
/**
* @param string $command
* @param string $filter
* @param string|string[] $filter
* @param array $options
* @return string
* @throws TaskwarriorException
@@ -170,7 +170,9 @@ class Taskwarrior
}
if ($filter) {
$parts[] = "( " . $filter . ' )';
foreach((array)$filter as $f) {
$parts[] = "( " . $f . ' )';
}
}
$parts[] = $command;