diff options
author | Anthony Legiret <anleg@smile.fr> | 2017-11-03 09:25:04 +0100 |
---|---|---|
committer | fguillot <fred@kanboard.net> | 2017-11-03 10:27:56 -0700 |
commit | 09a7f9ef85c192df9e870310d383f10fa844264d (patch) | |
tree | 732ae99831a8bacda6dbac33b91cbf1e663f0de4 /app/Formatter/ProjectApiFormatter.php | |
parent | 648dc6bcfbdd44947ec58e2f3662c1cc3844d782 (diff) |
Correct ProjectApiFormatter file name
Diffstat (limited to 'app/Formatter/ProjectApiFormatter.php')
-rw-r--r-- | app/Formatter/ProjectApiFormatter.php | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/app/Formatter/ProjectApiFormatter.php b/app/Formatter/ProjectApiFormatter.php new file mode 100644 index 00000000..5521d57c --- /dev/null +++ b/app/Formatter/ProjectApiFormatter.php @@ -0,0 +1,39 @@ +<?php + +namespace Kanboard\Formatter; + +use Kanboard\Core\Filter\FormatterInterface; + +/** + * Class ProjectApiFormatter + * + * @package Kanboard\Formatter + */ +class ProjectApiFormatter extends BaseFormatter implements FormatterInterface +{ + protected $project = null; + + public function withProject($project) + { + $this->project = $project; + return $this; + } + + /** + * Apply formatter + * + * @access public + * @return mixed + */ + public function format() + { + if (! empty($this->project)) { + $this->project['url'] = array( + 'board' => $this->helper->url->to('BoardViewController', 'show', array('project_id' => $this->project['id']), '', true), + 'list' => $this->helper->url->to('TaskListController', 'show', array('project_id' => $this->project['id']), '', true), + ); + } + + return $this->project; + } +} |