From b1e2ca00ce7375ffcbe5e927135c8892036e6bd6 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Mon, 16 May 2016 21:07:29 -0400 Subject: [PATCH] Rename Api classes --- app/Api/{Action.php => ActionApi.php} | 6 +- app/Api/{App.php => AppApi.php} | 6 +- app/Api/{Auth.php => AuthApi.php} | 5 +- app/Api/{Base.php => BaseApi.php} | 5 +- app/Api/{Board.php => BoardApi.php} | 4 +- app/Api/{Category.php => CategoryApi.php} | 6 +- app/Api/{Column.php => ColumnApi.php} | 4 +- app/Api/{Comment.php => CommentApi.php} | 6 +- app/Api/{File.php => FileApi.php} | 7 +- app/Api/{Group.php => GroupApi.php} | 6 +- .../{GroupMember.php => GroupMemberApi.php} | 6 +- app/Api/{Link.php => LinkApi.php} | 6 +- app/Api/{Me.php => MeApi.php} | 4 +- app/Api/{Project.php => ProjectApi.php} | 4 +- ...ermission.php => ProjectPermissionApi.php} | 5 +- app/Api/{Subtask.php => SubtaskApi.php} | 6 +- app/Api/{Swimlane.php => SwimlaneApi.php} | 6 +- app/Api/{Task.php => TaskApi.php} | 4 +- app/Api/{TaskLink.php => TaskLinkApi.php} | 6 +- app/Api/{User.php => UserApi.php} | 5 +- jsonrpc.php | 76 +++++++++---------- 21 files changed, 104 insertions(+), 79 deletions(-) rename app/Api/{Action.php => ActionApi.php} (96%) rename app/Api/{App.php => AppApi.php} (90%) rename app/Api/{Auth.php => AuthApi.php} (95%) rename app/Api/{Base.php => BaseApi.php} (97%) rename app/Api/{Board.php => BoardApi.php} (81%) rename app/Api/{Category.php => CategoryApi.php} (92%) rename app/Api/{Column.php => ColumnApi.php} (94%) rename app/Api/{Comment.php => CommentApi.php} (93%) rename app/Api/{File.php => FileApi.php} (95%) rename app/Api/{Group.php => GroupApi.php} (92%) rename app/Api/{GroupMember.php => GroupMemberApi.php} (89%) rename app/Api/{Link.php => LinkApi.php} (96%) rename app/Api/{Me.php => MeApi.php} (97%) rename app/Api/{Project.php => ProjectApi.php} (97%) rename app/Api/{ProjectPermission.php => ProjectPermissionApi.php} (95%) rename app/Api/{Subtask.php => SubtaskApi.php} (95%) rename app/Api/{Swimlane.php => SwimlaneApi.php} (95%) rename app/Api/{Task.php => TaskApi.php} (99%) rename app/Api/{TaskLink.php => TaskLinkApi.php} (95%) rename app/Api/{User.php => UserApi.php} (97%) diff --git a/app/Api/Action.php b/app/Api/ActionApi.php similarity index 96% rename from app/Api/Action.php rename to app/Api/ActionApi.php index 9e3b86f67..0647f9e8d 100644 --- a/app/Api/Action.php +++ b/app/Api/ActionApi.php @@ -2,13 +2,15 @@ namespace Kanboard\Api; +use Kanboard\Core\Base; + /** * Action API controller * - * @package api + * @package Kanboard\Api * @author Frederic Guillot */ -class Action extends \Kanboard\Core\Base +class ActionApi extends Base { public function getAvailableActions() { diff --git a/app/Api/App.php b/app/Api/AppApi.php similarity index 90% rename from app/Api/App.php rename to app/Api/AppApi.php index 1c4737c0a..865ba21ab 100644 --- a/app/Api/App.php +++ b/app/Api/AppApi.php @@ -2,13 +2,15 @@ namespace Kanboard\Api; +use Kanboard\Core\Base; + /** * App API controller * - * @package api + * @package Kanboard\Api * @author Frederic Guillot */ -class App extends \Kanboard\Core\Base +class AppApi extends Base { public function getTimezone() { diff --git a/app/Api/Auth.php b/app/Api/AuthApi.php similarity index 95% rename from app/Api/Auth.php rename to app/Api/AuthApi.php index 1cc6627f3..a9ad5baff 100644 --- a/app/Api/Auth.php +++ b/app/Api/AuthApi.php @@ -7,10 +7,10 @@ use JsonRPC\Exception\AuthenticationFailureException; /** * Base class * - * @package api + * @package Kanboard\Api * @author Frederic Guillot */ -class Auth extends Base +class AuthApi extends BaseApi { /** * Check api credentials @@ -20,6 +20,7 @@ class Auth extends Base * @param string $password * @param string $class * @param string $method + * @throws AuthenticationFailureException */ public function checkCredentials($username, $password, $class, $method) { diff --git a/app/Api/Base.php b/app/Api/BaseApi.php similarity index 97% rename from app/Api/Base.php rename to app/Api/BaseApi.php index ea817f7da..37e11030d 100644 --- a/app/Api/Base.php +++ b/app/Api/BaseApi.php @@ -3,14 +3,15 @@ namespace Kanboard\Api; use JsonRPC\Exception\AccessDeniedException; +use Kanboard\Core\Base; /** * Base class * - * @package api + * @package Kanboard\Api * @author Frederic Guillot */ -abstract class Base extends \Kanboard\Core\Base +abstract class BaseApi extends Base { private $user_allowed_procedures = array( 'getMe', diff --git a/app/Api/Board.php b/app/Api/BoardApi.php similarity index 81% rename from app/Api/Board.php rename to app/Api/BoardApi.php index 185ac51a5..c7d93aa09 100644 --- a/app/Api/Board.php +++ b/app/Api/BoardApi.php @@ -5,10 +5,10 @@ namespace Kanboard\Api; /** * Board API controller * - * @package api + * @package Kanboard\Api * @author Frederic Guillot */ -class Board extends Base +class BoardApi extends BaseApi { public function getBoard($project_id) { diff --git a/app/Api/Category.php b/app/Api/CategoryApi.php similarity index 92% rename from app/Api/Category.php rename to app/Api/CategoryApi.php index fbd61c56c..7c5d3bfbc 100644 --- a/app/Api/Category.php +++ b/app/Api/CategoryApi.php @@ -2,13 +2,15 @@ namespace Kanboard\Api; +use Kanboard\Core\Base; + /** * Category API controller * - * @package api + * @package Kanboard\Api * @author Frederic Guillot */ -class Category extends \Kanboard\Core\Base +class CategoryApi extends Base { public function getCategory($category_id) { diff --git a/app/Api/Column.php b/app/Api/ColumnApi.php similarity index 94% rename from app/Api/Column.php rename to app/Api/ColumnApi.php index ddc3a5d01..45ce521d6 100644 --- a/app/Api/Column.php +++ b/app/Api/ColumnApi.php @@ -5,10 +5,10 @@ namespace Kanboard\Api; /** * Column API controller * - * @package api + * @package Kanboard\Api * @author Frederic Guillot */ -class Column extends Base +class ColumnApi extends BaseApi { public function getColumns($project_id) { diff --git a/app/Api/Comment.php b/app/Api/CommentApi.php similarity index 93% rename from app/Api/Comment.php rename to app/Api/CommentApi.php index 1fc1c708b..f16b0f7fc 100644 --- a/app/Api/Comment.php +++ b/app/Api/CommentApi.php @@ -2,13 +2,15 @@ namespace Kanboard\Api; +use Kanboard\Core\Base; + /** * Comment API controller * - * @package api + * @package Kanboard\Api * @author Frederic Guillot */ -class Comment extends \Kanboard\Core\Base +class CommentApi extends Base { public function getComment($comment_id) { diff --git a/app/Api/File.php b/app/Api/FileApi.php similarity index 95% rename from app/Api/File.php rename to app/Api/FileApi.php index 71c31c76e..cc2e39867 100644 --- a/app/Api/File.php +++ b/app/Api/FileApi.php @@ -7,10 +7,10 @@ use Kanboard\Core\ObjectStorage\ObjectStorageException; /** * File API controller * - * @package api + * @package Kanboard\Api * @author Frederic Guillot */ -class File extends Base +class FileApi extends BaseApi { public function getTaskFile($file_id) { @@ -32,8 +32,9 @@ class File extends Base } } catch (ObjectStorageException $e) { $this->logger->error($e->getMessage()); - return ''; } + + return ''; } public function createTaskFile($project_id, $task_id, $filename, $blob) diff --git a/app/Api/Group.php b/app/Api/GroupApi.php similarity index 92% rename from app/Api/Group.php rename to app/Api/GroupApi.php index a1e0a73d9..f1841fa30 100644 --- a/app/Api/Group.php +++ b/app/Api/GroupApi.php @@ -2,13 +2,15 @@ namespace Kanboard\Api; +use Kanboard\Core\Base; + /** * Group API controller * - * @package api + * @package Kanboard\Api * @author Frederic Guillot */ -class Group extends \Kanboard\Core\Base +class GroupApi extends Base { public function createGroup($name, $external_id = '') { diff --git a/app/Api/GroupMember.php b/app/Api/GroupMemberApi.php similarity index 89% rename from app/Api/GroupMember.php rename to app/Api/GroupMemberApi.php index 9d2a47963..f5171e233 100644 --- a/app/Api/GroupMember.php +++ b/app/Api/GroupMemberApi.php @@ -2,13 +2,15 @@ namespace Kanboard\Api; +use Kanboard\Core\Base; + /** * Group Member API controller * - * @package api + * @package Kanboard\Api * @author Frederic Guillot */ -class GroupMember extends \Kanboard\Core\Base +class GroupMemberApi extends Base { public function getMemberGroups($user_id) { diff --git a/app/Api/Link.php b/app/Api/LinkApi.php similarity index 96% rename from app/Api/Link.php rename to app/Api/LinkApi.php index 23a9916dc..a76cb802f 100644 --- a/app/Api/Link.php +++ b/app/Api/LinkApi.php @@ -2,13 +2,15 @@ namespace Kanboard\Api; +use Kanboard\Core\Base; + /** * Link API controller * - * @package api + * @package Kanboard\Api * @author Frederic Guillot */ -class Link extends \Kanboard\Core\Base +class LinkApi extends Base { /** * Get a link by id diff --git a/app/Api/Me.php b/app/Api/MeApi.php similarity index 97% rename from app/Api/Me.php rename to app/Api/MeApi.php index 3d08626a3..7d46a9629 100644 --- a/app/Api/Me.php +++ b/app/Api/MeApi.php @@ -7,10 +7,10 @@ use Kanboard\Model\Subtask as SubtaskModel; /** * Me API controller * - * @package api + * @package Kanboard\Api * @author Frederic Guillot */ -class Me extends Base +class MeApi extends BaseApi { public function getMe() { diff --git a/app/Api/Project.php b/app/Api/ProjectApi.php similarity index 97% rename from app/Api/Project.php rename to app/Api/ProjectApi.php index 846d70466..70cd8d16e 100644 --- a/app/Api/Project.php +++ b/app/Api/ProjectApi.php @@ -5,10 +5,10 @@ namespace Kanboard\Api; /** * Project API controller * - * @package api + * @package Kanboard\Api * @author Frederic Guillot */ -class Project extends Base +class ProjectApi extends BaseApi { public function getProjectById($project_id) { diff --git a/app/Api/ProjectPermission.php b/app/Api/ProjectPermissionApi.php similarity index 95% rename from app/Api/ProjectPermission.php rename to app/Api/ProjectPermissionApi.php index 11e92af08..10ee38522 100644 --- a/app/Api/ProjectPermission.php +++ b/app/Api/ProjectPermissionApi.php @@ -2,15 +2,16 @@ namespace Kanboard\Api; +use Kanboard\Core\Base; use Kanboard\Core\Security\Role; /** * Project Permission API controller * - * @package api + * @package Kanboard\Api * @author Frederic Guillot */ -class ProjectPermission extends \Kanboard\Core\Base +class ProjectPermissionApi extends Base { public function getProjectUsers($project_id) { diff --git a/app/Api/Subtask.php b/app/Api/SubtaskApi.php similarity index 95% rename from app/Api/Subtask.php rename to app/Api/SubtaskApi.php index 782fdb027..305f9ae76 100644 --- a/app/Api/Subtask.php +++ b/app/Api/SubtaskApi.php @@ -2,13 +2,15 @@ namespace Kanboard\Api; +use Kanboard\Core\Base; + /** * Subtask API controller * - * @package api + * @package Kanboard\Api * @author Frederic Guillot */ -class Subtask extends \Kanboard\Core\Base +class SubtaskApi extends Base { public function getSubtask($subtask_id) { diff --git a/app/Api/Swimlane.php b/app/Api/SwimlaneApi.php similarity index 95% rename from app/Api/Swimlane.php rename to app/Api/SwimlaneApi.php index 03a2819f0..f179e11b2 100644 --- a/app/Api/Swimlane.php +++ b/app/Api/SwimlaneApi.php @@ -2,13 +2,15 @@ namespace Kanboard\Api; +use Kanboard\Core\Base; + /** * Swimlane API controller * - * @package api + * @package Kanboard\Api * @author Frederic Guillot */ -class Swimlane extends \Kanboard\Core\Base +class SwimlaneApi extends Base { public function getActiveSwimlanes($project_id) { diff --git a/app/Api/Task.php b/app/Api/TaskApi.php similarity index 99% rename from app/Api/Task.php rename to app/Api/TaskApi.php index 1d1211f27..4d745fa64 100644 --- a/app/Api/Task.php +++ b/app/Api/TaskApi.php @@ -8,10 +8,10 @@ use Kanboard\Model\Task as TaskModel; /** * Task API controller * - * @package api + * @package Kanboard\Api * @author Frederic Guillot */ -class Task extends Base +class TaskApi extends BaseApi { public function searchTasks($project_id, $query) { diff --git a/app/Api/TaskLink.php b/app/Api/TaskLinkApi.php similarity index 95% rename from app/Api/TaskLink.php rename to app/Api/TaskLinkApi.php index 47d70d1eb..8c02c5242 100644 --- a/app/Api/TaskLink.php +++ b/app/Api/TaskLinkApi.php @@ -2,13 +2,15 @@ namespace Kanboard\Api; +use Kanboard\Core\Base; + /** * TaskLink API controller * - * @package api + * @package Kanboard\Api * @author Frederic Guillot */ -class TaskLink extends \Kanboard\Core\Base +class TaskLinkApi extends Base { /** * Get a task link diff --git a/app/Api/User.php b/app/Api/UserApi.php similarity index 97% rename from app/Api/User.php rename to app/Api/UserApi.php index 6ee935a3d..9786e6cfb 100644 --- a/app/Api/User.php +++ b/app/Api/UserApi.php @@ -2,6 +2,7 @@ namespace Kanboard\Api; +use Kanboard\Core\Base; use LogicException; use Kanboard\Core\Security\Role; use Kanboard\Core\Ldap\Client as LdapClient; @@ -11,10 +12,10 @@ use Kanboard\Core\Ldap\User as LdapUser; /** * User API controller * - * @package api + * @package Kanboard\Api * @author Frederic Guillot */ -class User extends \Kanboard\Core\Base +class UserApi extends Base { public function getUser($user_id) { diff --git a/jsonrpc.php b/jsonrpc.php index d21633476..c0dc5c562 100644 --- a/jsonrpc.php +++ b/jsonrpc.php @@ -3,47 +3,47 @@ require __DIR__.'/app/common.php'; use JsonRPC\Server; -use Kanboard\Api\Auth; -use Kanboard\Api\Me; -use Kanboard\Api\Action; -use Kanboard\Api\App; -use Kanboard\Api\Board; -use Kanboard\Api\Column; -use Kanboard\Api\Category; -use Kanboard\Api\Comment; -use Kanboard\Api\File; -use Kanboard\Api\Link; -use Kanboard\Api\Project; -use Kanboard\Api\ProjectPermission; -use Kanboard\Api\Subtask; -use Kanboard\Api\Swimlane; -use Kanboard\Api\Task; -use Kanboard\Api\TaskLink; -use Kanboard\Api\User; -use Kanboard\Api\Group; -use Kanboard\Api\GroupMember; +use Kanboard\Api\AuthApi; +use Kanboard\Api\MeApi; +use Kanboard\Api\ActionApi; +use Kanboard\Api\AppApi; +use Kanboard\Api\BoardApi; +use Kanboard\Api\ColumnApi; +use Kanboard\Api\CategoryApi; +use Kanboard\Api\CommentApi; +use Kanboard\Api\FileApi; +use Kanboard\Api\LinkApi; +use Kanboard\Api\ProjectApi; +use Kanboard\Api\ProjectPermissionApi; +use Kanboard\Api\SubtaskApi; +use Kanboard\Api\SwimlaneApi; +use Kanboard\Api\TaskApi; +use Kanboard\Api\TaskLinkApi; +use Kanboard\Api\UserApi; +use Kanboard\Api\GroupApi; +use Kanboard\Api\GroupMemberApi; $server = new Server; $server->setAuthenticationHeader(API_AUTHENTICATION_HEADER); -$server->before(array(new Auth($container), 'checkCredentials')); +$server->before(array(new AuthApi($container), 'checkCredentials')); -$server->attach(new Me($container)); -$server->attach(new Action($container)); -$server->attach(new App($container)); -$server->attach(new Board($container)); -$server->attach(new Column($container)); -$server->attach(new Category($container)); -$server->attach(new Comment($container)); -$server->attach(new File($container)); -$server->attach(new Link($container)); -$server->attach(new Project($container)); -$server->attach(new ProjectPermission($container)); -$server->attach(new Subtask($container)); -$server->attach(new Swimlane($container)); -$server->attach(new Task($container)); -$server->attach(new TaskLink($container)); -$server->attach(new User($container)); -$server->attach(new Group($container)); -$server->attach(new GroupMember($container)); +$server->attach(new MeApi($container)); +$server->attach(new ActionApi($container)); +$server->attach(new AppApi($container)); +$server->attach(new BoardApi($container)); +$server->attach(new ColumnApi($container)); +$server->attach(new CategoryApi($container)); +$server->attach(new CommentApi($container)); +$server->attach(new FileApi($container)); +$server->attach(new LinkApi($container)); +$server->attach(new ProjectApi($container)); +$server->attach(new ProjectPermissionApi($container)); +$server->attach(new SubtaskApi($container)); +$server->attach(new SwimlaneApi($container)); +$server->attach(new TaskApi($container)); +$server->attach(new TaskLinkApi($container)); +$server->attach(new UserApi($container)); +$server->attach(new GroupApi($container)); +$server->attach(new GroupMemberApi($container)); echo $server->execute();