$server->register('getAllUsers', function () use($user) { return $user->getAll(); }); $server->register('updateUser', function ($values) use($user) { list($valid, ) = $user->validateModification($values); return $valid && $user->update($values); }); $server->register('removeUser', function ($user_id) use($user) { return $user->remove($user_id); }); /** * Category procedures */ $server->register('createCategory', function ($project_id, $name) use($category) { $values = array('project_id' => $project_id, 'name' => $name); list($valid, ) = $category->validateCreation($values); return $valid && $category->create($values); }); $server->register('getCategory', function ($category_id) use($category) { return $category->getById($category_id); }); $server->register('getAllCategories', function ($project_id) use($category) { return $category->getAll($project_id); }); $server->register('updateCategory', function ($id, $name) use($category) { $values = array('id' => $id, 'name' => $name); list($valid, ) = $category->validateModification($values); return $valid && $category->update($values); }); $server->register('removeCategory', function ($category_id) use($category) { return $category->remove($category_id);