Skip to content

Commit 0717fc1

Browse files
committed
lint
1 parent fbff3f7 commit 0717fc1

28 files changed

Lines changed: 85 additions & 82 deletions

src/Application/Actions/Api/v1/EntityAction.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ protected function action(): \Slim\Psr7\Response
3232

3333
try {
3434
$apikey = (bool) $this->request->getAttribute('apikey', false);
35-
$entity = ltrim($this->resolveArg('args'), '/');
35+
$entity = mb_ltrim($this->resolveArg('args'), '/');
3636
$params = $this->getParamsQuery();
3737
$service = $this->getService($entity);
3838

src/Application/Actions/Api/v1/SearchAction.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class SearchAction extends ActionApi
1414
protected function action(): \Slim\Psr7\Response
1515
{
1616
try {
17-
$query = trim(str_escape($this->getParam('query', $this->getParam('q', ''))));
17+
$query = mb_trim(str_escape($this->getParam('query', $this->getParam('q', ''))));
1818
$index_type = $this->getParam('type', $this->getParam('t', ''));
1919
$limit = (int) $this->getParam('limit', $this->parameter('search_limit', 10));
2020
$result = collect();

src/Application/Actions/Common/Catalog/ListAction.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ private function parsePath(): array
4949

5050
// remove starting prefix /catalog
5151
if (str_starts_with($path, '/catalog')) {
52-
$path = substr($path, strlen('/catalog'));
52+
$path = mb_substr($path, mb_strlen('/catalog'));
5353
}
5454

55-
$parts = explode('/', ltrim($path, '/'));
55+
$parts = explode('/', mb_ltrim($path, '/'));
5656
$offset = 0;
5757

5858
if ($parts && ctype_digit(end($parts))) {

src/Application/Actions/Common/PageAction.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ protected function action(): \Slim\Psr7\Response
1414
$pageService = $this->container->get(PageService::class);
1515

1616
try {
17-
$page = $pageService->read(['address' => ltrim($this->resolveArg('args'), '/')]);
17+
$page = $pageService->read(['address' => mb_ltrim($this->resolveArg('args'), '/')]);
1818

1919
return $this->respond($page->template, [
2020
'page' => $page,

src/Application/Actions/Common/SearchAction.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class SearchAction extends AbstractAction
1212
{
1313
protected function action(): \Slim\Psr7\Response
1414
{
15-
$query = trim(str_escape(strip_tags($this->getParam('query', $this->getParam('q', '')))));
15+
$query = mb_trim(str_escape(strip_tags($this->getParam('query', $this->getParam('q', '')))));
1616
$index_type = $this->getParam('type', $this->getParam('t', ''));
1717
$limit = (int) $this->getParam('limit', $this->parameter('search_limit', 10));
1818
$result = collect();

src/Application/Actions/Cup/Catalog/Product/ProductExportAction.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ protected function getCellCoordinate($index, $row = 1)
2828
protected function action(): \Slim\Psr7\Response
2929
{
3030
// Fields
31-
$fields = trim($this->parameter('catalog_export_columns', implode(PHP_EOL, \App\Domain\References\Catalog::IMPORT_EXPORT_FIELDS_DEFAULT)));
31+
$fields = mb_trim($this->parameter('catalog_export_columns', implode(PHP_EOL, \App\Domain\References\Catalog::IMPORT_EXPORT_FIELDS_DEFAULT)));
3232

3333
if ($fields) {
3434
$fields = array_map('trim', explode(PHP_EOL, $fields));
@@ -103,9 +103,9 @@ protected function action(): \Slim\Psr7\Response
103103
->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER);
104104

105105
$sheet->mergeCells(
106-
$this->getCellCoordinate(0 + $offset['cols'], $row + 1 + $offset['rows']) .
107-
':' .
108-
$this->getCellCoordinate(count($fields) - 1 + $offset['cols'], $row + 1 + $offset['rows'])
106+
$this->getCellCoordinate(0 + $offset['cols'], $row + 1 + $offset['rows'])
107+
. ':'
108+
. $this->getCellCoordinate(count($fields) - 1 + $offset['cols'], $row + 1 + $offset['rows'])
109109
);
110110

111111
$lastCategory = $model->category_uuid;
@@ -116,7 +116,7 @@ protected function action(): \Slim\Psr7\Response
116116
$attributes = $model->attributes;
117117

118118
foreach ($fields as $index => $field) {
119-
if (trim($field)) {
119+
if (mb_trim($field)) {
120120
$cell = $sheet->getCell($this->getCellCoordinate($index + $offset['cols'], $row + 1 + $offset['rows']));
121121

122122
// set default vertical aligment

src/Application/Actions/Cup/ParametersPageAction.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ protected function action(): \Slim\Psr7\Response
2323
foreach ($this->request->getParsedBody() as $group => $params) {
2424
foreach ($params as $key => $value) {
2525
$data = [
26-
'name' => trim($group . '_' . $key),
26+
'name' => mb_trim($group . '_' . $key),
2727
'value' => is_array($value) ? implode(',', $value) : $value,
2828
];
2929

src/Application/Auth/OpenAuthProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ protected function revokeState(): void
4949

5050
protected function getRedirectUrl($path): string
5151
{
52-
return rtrim($this->parameter('common_homepage', ''), '/') . $path;
52+
return mb_rtrim($this->parameter('common_homepage', ''), '/') . $path;
5353
}
5454

5555
/**

src/Application/Middlewares/MultipartParserMiddleware.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
1-
<?php
1+
<?php declare(strict_types=1);
22

33
namespace App\Application\Middlewares;
44

55
use App\Domain\AbstractMiddleware;
66
use Psr\Http\Message\ServerRequestInterface;
77
use Psr\Http\Server\RequestHandlerInterface;
8-
use Slim\Psr7\UploadedFile;
98

109
class MultipartParserMiddleware extends AbstractMiddleware
1110
{
1211
public function __invoke(ServerRequestInterface $request, RequestHandlerInterface $handler): \Slim\Psr7\Response
1312
{
1413
$method = $request->getMethod();
1514

16-
if (in_array($method, ['PATCH', 'PUT'])) {
15+
if (in_array($method, ['PATCH', 'PUT'], true)) {
1716
$contentType = $request->getHeaderLine('Content-Type');
1817

1918
if (str_contains($contentType, 'multipart/form-data')) {

src/Application/Twig/LocaleNode.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function compile(Compiler $compiler): void
4444
}
4545

4646
if ($this->hasNode('notes')) {
47-
$message = trim($this->getNode('notes')->getAttribute('data'));
47+
$message = mb_trim($this->getNode('notes')->getAttribute('data'));
4848

4949
// line breaks are not allowed cause we want a single line comment
5050
$message = str_replace(["\n", "\r"], ' ', $message);
@@ -134,7 +134,7 @@ protected function compileString(Node $body): array
134134

135135
return [
136136
new Node([
137-
new ConstantExpression(trim(preg_replace('/\s\s+/', ' ', $msg)), $body->getTemplateLine()),
137+
new ConstantExpression(mb_trim(preg_replace('/\s\s+/', ' ', $msg)), $body->getTemplateLine()),
138138
]),
139139
$vars,
140140
];

0 commit comments

Comments
 (0)