diff options
author | Frederic Guillot <fred@kanboard.net> | 2016-11-05 22:26:58 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2016-11-05 22:26:58 -0400 |
commit | 3f7840c4db7384eb142f92c33330827b8d7255f9 (patch) | |
tree | 8f0cb3b6e0039eb4914534dd64718ecff6dc4715 /app/Core/ExternalTask | |
parent | ae5d31e4c285e0ce672de780fdacff953fe71bba (diff) |
Add the possibility to create external tasks
Diffstat (limited to 'app/Core/ExternalTask')
-rw-r--r-- | app/Core/ExternalTask/AccessForbiddenException.php | 5 | ||||
-rw-r--r-- | app/Core/ExternalTask/ExternalTaskException.php | 15 | ||||
-rw-r--r-- | app/Core/ExternalTask/ExternalTaskInterface.php | 26 | ||||
-rw-r--r-- | app/Core/ExternalTask/ExternalTaskProviderInterface.php | 35 | ||||
-rw-r--r-- | app/Core/ExternalTask/NotFoundException.php | 4 | ||||
-rw-r--r-- | app/Core/ExternalTask/ProviderNotFoundException.php | 4 |
6 files changed, 64 insertions, 25 deletions
diff --git a/app/Core/ExternalTask/AccessForbiddenException.php b/app/Core/ExternalTask/AccessForbiddenException.php index a379d812..2b5ebd33 100644 --- a/app/Core/ExternalTask/AccessForbiddenException.php +++ b/app/Core/ExternalTask/AccessForbiddenException.php @@ -2,13 +2,12 @@ namespace Kanboard\Core\ExternalTask; -use Exception; - /** * Class AccessForbiddenException * * @package Kanboard\Core\ExternalTask + * @author Frederic Guillot */ -class AccessForbiddenException extends Exception +class AccessForbiddenException extends ExternalTaskException { } diff --git a/app/Core/ExternalTask/ExternalTaskException.php b/app/Core/ExternalTask/ExternalTaskException.php new file mode 100644 index 00000000..07e5665d --- /dev/null +++ b/app/Core/ExternalTask/ExternalTaskException.php @@ -0,0 +1,15 @@ +<?php + +namespace Kanboard\Core\ExternalTask; + +use Exception; + +/** + * Class NotFoundException + * + * @package Kanboard\Core\ExternalTask + * @author Frederic Guillot + */ +class ExternalTaskException extends Exception +{ +} diff --git a/app/Core/ExternalTask/ExternalTaskInterface.php b/app/Core/ExternalTask/ExternalTaskInterface.php new file mode 100644 index 00000000..084af509 --- /dev/null +++ b/app/Core/ExternalTask/ExternalTaskInterface.php @@ -0,0 +1,26 @@ +<?php + +namespace Kanboard\Core\ExternalTask; + +/** + * Interface ExternalTaskInterface + * + * @package Kanboard\Core\ExternalTask + * @author Frederic Guillot + */ +interface ExternalTaskInterface +{ + /** + * Return Uniform Resource Identifier for the task + * + * @return string + */ + public function getUri(); + + /** + * Return a dict to populate the task form + * + * @return array + */ + public function getFormValues(); +} diff --git a/app/Core/ExternalTask/ExternalTaskProviderInterface.php b/app/Core/ExternalTask/ExternalTaskProviderInterface.php index 9e672780..af1dffec 100644 --- a/app/Core/ExternalTask/ExternalTaskProviderInterface.php +++ b/app/Core/ExternalTask/ExternalTaskProviderInterface.php @@ -11,15 +11,6 @@ namespace Kanboard\Core\ExternalTask; interface ExternalTaskProviderInterface { /** - * Get templates - * - * @return string - */ - public function getCreationFormTemplate(); - public function getModificationFormTemplate(); - public function getTaskViewTemplate(); - - /** * Get provider name (visible in the user interface) * * @access public @@ -34,17 +25,29 @@ interface ExternalTaskProviderInterface * @throws \Kanboard\Core\ExternalTask\AccessForbiddenException * @throws \Kanboard\Core\ExternalTask\NotFoundException * @param string $uri - * @return array Dict that will populate the form + * @return ExternalTaskInterface */ public function retrieve($uri); /** - * Save the task to the external system and/or update the cache + * Get task import template name * - * @access public - * @param string $uri - * @param array $data - * @return bool + * @return string + */ + public function getImportFormTemplate(); + + /** + * Get creation form template + * + * @return string + */ + public function getCreationFormTemplate(); + + /** + * Build external task URI based on import form values + * + * @param array $values + * @return string */ - public function persist($uri, array $data); + public function buildTaskUri(array $values); } diff --git a/app/Core/ExternalTask/NotFoundException.php b/app/Core/ExternalTask/NotFoundException.php index c7ed13ef..34eff8ea 100644 --- a/app/Core/ExternalTask/NotFoundException.php +++ b/app/Core/ExternalTask/NotFoundException.php @@ -2,14 +2,12 @@ namespace Kanboard\Core\ExternalTask; -use Exception; - /** * Class NotFoundException * * @package Kanboard\Core\ExternalTask * @author Frederic Guillot */ -class NotFoundException extends Exception +class NotFoundException extends ExternalTaskException { } diff --git a/app/Core/ExternalTask/ProviderNotFoundException.php b/app/Core/ExternalTask/ProviderNotFoundException.php index 2deddda8..6ad1fae1 100644 --- a/app/Core/ExternalTask/ProviderNotFoundException.php +++ b/app/Core/ExternalTask/ProviderNotFoundException.php @@ -2,14 +2,12 @@ namespace Kanboard\Core\ExternalTask; -use Exception; - /** * Class ProviderNotFoundException * * @package Kanboard\Core\ExternalTask * @author Frederic Guillot */ -class ProviderNotFoundException extends Exception +class ProviderNotFoundException extends ExternalTaskException { } |