@@ -6,8 +6,8 @@ |
||
| 6 | 6 | |
| 7 | 7 | $app = new Application(); |
| 8 | 8 | $app->setConfigPath(__DIR__ . '/../config') |
| 9 | - ->setAppPath(dirname(__DIR__)) |
|
| 10 | - ->setVendorPath(dirname(__DIR__) . '/../../vendor'); |
|
| 9 | + ->setAppPath(dirname(__DIR__)) |
|
| 10 | + ->setVendorPath(dirname(__DIR__) . '/../../vendor'); |
|
| 11 | 11 | |
| 12 | 12 | /** @var HttpKernel $kernel */ |
| 13 | 13 | $kernel = $app->make(HttpKernel::class); |
@@ -87,7 +87,7 @@ |
||
| 87 | 87 | $config = $app->get(Config::class); |
| 88 | 88 | |
| 89 | 89 | $pagination->setItemsPerPage($config->get('pagination.item_per_page', 10)) |
| 90 | - ->setMaxPages($config->get('pagination.max_pages', 5)); |
|
| 90 | + ->setMaxPages($config->get('pagination.max_pages', 5)); |
|
| 91 | 91 | |
| 92 | 92 | return $pagination; |
| 93 | 93 | }); |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | public function register(): void |
| 71 | 71 | { |
| 72 | - $this->app->bind(UrlGeneratorInterface::class, function (ContainerInterface $app) { |
|
| 72 | + $this->app->bind(UrlGeneratorInterface::class, function(ContainerInterface $app) { |
|
| 73 | 73 | return new ServerRequestUrlGenerator( |
| 74 | 74 | $app->get(ServerRequestInterface::class), |
| 75 | 75 | 'page' |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | }); |
| 78 | 78 | $this->app->bind(RendererInterface::class, BootstrapRenderer::class); |
| 79 | 79 | $this->app->bind(Pagination::class); |
| 80 | - $this->app->bind(Pagination::class, function (ContainerInterface $app) { |
|
| 80 | + $this->app->bind(Pagination::class, function(ContainerInterface $app) { |
|
| 81 | 81 | $pagination = new Pagination( |
| 82 | 82 | $app->get(UrlGeneratorInterface::class), |
| 83 | 83 | $app->get(RendererInterface::class) |
@@ -61,8 +61,7 @@ |
||
| 61 | 61 | * @class PaginationServiceProvider |
| 62 | 62 | * @package Platine\Framework\Service\Provider |
| 63 | 63 | */ |
| 64 | -class PaginationServiceProvider extends ServiceProvider |
|
| 65 | -{ |
|
| 64 | +class PaginationServiceProvider extends ServiceProvider { |
|
| 66 | 65 | |
| 67 | 66 | /** |
| 68 | 67 | * {@inheritdoc} |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | ) { |
| 75 | 75 | parent::__construct($application, $filesystem); |
| 76 | 76 | $this->setName('make:action') |
| 77 | - ->setDescription('Command to generate new request handler class'); |
|
| 77 | + ->setDescription('Command to generate new request handler class'); |
|
| 78 | 78 | |
| 79 | 79 | $this->addOption('-o|--overwrite', 'Overwrite existing files.', false, false); |
| 80 | 80 | } |
@@ -85,31 +85,3 @@ discard block |
||
| 85 | 85 | public function getClassTemplate(): string |
| 86 | 86 | { |
| 87 | 87 | return <<<EOF |
| 88 | - <?php |
|
| 89 | - |
|
| 90 | - declare(strict_types=1); |
|
| 91 | - |
|
| 92 | - namespace %namespace%; |
|
| 93 | - |
|
| 94 | - use Platine\Http\Handler\RequestHandlerInterface; |
|
| 95 | - use Platine\Http\ResponseInterface; |
|
| 96 | - use Platine\Http\ServerRequestInterface; |
|
| 97 | - |
|
| 98 | - /** |
|
| 99 | - * @class %classname% |
|
| 100 | - * @package %namespace% |
|
| 101 | - */ |
|
| 102 | - class %classname% implements RequestHandlerInterface |
|
| 103 | - { |
|
| 104 | - |
|
| 105 | - /** |
|
| 106 | - * {@inheritodc} |
|
| 107 | - */ |
|
| 108 | - public function handle(ServerRequestInterface \$request): ResponseInterface |
|
| 109 | - { |
|
| 110 | - } |
|
| 111 | - } |
|
| 112 | - |
|
| 113 | - EOF; |
|
| 114 | - } |
|
| 115 | -} |
|
@@ -85,31 +85,3 @@ |
||
| 85 | 85 | public function getClassTemplate(): string |
| 86 | 86 | { |
| 87 | 87 | return <<<EOF |
| 88 | - <?php |
|
| 89 | - |
|
| 90 | - declare(strict_types=1); |
|
| 91 | - |
|
| 92 | - namespace %namespace%; |
|
| 93 | - |
|
| 94 | - use Platine\Http\Handler\RequestHandlerInterface; |
|
| 95 | - use Platine\Http\ResponseInterface; |
|
| 96 | - use Platine\Http\ServerRequestInterface; |
|
| 97 | - |
|
| 98 | - /** |
|
| 99 | - * @class %classname% |
|
| 100 | - * @package %namespace% |
|
| 101 | - */ |
|
| 102 | - class %classname% implements RequestHandlerInterface |
|
| 103 | - { |
|
| 104 | - |
|
| 105 | - /** |
|
| 106 | - * {@inheritodc} |
|
| 107 | - */ |
|
| 108 | - public function handle(ServerRequestInterface \$request): ResponseInterface |
|
| 109 | - { |
|
| 110 | - } |
|
| 111 | - } |
|
| 112 | - |
|
| 113 | - EOF; |
|
| 114 | - } |
|
| 115 | -} |
|
@@ -85,31 +85,3 @@ |
||
| 85 | 85 | public function getClassTemplate(): string |
| 86 | 86 | { |
| 87 | 87 | return <<<EOF |
| 88 | - <?php |
|
| 89 | - |
|
| 90 | - declare(strict_types=1); |
|
| 91 | - |
|
| 92 | - namespace %namespace%; |
|
| 93 | - |
|
| 94 | - use Platine\Http\Handler\RequestHandlerInterface; |
|
| 95 | - use Platine\Http\ResponseInterface; |
|
| 96 | - use Platine\Http\ServerRequestInterface; |
|
| 97 | - |
|
| 98 | - /** |
|
| 99 | - * @class %classname% |
|
| 100 | - * @package %namespace% |
|
| 101 | - */ |
|
| 102 | - class %classname% implements RequestHandlerInterface |
|
| 103 | - { |
|
| 104 | - |
|
| 105 | - /** |
|
| 106 | - * {@inheritodc} |
|
| 107 | - */ |
|
| 108 | - public function handle(ServerRequestInterface \$request): ResponseInterface |
|
| 109 | - { |
|
| 110 | - } |
|
| 111 | - } |
|
| 112 | - |
|
| 113 | - EOF; |
|
| 114 | - } |
|
| 115 | -} |
|
@@ -55,8 +55,7 @@ discard block |
||
| 55 | 55 | * @class MakeActionCommand |
| 56 | 56 | * @package Platine\Framework\Console\Command |
| 57 | 57 | */ |
| 58 | -class MakeActionCommand extends MakeCommand |
|
| 59 | -{ |
|
| 58 | +class MakeActionCommand extends MakeCommand { |
|
| 60 | 59 | |
| 61 | 60 | /** |
| 62 | 61 | * {@inheritodc} |
@@ -85,31 +84,3 @@ discard block |
||
| 85 | 84 | public function getClassTemplate(): string |
| 86 | 85 | { |
| 87 | 86 | return <<<EOF |
| 88 | - <?php |
|
| 89 | - |
|
| 90 | - declare(strict_types=1); |
|
| 91 | - |
|
| 92 | - namespace %namespace%; |
|
| 93 | - |
|
| 94 | - use Platine\Http\Handler\RequestHandlerInterface; |
|
| 95 | - use Platine\Http\ResponseInterface; |
|
| 96 | - use Platine\Http\ServerRequestInterface; |
|
| 97 | - |
|
| 98 | - /** |
|
| 99 | - * @class %classname% |
|
| 100 | - * @package %namespace% |
|
| 101 | - */ |
|
| 102 | - class %classname% implements RequestHandlerInterface |
|
| 103 | - { |
|
| 104 | - |
|
| 105 | - /** |
|
| 106 | - * {@inheritodc} |
|
| 107 | - */ |
|
| 108 | - public function handle(ServerRequestInterface \$request): ResponseInterface |
|
| 109 | - { |
|
| 110 | - } |
|
| 111 | - } |
|
| 112 | - |
|
| 113 | - EOF; |
|
| 114 | - } |
|
| 115 | -} |
|
@@ -85,31 +85,3 @@ |
||
| 85 | 85 | public function getClassTemplate(): string |
| 86 | 86 | { |
| 87 | 87 | return <<<EOF |
| 88 | - <?php |
|
| 89 | - |
|
| 90 | - declare(strict_types=1); |
|
| 91 | - |
|
| 92 | - namespace %namespace%; |
|
| 93 | - |
|
| 94 | - use Platine\Http\Handler\RequestHandlerInterface; |
|
| 95 | - use Platine\Http\ResponseInterface; |
|
| 96 | - use Platine\Http\ServerRequestInterface; |
|
| 97 | - |
|
| 98 | - /** |
|
| 99 | - * @class %classname% |
|
| 100 | - * @package %namespace% |
|
| 101 | - */ |
|
| 102 | - class %classname% implements RequestHandlerInterface |
|
| 103 | - { |
|
| 104 | - |
|
| 105 | - /** |
|
| 106 | - * {@inheritodc} |
|
| 107 | - */ |
|
| 108 | - public function handle(ServerRequestInterface \$request): ResponseInterface |
|
| 109 | - { |
|
| 110 | - } |
|
| 111 | - } |
|
| 112 | - |
|
| 113 | - EOF; |
|
| 114 | - } |
|
| 115 | -} |
|
@@ -57,8 +57,7 @@ discard block |
||
| 57 | 57 | * @class MakeCommand |
| 58 | 58 | * @package Platine\Framework\Console |
| 59 | 59 | */ |
| 60 | -abstract class MakeCommand extends Command |
|
| 61 | -{ |
|
| 60 | +abstract class MakeCommand extends Command { |
|
| 62 | 61 | |
| 63 | 62 | /** |
| 64 | 63 | * The Application instance |
@@ -111,8 +110,7 @@ discard block |
||
| 111 | 110 | /** |
| 112 | 111 | * {@inheritodc} |
| 113 | 112 | */ |
| 114 | - public function execute() |
|
| 115 | - { |
|
| 113 | + public function execute() { |
|
| 116 | 114 | $writer = $this->io()->writer(); |
| 117 | 115 | $name = $this->getArgumentValue('name'); |
| 118 | 116 | $cleanName = str_replace('/', '\\', $name); |
@@ -71,7 +71,7 @@ |
||
| 71 | 71 | 'updated_at' => '?date', |
| 72 | 72 | ]); |
| 73 | 73 | |
| 74 | - $mapper->filter('status', function (Query $q, $status) { |
|
| 74 | + $mapper->filter('status', function(Query $q, $status) { |
|
| 75 | 75 | $q->where('status')->is($status); |
| 76 | 76 | }); |
| 77 | 77 | } |
@@ -124,16 +124,16 @@ |
||
| 124 | 124 | ->count('id'); |
| 125 | 125 | $currentPage = (int)$param->get('page', 1); |
| 126 | 126 | $this->pagination->setTotalItems($totalItems) |
| 127 | - ->setCurrentPage($currentPage); |
|
| 127 | + ->setCurrentPage($currentPage); |
|
| 128 | 128 | $limit = $this->pagination->getItemsPerPage(); |
| 129 | 129 | $offset = $this->pagination->getOffset(); |
| 130 | 130 | ////////// END PAGINATION ////////////////// |
| 131 | 131 | |
| 132 | 132 | $users = $this->userRepository |
| 133 | - ->limit($offset, $limit) |
|
| 134 | - ->orderBy(['lastname', 'firstname']) |
|
| 135 | - ->filters($filters) |
|
| 136 | - ->all(); |
|
| 133 | + ->limit($offset, $limit) |
|
| 134 | + ->orderBy(['lastname', 'firstname']) |
|
| 135 | + ->filters($filters) |
|
| 136 | + ->all(); |
|
| 137 | 137 | |
| 138 | 138 | $statusList = [ |
| 139 | 139 | 'D' => 'Deactive', |
@@ -122,7 +122,7 @@ |
||
| 122 | 122 | $totalItems = $this->userRepository->query() |
| 123 | 123 | ->filter($filters) |
| 124 | 124 | ->count('id'); |
| 125 | - $currentPage = (int)$param->get('page', 1); |
|
| 125 | + $currentPage = (int) $param->get('page', 1); |
|
| 126 | 126 | $this->pagination->setTotalItems($totalItems) |
| 127 | 127 | ->setCurrentPage($currentPage); |
| 128 | 128 | $limit = $this->pagination->getItemsPerPage(); |
@@ -181,9 +181,9 @@ |
||
| 181 | 181 | $this->logger->info('Deleted of users #{items}', ['items' => $items]); |
| 182 | 182 | |
| 183 | 183 | $this->userRepository->query() |
| 184 | - ->where('id') |
|
| 184 | + ->where('id') |
|
| 185 | 185 | ->in($items) |
| 186 | - ->delete(); |
|
| 186 | + ->delete(); |
|
| 187 | 187 | |
| 188 | 188 | $this->session->setFlash('success', $this->lang->tr('The selected users are deleted successfully')); |
| 189 | 189 | } |
@@ -107,17 +107,17 @@ |
||
| 107 | 107 | |
| 108 | 108 | ////////// BEGIN PAGINATION ////////////////// |
| 109 | 109 | $totalItems = $this->permissionRepository->query() |
| 110 | - ->count('id'); |
|
| 110 | + ->count('id'); |
|
| 111 | 111 | $currentPage = (int)$param->get('page', 1); |
| 112 | 112 | $this->pagination->setTotalItems($totalItems) |
| 113 | - ->setCurrentPage($currentPage); |
|
| 113 | + ->setCurrentPage($currentPage); |
|
| 114 | 114 | $limit = $this->pagination->getItemsPerPage(); |
| 115 | 115 | $offset = $this->pagination->getOffset(); |
| 116 | 116 | ////////// END PAGINATION ////////////////// |
| 117 | 117 | |
| 118 | 118 | $permissions = $this->permissionRepository->limit($offset, $limit) |
| 119 | - ->orderBy('code') |
|
| 120 | - ->all(); |
|
| 119 | + ->orderBy('code') |
|
| 120 | + ->all(); |
|
| 121 | 121 | return new TemplateResponse( |
| 122 | 122 | $this->template, |
| 123 | 123 | 'permission/list', |
@@ -108,7 +108,7 @@ |
||
| 108 | 108 | ////////// BEGIN PAGINATION ////////////////// |
| 109 | 109 | $totalItems = $this->permissionRepository->query() |
| 110 | 110 | ->count('id'); |
| 111 | - $currentPage = (int)$param->get('page', 1); |
|
| 111 | + $currentPage = (int) $param->get('page', 1); |
|
| 112 | 112 | $this->pagination->setTotalItems($totalItems) |
| 113 | 113 | ->setCurrentPage($currentPage); |
| 114 | 114 | $limit = $this->pagination->getItemsPerPage(); |
@@ -109,14 +109,14 @@ |
||
| 109 | 109 | ->count('id'); |
| 110 | 110 | $currentPage = (int)$param->get('page', 1); |
| 111 | 111 | $this->pagination->setTotalItems($totalItems) |
| 112 | - ->setCurrentPage($currentPage); |
|
| 112 | + ->setCurrentPage($currentPage); |
|
| 113 | 113 | $limit = $this->pagination->getItemsPerPage(); |
| 114 | 114 | $offset = $this->pagination->getOffset(); |
| 115 | 115 | ////////// END PAGINATION ////////////////// |
| 116 | 116 | |
| 117 | 117 | $roles = $this->roleRepository |
| 118 | - ->limit($offset, $limit) |
|
| 119 | - ->all(); |
|
| 118 | + ->limit($offset, $limit) |
|
| 119 | + ->all(); |
|
| 120 | 120 | |
| 121 | 121 | return new TemplateResponse( |
| 122 | 122 | $this->template, |
@@ -107,7 +107,7 @@ |
||
| 107 | 107 | ////////// BEGIN PAGINATION ////////////////// |
| 108 | 108 | $totalItems = $this->roleRepository->query() |
| 109 | 109 | ->count('id'); |
| 110 | - $currentPage = (int)$param->get('page', 1); |
|
| 110 | + $currentPage = (int) $param->get('page', 1); |
|
| 111 | 111 | $this->pagination->setTotalItems($totalItems) |
| 112 | 112 | ->setCurrentPage($currentPage); |
| 113 | 113 | $limit = $this->pagination->getItemsPerPage(); |