diff --git a/CHANGELOG.md b/CHANGELOG.md index 053a4808..803989c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -116,6 +116,7 @@ - Added rate limit response headers (`X-RateLimit-Limit`, `X-RateLimit-Remaining`, `Retry-After`) - Added route-level metadata support on `Route` and `RouteBuilder` for rate limiting - Added unit test coverage for router integration, middleware flow, adapters, factory resolution, and exception behavior + - Updated `DemoApi` module templates to include default API route throttling and generated `config/rate_limit.php` (#510) - SleekDB adapter now supports related-model criteria path filtering across join depths while preserving DBAL public API (#508) ### Removed diff --git a/src/Module/Templates/DemoApi/src/DTOs/CommentDTO.php.tpl b/src/Module/Templates/DemoApi/src/DTOs/CommentDTO.php.tpl index e5fa9d94..181c19e8 100644 --- a/src/Module/Templates/DemoApi/src/DTOs/CommentDTO.php.tpl +++ b/src/Module/Templates/DemoApi/src/DTOs/CommentDTO.php.tpl @@ -22,26 +22,12 @@ use Quantum\Http\Request; */ class CommentDTO { - /** - * @var string - */ private string $postUuid; - /** - * @var string - */ private string $userUuid; - /** - * @var string - */ private string $content; - /** - * @param string $postUuid - * @param string $userUuid - * @param string $content - */ public function __construct( string $postUuid, string $userUuid, @@ -52,12 +38,6 @@ class CommentDTO $this->content = $content; } - /** - * @param Request $request - * @param string $postUuid - * @param string $userUuid - * @return self - */ public static function fromRequest(Request $request, string $postUuid, string $userUuid): self { return new self($postUuid, $userUuid, trim((string)$request->get('content'))); @@ -78,9 +58,6 @@ class CommentDTO return $this->content; } - /** - * @return array - */ public function toArray(): array { return [ diff --git a/src/Module/Templates/DemoApi/src/DTOs/PostDTO.php.tpl b/src/Module/Templates/DemoApi/src/DTOs/PostDTO.php.tpl index 0a193716..f280eb9b 100644 --- a/src/Module/Templates/DemoApi/src/DTOs/PostDTO.php.tpl +++ b/src/Module/Templates/DemoApi/src/DTOs/PostDTO.php.tpl @@ -22,32 +22,14 @@ use Quantum\Http\Request; */ class PostDTO { - /** - * @var string - */ private string $title; - /** - * @var string - */ private string $content; - /** - * @var string|null - */ private ?string $userUuid; - /** - * @var string|null - */ private ?string $image; - /** - * @param string $title - * @param string $content - * @param string|null $userUuid - * @param string|null $image - */ public function __construct( string $title, string $content, @@ -60,12 +42,6 @@ class PostDTO $this->image = $image; } - /** - * @param Request $request - * @param string|null $userUuid - * @param string|null $image - * @return self - */ public static function fromRequest(Request $request, ?string $userUuid = null, ?string $image = null): self { return new self( @@ -96,9 +72,6 @@ class PostDTO return $this->image; } - /** - * @return array - */ public function toArray(): array { return array_filter([ diff --git a/src/Module/Templates/DemoApi/src/DTOs/UserDTO.php.tpl b/src/Module/Templates/DemoApi/src/DTOs/UserDTO.php.tpl index a272cda1..e7f2402e 100644 --- a/src/Module/Templates/DemoApi/src/DTOs/UserDTO.php.tpl +++ b/src/Module/Templates/DemoApi/src/DTOs/UserDTO.php.tpl @@ -22,50 +22,20 @@ use Quantum\Http\Request; */ class UserDTO { - /** - * @var string - */ private string $email; - /** - * @var string - */ private string $password; - /** - * @var string - */ private string $firstname; - /** - * @var string - */ private string $lastname; - /** - * @var string - */ private string $role; - /** - * @var string|null - */ private ?string $uuid; - /** - * @var string - */ private string $image; - /** - * @param string $email - * @param string $password - * @param string $firstname - * @param string $lastname - * @param string $role - * @param string|null $uuid - * @param string $image - */ public function __construct( string $email, string $password, @@ -84,12 +54,6 @@ class UserDTO $this->image = $image; } - /** - * @param Request $request - * @param string $role - * @param string|null $uuid - * @return self - */ public static function fromRequest(Request $request, string $role, ?string $uuid = null): self { return new self( @@ -139,7 +103,6 @@ class UserDTO /** * Converts DTO to array for framework interface compatibility - * @return array */ public function toArray(): array { diff --git a/src/Module/Templates/DemoApi/src/Middlewares/BaseMiddleware.php.tpl b/src/Module/Templates/DemoApi/src/Middlewares/BaseMiddleware.php.tpl index f52ccb65..c49fec71 100644 --- a/src/Module/Templates/DemoApi/src/Middlewares/BaseMiddleware.php.tpl +++ b/src/Module/Templates/DemoApi/src/Middlewares/BaseMiddleware.php.tpl @@ -49,7 +49,6 @@ abstract class BaseMiddleware extends Middleware /** * Validate the request and respond with error if invalid. - * @return Response|null */ protected function validateRequest(Request $request): ?Response { diff --git a/src/Module/Templates/DemoApi/src/Models/Comment.php.tpl b/src/Module/Templates/DemoApi/src/Models/Comment.php.tpl index 44fedf15..bc91efdf 100644 --- a/src/Module/Templates/DemoApi/src/Models/Comment.php.tpl +++ b/src/Module/Templates/DemoApi/src/Models/Comment.php.tpl @@ -31,19 +31,16 @@ class Comment extends DbModel /** * ID column of table - * @var string */ public string $idColumn = 'id'; /** * The table name - * @var string */ public string $table = 'comments'; /** * Fillable properties - * @var array */ public array $fillable = [ 'uuid', @@ -54,7 +51,6 @@ class Comment extends DbModel /** * Model relations configuration - * @return array[] */ public function relations(): array { diff --git a/src/Module/Templates/DemoApi/src/Models/Post.php.tpl b/src/Module/Templates/DemoApi/src/Models/Post.php.tpl index 71a5ec6c..32710f7b 100644 --- a/src/Module/Templates/DemoApi/src/Models/Post.php.tpl +++ b/src/Module/Templates/DemoApi/src/Models/Post.php.tpl @@ -31,19 +31,16 @@ class Post extends DbModel /** * ID column of table - * @var string */ public string $idColumn = 'id'; /** * The table name - * @var string */ public string $table = 'posts'; /** * Fillable properties - * @var array */ public array $fillable = [ 'uuid', @@ -55,7 +52,6 @@ class Post extends DbModel /** * Model relations configuration - * @return array[] */ public function relations(): array { diff --git a/src/Module/Templates/DemoApi/src/Services/AuthService.php.tpl b/src/Module/Templates/DemoApi/src/Services/AuthService.php.tpl index 5ceead6e..36f9bce7 100644 --- a/src/Module/Templates/DemoApi/src/Services/AuthService.php.tpl +++ b/src/Module/Templates/DemoApi/src/Services/AuthService.php.tpl @@ -30,10 +30,6 @@ use {{MODULE_NAMESPACE}}\Models\User; */ class AuthService extends Service implements AuthServiceInterface { - - /** - * @var User - */ private User $model; /** @@ -46,7 +42,6 @@ class AuthService extends Service implements AuthServiceInterface /** * Get users - * @return ModelCollection * @throws BaseException */ public function getAll(): ModelCollection @@ -56,8 +51,6 @@ class AuthService extends Service implements AuthServiceInterface /** * Get user - * @param string $uuid - * @return User|null * @throws BaseException */ public function getUserByUuid(string $uuid): ?User @@ -67,9 +60,6 @@ class AuthService extends Service implements AuthServiceInterface /** * Get user - * @param string $field - * @param $value - * @return AuthUser|null * @throws BaseException */ public function get(string $field, $value): ?AuthUser @@ -85,8 +75,6 @@ class AuthService extends Service implements AuthServiceInterface /** * Add user - * @param array $data - * @return AuthUser * @throws BaseException * @throws ConfigException * @throws DiException @@ -107,10 +95,6 @@ class AuthService extends Service implements AuthServiceInterface /** * Update user - * @param string $field - * @param string|null $value - * @param array $data - * @return AuthUser|null * @throws BaseException * @throws ModelException */ @@ -140,7 +124,6 @@ class AuthService extends Service implements AuthServiceInterface /** * User Schema - * @return array */ public function userSchema(): array { @@ -166,7 +149,6 @@ class AuthService extends Service implements AuthServiceInterface /** * Creates user directory - * @param string $uuid * @throws DiException * @throws ReflectionException * @throws BaseException diff --git a/src/Module/Templates/DemoApi/src/Services/CommentService.php.tpl b/src/Module/Templates/DemoApi/src/Services/CommentService.php.tpl index 051a6905..7303b567 100644 --- a/src/Module/Templates/DemoApi/src/Services/CommentService.php.tpl +++ b/src/Module/Templates/DemoApi/src/Services/CommentService.php.tpl @@ -28,19 +28,11 @@ use {{MODULE_NAMESPACE}}\Models\User; */ class CommentService extends Service { - - /** - * @var Comment - */ private Comment $model; - /** - * @var CommentTransformer - */ private CommentTransformer $transformer; /** - * @param CommentTransformer $transformer * @throws ModelException */ public function __construct(CommentTransformer $transformer) @@ -51,8 +43,6 @@ class CommentService extends Service /** * Get comments by post - * @param string $postUuid - * @return mixed * @throws BaseException * @throws ModelException */ @@ -77,8 +67,6 @@ class CommentService extends Service /** * Get comment - * @param string $uuid - * @return Comment */ public function getComment(string $uuid): Comment { @@ -87,8 +75,6 @@ class CommentService extends Service /** * Add a new comment - * @param CommentDTO $commentDto - * @return array * @throws ModelException */ public function addComment(CommentDTO $commentDto): array @@ -104,8 +90,6 @@ class CommentService extends Service /** * Delete a comment - * @param string $uuid - * @return bool * @throws BaseException * @throws ModelException */ @@ -125,8 +109,6 @@ class CommentService extends Service /** * Transform data - * @param array $comments - * @return array */ public function transformData(array $comments): array { diff --git a/src/Module/Templates/DemoApi/src/Services/PostService.php.tpl b/src/Module/Templates/DemoApi/src/Services/PostService.php.tpl index c160820d..e833c95c 100644 --- a/src/Module/Templates/DemoApi/src/Services/PostService.php.tpl +++ b/src/Module/Templates/DemoApi/src/Services/PostService.php.tpl @@ -37,19 +37,11 @@ use Quantum\Model\DbModel; */ class PostService extends Service { - - /** - * @var Post - */ private Post $model; - /** - * @var PostTransformer - */ private PostTransformer $transformer; /** - * @param PostTransformer $transformer * @throws ModelException */ public function __construct(PostTransformer $transformer) @@ -61,10 +53,6 @@ class PostService extends Service /** * Get posts - * @param int|null $perPage - * @param int|null $currentPage - * @param string|null $search - * @return mixed * @throws BaseException * @throws ModelException */ @@ -100,8 +88,6 @@ class PostService extends Service /** * Get post - * @param string $uuid - * @return Post|null * @throws BaseException * @throws ModelException */ @@ -126,8 +112,6 @@ class PostService extends Service /** * Get my posts - * @param string $userUuid - * @return ModelCollection|null * @throws BaseException * @throws ModelException */ @@ -151,8 +135,6 @@ class PostService extends Service /** * Add post - * @param PostDTO $postDto - * @return Post * @throws BaseException * @throws ModelException */ @@ -169,9 +151,6 @@ class PostService extends Service /** * Update post - * @param string $uuid - * @param PostDTO $postDto - * @return Post * @throws BaseException * @throws ModelException */ @@ -186,8 +165,6 @@ class PostService extends Service /** * Deletes post - * @param string $uuid - * @return bool */ public function deletePost(string $uuid): bool { @@ -205,10 +182,6 @@ class PostService extends Service /** * Saves the post images - * @param UploadedFile $uploadedFile - * @param string $imageDirectory - * @param string $imageName - * @return string * @throws EnvException * @throws FileSystemException * @throws FileUploadException @@ -225,7 +198,6 @@ class PostService extends Service /** * Deletes the post image - * @param string $imagePath * @throws BaseException * @throws DiException * @throws ReflectionException @@ -241,8 +213,6 @@ class PostService extends Service /** * Transforms the data - * @param array $posts - * @return array */ public function transformData(array $posts): array { diff --git a/src/Module/Templates/DemoApi/src/Transformers/PostTransformer.php.tpl b/src/Module/Templates/DemoApi/src/Transformers/PostTransformer.php.tpl index f81acbd0..8e71fb48 100644 --- a/src/Module/Templates/DemoApi/src/Transformers/PostTransformer.php.tpl +++ b/src/Module/Templates/DemoApi/src/Transformers/PostTransformer.php.tpl @@ -22,11 +22,8 @@ use Quantum\Transformer\Contracts\TransformerInterface; */ class PostTransformer implements TransformerInterface { - /** * Transforms the post data - * @param $item - * @return mixed */ public function transform($item): array { diff --git a/src/Module/Templates/DemoApi/src/config/rate_limit.php.tpl b/src/Module/Templates/DemoApi/src/config/rate_limit.php.tpl new file mode 100644 index 00000000..d01f8fcb --- /dev/null +++ b/src/Module/Templates/DemoApi/src/config/rate_limit.php.tpl @@ -0,0 +1,33 @@ + env('RATE_LIMIT_ADAPTER', 'file'), + + /** + * --------------------------------------------------------- + * File adapter + * --------------------------------------------------------- + */ + 'file' => [ + 'path' => base_dir() . DS . 'cache' . DS . 'data', + 'ttl' => 60, + 'prefix' => 'api-rate-limit:', + ], + + /** + * --------------------------------------------------------- + * Redis adapter + * --------------------------------------------------------- + */ + 'redis' => [ + 'host' => env('REDIS_HOST', '127.0.0.1'), + 'port' => env('REDIS_PORT', 6379), + 'ttl' => 60, + 'prefix' => 'api-rate-limit:', + ], +]; diff --git a/src/Module/Templates/DemoApi/src/routes/routes.php.tpl b/src/Module/Templates/DemoApi/src/routes/routes.php.tpl index ca314224..d7668f4b 100644 --- a/src/Module/Templates/DemoApi/src/routes/routes.php.tpl +++ b/src/Module/Templates/DemoApi/src/routes/routes.php.tpl @@ -1,16 +1,23 @@ get('[:alpha:2]?/posts', 'PostController', 'posts')->name('posts'); - $route->get('[:alpha:2]?/post/[uuid=:any]', 'PostController', 'post'); + $route->group('public-content', function ($route) { + $route->get('[:alpha:2]?/posts', 'PostController', 'posts')->name('posts'); + $route->get('[:alpha:2]?/post/[uuid=:any]', 'PostController', 'post'); + })->rateLimit(120, 60); - $route->post('[:alpha:2]?/signin', 'AuthController', 'signin'); - $route->post('[:alpha:2]?/signup', 'AuthController', 'signup')->middlewares(['Signup']); - $route->post('[:alpha:2]?/forget', 'AuthController', 'forget')->middlewares(['Forget']); - $route->get('[:alpha:2]?/activate/[token=:any]', 'AuthController', 'activate')->middlewares(['Activate']); - $route->post('[:alpha:2]?/reset/[token=:any]', 'AuthController', 'reset')->middlewares(['Reset']); - $route->get('[:alpha:2]?/resend/[code=:any]', 'AuthController', 'resend')->middlewares(['Resend']); - $route->post('[:alpha:2]?/verify', 'AuthController', 'verify')->middlewares(['Verify']); + $route->group('auth-signin-verify', function ($route) { + $route->post('[:alpha:2]?/signin', 'AuthController', 'signin'); + $route->get('[:alpha:2]?/resend/[code=:any]', 'AuthController', 'resend')->middlewares(['Resend']); + $route->post('[:alpha:2]?/verify', 'AuthController', 'verify')->middlewares(['Verify']); + $route->get('[:alpha:2]?/activate/[token=:any]', 'AuthController', 'activate')->middlewares(['Activate']); + })->rateLimit(10, 60); + + $route->group('auth-signup-recovery', function ($route) { + $route->post('[:alpha:2]?/signup', 'AuthController', 'signup')->middlewares(['Signup']); + $route->post('[:alpha:2]?/forget', 'AuthController', 'forget')->middlewares(['Forget']); + $route->post('[:alpha:2]?/reset/[token=:any]', 'AuthController', 'reset')->middlewares(['Reset']); + })->rateLimit(5, 60); $route->group('auth', function ($route) { $route->get('[:alpha:2]?/my-posts', 'PostManagementController', 'myPosts')->middlewares(['Editor']); @@ -26,5 +33,5 @@ return function ($route) { $route->put('[:alpha:2]?/account-settings/update-password', 'AccountController', 'updatePassword')->middlewares(['Password']); $route->get('[:alpha:2]?/signout', 'AuthController', 'signout')->middlewares(['Signout']); $route->get('[:alpha:2]?/me', 'AuthController', 'me'); - })->middlewares(['Auth']); + })->middlewares(['Auth'])->rateLimit(60, 60); }; diff --git a/src/Module/Templates/DemoWeb/src/DTOs/CommentDTO.php.tpl b/src/Module/Templates/DemoWeb/src/DTOs/CommentDTO.php.tpl index e5fa9d94..181c19e8 100644 --- a/src/Module/Templates/DemoWeb/src/DTOs/CommentDTO.php.tpl +++ b/src/Module/Templates/DemoWeb/src/DTOs/CommentDTO.php.tpl @@ -22,26 +22,12 @@ use Quantum\Http\Request; */ class CommentDTO { - /** - * @var string - */ private string $postUuid; - /** - * @var string - */ private string $userUuid; - /** - * @var string - */ private string $content; - /** - * @param string $postUuid - * @param string $userUuid - * @param string $content - */ public function __construct( string $postUuid, string $userUuid, @@ -52,12 +38,6 @@ class CommentDTO $this->content = $content; } - /** - * @param Request $request - * @param string $postUuid - * @param string $userUuid - * @return self - */ public static function fromRequest(Request $request, string $postUuid, string $userUuid): self { return new self($postUuid, $userUuid, trim((string)$request->get('content'))); @@ -78,9 +58,6 @@ class CommentDTO return $this->content; } - /** - * @return array - */ public function toArray(): array { return [ diff --git a/src/Module/Templates/DemoWeb/src/DTOs/PostDTO.php.tpl b/src/Module/Templates/DemoWeb/src/DTOs/PostDTO.php.tpl index 0a193716..f280eb9b 100644 --- a/src/Module/Templates/DemoWeb/src/DTOs/PostDTO.php.tpl +++ b/src/Module/Templates/DemoWeb/src/DTOs/PostDTO.php.tpl @@ -22,32 +22,14 @@ use Quantum\Http\Request; */ class PostDTO { - /** - * @var string - */ private string $title; - /** - * @var string - */ private string $content; - /** - * @var string|null - */ private ?string $userUuid; - /** - * @var string|null - */ private ?string $image; - /** - * @param string $title - * @param string $content - * @param string|null $userUuid - * @param string|null $image - */ public function __construct( string $title, string $content, @@ -60,12 +42,6 @@ class PostDTO $this->image = $image; } - /** - * @param Request $request - * @param string|null $userUuid - * @param string|null $image - * @return self - */ public static function fromRequest(Request $request, ?string $userUuid = null, ?string $image = null): self { return new self( @@ -96,9 +72,6 @@ class PostDTO return $this->image; } - /** - * @return array - */ public function toArray(): array { return array_filter([ diff --git a/src/Module/Templates/DemoWeb/src/DTOs/UserDTO.php.tpl b/src/Module/Templates/DemoWeb/src/DTOs/UserDTO.php.tpl index a272cda1..e7f2402e 100644 --- a/src/Module/Templates/DemoWeb/src/DTOs/UserDTO.php.tpl +++ b/src/Module/Templates/DemoWeb/src/DTOs/UserDTO.php.tpl @@ -22,50 +22,20 @@ use Quantum\Http\Request; */ class UserDTO { - /** - * @var string - */ private string $email; - /** - * @var string - */ private string $password; - /** - * @var string - */ private string $firstname; - /** - * @var string - */ private string $lastname; - /** - * @var string - */ private string $role; - /** - * @var string|null - */ private ?string $uuid; - /** - * @var string - */ private string $image; - /** - * @param string $email - * @param string $password - * @param string $firstname - * @param string $lastname - * @param string $role - * @param string|null $uuid - * @param string $image - */ public function __construct( string $email, string $password, @@ -84,12 +54,6 @@ class UserDTO $this->image = $image; } - /** - * @param Request $request - * @param string $role - * @param string|null $uuid - * @return self - */ public static function fromRequest(Request $request, string $role, ?string $uuid = null): self { return new self( @@ -139,7 +103,6 @@ class UserDTO /** * Converts DTO to array for framework interface compatibility - * @return array */ public function toArray(): array { diff --git a/src/Module/Templates/DemoWeb/src/Middlewares/BaseMiddleware.php.tpl b/src/Module/Templates/DemoWeb/src/Middlewares/BaseMiddleware.php.tpl index c13b3eee..54565e98 100644 --- a/src/Module/Templates/DemoWeb/src/Middlewares/BaseMiddleware.php.tpl +++ b/src/Module/Templates/DemoWeb/src/Middlewares/BaseMiddleware.php.tpl @@ -37,9 +37,6 @@ abstract class BaseMiddleware extends Middleware $this->defineValidationRules($request); } - /** - * @return Response|null - */ protected function validateRequest(Request $request): ?Response { if (!$this->validator->isValid($request->all())) { diff --git a/src/Module/Templates/DemoWeb/src/Models/Comment.php.tpl b/src/Module/Templates/DemoWeb/src/Models/Comment.php.tpl index 44fedf15..74a8d8d1 100644 --- a/src/Module/Templates/DemoWeb/src/Models/Comment.php.tpl +++ b/src/Module/Templates/DemoWeb/src/Models/Comment.php.tpl @@ -14,9 +14,9 @@ namespace {{MODULE_NAMESPACE}}\Models; -use Quantum\Database\Enums\Relation; use Quantum\Model\Traits\HasTimestamps; use Quantum\Model\Traits\SoftDeletes; +use Quantum\Database\Enums\Relation; use Quantum\Model\DbModel; /** @@ -31,19 +31,16 @@ class Comment extends DbModel /** * ID column of table - * @var string */ public string $idColumn = 'id'; /** * The table name - * @var string */ public string $table = 'comments'; /** * Fillable properties - * @var array */ public array $fillable = [ 'uuid', @@ -54,7 +51,6 @@ class Comment extends DbModel /** * Model relations configuration - * @return array[] */ public function relations(): array { diff --git a/src/Module/Templates/DemoWeb/src/Models/Post.php.tpl b/src/Module/Templates/DemoWeb/src/Models/Post.php.tpl index 71a5ec6c..5ed2d9fb 100644 --- a/src/Module/Templates/DemoWeb/src/Models/Post.php.tpl +++ b/src/Module/Templates/DemoWeb/src/Models/Post.php.tpl @@ -14,9 +14,9 @@ namespace {{MODULE_NAMESPACE}}\Models; -use Quantum\Database\Enums\Relation; use Quantum\Model\Traits\HasTimestamps; use Quantum\Model\Traits\SoftDeletes; +use Quantum\Database\Enums\Relation; use Quantum\Model\DbModel; /** @@ -31,19 +31,16 @@ class Post extends DbModel /** * ID column of table - * @var string */ public string $idColumn = 'id'; /** * The table name - * @var string */ public string $table = 'posts'; /** * Fillable properties - * @var array */ public array $fillable = [ 'uuid', @@ -55,7 +52,6 @@ class Post extends DbModel /** * Model relations configuration - * @return array[] */ public function relations(): array { diff --git a/src/Module/Templates/DemoWeb/src/Services/AuthService.php.tpl b/src/Module/Templates/DemoWeb/src/Services/AuthService.php.tpl index 5ceead6e..36f9bce7 100644 --- a/src/Module/Templates/DemoWeb/src/Services/AuthService.php.tpl +++ b/src/Module/Templates/DemoWeb/src/Services/AuthService.php.tpl @@ -30,10 +30,6 @@ use {{MODULE_NAMESPACE}}\Models\User; */ class AuthService extends Service implements AuthServiceInterface { - - /** - * @var User - */ private User $model; /** @@ -46,7 +42,6 @@ class AuthService extends Service implements AuthServiceInterface /** * Get users - * @return ModelCollection * @throws BaseException */ public function getAll(): ModelCollection @@ -56,8 +51,6 @@ class AuthService extends Service implements AuthServiceInterface /** * Get user - * @param string $uuid - * @return User|null * @throws BaseException */ public function getUserByUuid(string $uuid): ?User @@ -67,9 +60,6 @@ class AuthService extends Service implements AuthServiceInterface /** * Get user - * @param string $field - * @param $value - * @return AuthUser|null * @throws BaseException */ public function get(string $field, $value): ?AuthUser @@ -85,8 +75,6 @@ class AuthService extends Service implements AuthServiceInterface /** * Add user - * @param array $data - * @return AuthUser * @throws BaseException * @throws ConfigException * @throws DiException @@ -107,10 +95,6 @@ class AuthService extends Service implements AuthServiceInterface /** * Update user - * @param string $field - * @param string|null $value - * @param array $data - * @return AuthUser|null * @throws BaseException * @throws ModelException */ @@ -140,7 +124,6 @@ class AuthService extends Service implements AuthServiceInterface /** * User Schema - * @return array */ public function userSchema(): array { @@ -166,7 +149,6 @@ class AuthService extends Service implements AuthServiceInterface /** * Creates user directory - * @param string $uuid * @throws DiException * @throws ReflectionException * @throws BaseException diff --git a/src/Module/Templates/DemoWeb/src/Services/CommandService.php.tpl b/src/Module/Templates/DemoWeb/src/Services/CommandService.php.tpl index fab87264..82ccca52 100644 --- a/src/Module/Templates/DemoWeb/src/Services/CommandService.php.tpl +++ b/src/Module/Templates/DemoWeb/src/Services/CommandService.php.tpl @@ -27,7 +27,6 @@ class CommandService extends Service /** * Get all available commands (core + app) - * @return array * @throws ReflectionException */ public function getAllCommands(): array diff --git a/src/Module/Templates/DemoWeb/src/Services/CommentService.php.tpl b/src/Module/Templates/DemoWeb/src/Services/CommentService.php.tpl index ab1403f1..a9951595 100644 --- a/src/Module/Templates/DemoWeb/src/Services/CommentService.php.tpl +++ b/src/Module/Templates/DemoWeb/src/Services/CommentService.php.tpl @@ -28,19 +28,11 @@ use {{MODULE_NAMESPACE}}\Models\User; */ class CommentService extends Service { - - /** - * @var Comment - */ private Comment $model; - /** - * @var CommentTransformer - */ private CommentTransformer $transformer; /** - * @param CommentTransformer $transformer * @throws ModelException */ public function __construct(CommentTransformer $transformer) @@ -51,8 +43,6 @@ class CommentService extends Service /** * Get comments by post - * @param string $postUuid - * @return mixed * @throws BaseException * @throws ModelException */ @@ -77,8 +67,6 @@ class CommentService extends Service /** * Get comment - * @param string $uuid - * @return Comment * @throws BaseException */ public function getComment(string $uuid): Comment @@ -88,8 +76,6 @@ class CommentService extends Service /** * Add a new comment - * @param CommentDTO $commentDto - * @return array * @throws ModelException */ public function addComment(CommentDTO $commentDto): array @@ -105,8 +91,6 @@ class CommentService extends Service /** * Delete a comment - * @param string $uuid - * @return bool * @throws BaseException * @throws ModelException */ @@ -126,8 +110,6 @@ class CommentService extends Service /** * Transform data - * @param array $comments - * @return array */ public function transformData(array $comments): array { diff --git a/src/Module/Templates/DemoWeb/src/Services/PostService.php.tpl b/src/Module/Templates/DemoWeb/src/Services/PostService.php.tpl index c3847cf7..3cbfaaea 100644 --- a/src/Module/Templates/DemoWeb/src/Services/PostService.php.tpl +++ b/src/Module/Templates/DemoWeb/src/Services/PostService.php.tpl @@ -36,19 +36,11 @@ use Quantum\Service\Service; */ class PostService extends Service { - - /** - * @var Post - */ private Post $model; - /** - * @var PostTransformer - */ private PostTransformer $transformer; /** - * @param PostTransformer $transformer * @throws ModelException */ public function __construct(PostTransformer $transformer) @@ -59,10 +51,6 @@ class PostService extends Service /** * Get posts - * @param int|null $perPage - * @param int|null $currentPage - * @param string|null $search - * @return mixed * @throws BaseException * @throws ModelException */ @@ -98,8 +86,6 @@ class PostService extends Service /** * Get post - * @param string $uuid - * @return Post * @throws BaseException * @throws ModelException */ @@ -124,8 +110,6 @@ class PostService extends Service /** * Get my posts - * @param string $userUuid - * @return ModelCollection|null * @throws BaseException * @throws ModelException */ @@ -149,8 +133,6 @@ class PostService extends Service /** * Add post - * @param PostDTO $postDto - * @return Post * @throws BaseException * @throws ModelException */ @@ -167,9 +149,6 @@ class PostService extends Service /** * Update post - * @param string $uuid - * @param PostDTO $postDto - * @return Post * @throws BaseException * @throws ModelException */ @@ -184,8 +163,6 @@ class PostService extends Service /** * Deletes post - * @param string $uuid - * @return bool */ public function deletePost(string $uuid): bool { @@ -203,10 +180,6 @@ class PostService extends Service /** * Saves the post images - * @param UploadedFile $uploadedFile - * @param string $imageDirectory - * @param string $imageName - * @return string * @throws EnvException * @throws FileSystemException * @throws FileUploadException @@ -223,7 +196,6 @@ class PostService extends Service /** * Deletes the post image - * @param string $imagePath * @throws BaseException * @throws DiException * @throws ReflectionException @@ -239,8 +211,6 @@ class PostService extends Service /** * Transforms the data - * @param array $posts - * @return array */ public function transformData(array $posts): array { diff --git a/src/Module/Templates/DemoWeb/src/Transformers/PostTransformer.php.tpl b/src/Module/Templates/DemoWeb/src/Transformers/PostTransformer.php.tpl index f81acbd0..f1ea98a6 100644 --- a/src/Module/Templates/DemoWeb/src/Transformers/PostTransformer.php.tpl +++ b/src/Module/Templates/DemoWeb/src/Transformers/PostTransformer.php.tpl @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.8 + * @since 3.0.0 */ namespace {{MODULE_NAMESPACE}}\Transformers; @@ -22,11 +22,8 @@ use Quantum\Transformer\Contracts\TransformerInterface; */ class PostTransformer implements TransformerInterface { - /** * Transforms the post data - * @param $item - * @return mixed */ public function transform($item): array { diff --git a/src/Module/Templates/Toolkit/src/Services/DatabaseService.php.tpl b/src/Module/Templates/Toolkit/src/Services/DatabaseService.php.tpl index cf513b2c..b033997a 100644 --- a/src/Module/Templates/Toolkit/src/Services/DatabaseService.php.tpl +++ b/src/Module/Templates/Toolkit/src/Services/DatabaseService.php.tpl @@ -28,9 +28,6 @@ use ReflectionException; */ class DatabaseService extends Service { - /** - * @var string - */ protected string $storeDirectory; public function __construct() @@ -40,7 +37,6 @@ class DatabaseService extends Service /** * Get tables - * @return array * @throws BaseException * @throws ReflectionException */ @@ -65,9 +61,6 @@ class DatabaseService extends Service /** * Check table existence - * @param string $tableName - * @param string|null $except - * @return bool * @throws BaseException * @throws ConfigException * @throws DiException @@ -84,10 +77,6 @@ class DatabaseService extends Service /** * Get table data - * @param string $tableName - * @param int $perPage - * @param int $currentPage - * @return array */ public function getTableData(string $tableName, int $perPage, int $currentPage): array { @@ -104,9 +93,6 @@ class DatabaseService extends Service /** * Create table row - * @param string $tableName - * @param array $data - * @return void */ public function createTableRow(string $tableName, array $data): void { @@ -123,10 +109,6 @@ class DatabaseService extends Service /** * Update table row - * @param string $tableName - * @param int $id - * @param array $data - * @return void */ public function updateTable(string $tableName, int $id, array $data): void { @@ -143,9 +125,6 @@ class DatabaseService extends Service /** * Delete table row - * @param string $tableName - * @param int $id - * @return void */ public function deleteTableRow(string $tableName, int $id): void { @@ -154,8 +133,6 @@ class DatabaseService extends Service /** * Extract columns - * @param Paginator $paginator - * @return array */ private function extractColumns(Paginator $paginator): array { diff --git a/src/Module/Templates/Toolkit/src/Services/EmailService.php.tpl b/src/Module/Templates/Toolkit/src/Services/EmailService.php.tpl index 5d352228..e76ffb12 100644 --- a/src/Module/Templates/Toolkit/src/Services/EmailService.php.tpl +++ b/src/Module/Templates/Toolkit/src/Services/EmailService.php.tpl @@ -31,9 +31,6 @@ use Quantum\Di\Di; */ class EmailService extends Service { - /** - * @var string - */ private string $emailsDirectory; @@ -43,9 +40,6 @@ class EmailService extends Service } /** - * @param int $perPage - * @param int $currentPage - * @return Paginator * @throws BaseException * @throws ReflectionException */ @@ -82,8 +76,6 @@ class EmailService extends Service } /** - * @param string $emailId - * @return MailTrap * @throws BaseException */ public function getEmail(string $emailId): MailTrap @@ -94,8 +86,6 @@ class EmailService extends Service } /** - * @param string $emailId - * @return bool * @throws BaseException * @throws ReflectionException */ @@ -103,11 +93,6 @@ class EmailService extends Service { return fs()->remove($this->emailsDirectory . DS . $emailId . '.eml'); } - - /** - * @param string $messageId - * @return string - */ private function getEmailId(string $messageId): string { preg_match('/<(.*?)@/', preg_quote($messageId), $matches); @@ -116,10 +101,6 @@ class EmailService extends Service } /** - * @param array $data - * @param int $perPage - * @param int $currentPage - * @return Paginator * @throws BaseException * @throws PaginatorException */ diff --git a/src/Module/Templates/Toolkit/src/Services/LogsService.php.tpl b/src/Module/Templates/Toolkit/src/Services/LogsService.php.tpl index 6b01f784..a7b1291c 100644 --- a/src/Module/Templates/Toolkit/src/Services/LogsService.php.tpl +++ b/src/Module/Templates/Toolkit/src/Services/LogsService.php.tpl @@ -32,7 +32,6 @@ class LogsService extends Service { /** * Retrieves a list of available log file names from the logs directory. - * @return array * @throws BaseException * @throws ReflectionException */ @@ -53,10 +52,6 @@ class LogsService extends Service /** * Parses a specific log file and returns paginated log entries. - * @param string $logFile - * @param int $perPage - * @param int $currentPage - * @return Paginator * @throws BaseException * @throws PaginatorException * @throws ReflectionException @@ -89,10 +84,6 @@ class LogsService extends Service /** * Paginates an array of data. - * @param array $data - * @param int $perPage - * @param int $currentPage - * @return Paginator * @throws BaseException * @throws PaginatorException */