Skip to content

Commit b5318b8

Browse files
committed
style: Run PHP fixer
Signed-off-by: Sebastian Fey <[email protected]>
1 parent 604212a commit b5318b8

16 files changed

+24
-24
lines changed

lib/Helper/AcceptHeaderParsingHelper.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ private function sortAndWeightParts(array $parts): array {
5858

5959
usort($weightedParts, function ($a, $b) {
6060
$tmp = $a['weight'] - $b['weight'];
61-
if ($tmp < - 0.001) {
61+
if ($tmp < -0.001) {
6262
return -1;
6363
} elseif ($tmp > 0.001) {
6464
return 1;

lib/Helper/DownloadHelper.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public function getContent(): string {
116116
* @throws NoDownloadWasCarriedOutException if there was no successful download carried out before calling this method.
117117
*/
118118
public function getContentType(): ?string {
119-
if (! $this->downloaded) {
119+
if (!$this->downloaded) {
120120
throw new NoDownloadWasCarriedOutException();
121121
}
122122

@@ -140,7 +140,7 @@ public function getContentType(): ?string {
140140
* @throws NoDownloadWasCarriedOutException if there was no successful download carried out before calling this method.
141141
*/
142142
public function getStatus(): int {
143-
if (! $this->downloaded) {
143+
if (!$this->downloaded) {
144144
throw new NoDownloadWasCarriedOutException();
145145
}
146146

lib/Helper/Filter/JSON/CleanCategoryFilter.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public function __construct(TextCleanupHelper $cleanupHelper) {
2020
}
2121

2222
public function apply(array &$json): bool {
23-
if (! isset($json['recipeCategory'])) {
23+
if (!isset($json['recipeCategory'])) {
2424
$json['recipeCategory'] = '';
2525
return true;
2626
}

lib/Helper/Filter/JSON/FixInstructionsFilter.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function __construct(
5353
}
5454

5555
public function apply(array &$json): bool {
56-
if (! isset($json[self::INSTRUCTIONS])) {
56+
if (!isset($json[self::INSTRUCTIONS])) {
5757
$json[self::INSTRUCTIONS] = [];
5858
return true;
5959
}

lib/Helper/Filter/JSON/FixKeywordsFilter.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function apply(array &$json): bool {
4040
return true;
4141
}
4242

43-
if (!is_string($json[self::KEYWORDS]) && ! is_array($json[self::KEYWORDS])) {
43+
if (!is_string($json[self::KEYWORDS]) && !is_array($json[self::KEYWORDS])) {
4444
$this->logger->info($this->l->t('Could not parse the keywords for recipe {recipe}.', ['recipe' => $json['name']]));
4545
$json[self::KEYWORDS] = '';
4646
return true;

lib/Helper/Filter/JSON/RecipeIdCopyFilter.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
class RecipeIdCopyFilter extends AbstractJSONFilter {
99
public function apply(array &$json): bool {
1010
$copy = $json;
11-
if (! isset($json['id'])) {
11+
if (!isset($json['id'])) {
1212
$json['id'] = $json['recipe_id'];
1313
}
1414
return $json !== $copy;

lib/Helper/HTMLParser/HttpJsonLdParser.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ private function parseJsonLdElement(\DOMNode $node): array {
6060
throw new HtmlParsingException($this->l->t('JSON cannot be decoded.'));
6161
}
6262

63-
if ($json === false || $json === true || ! is_array($json)) {
63+
if ($json === false || $json === true || !is_array($json)) {
6464
throw new HtmlParsingException($this->l->t('No recipe was found.'));
6565
}
6666

lib/Helper/HtmlToDomParser.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ private function groupErrors(array $errors): array {
151151
*/
152152
foreach ($errors as $error) {
153153
if (isset($ret[$error->code])) {
154-
$ret[$error->code]['count'] ++;
154+
$ret[$error->code]['count']++;
155155
} else {
156156
$ret[$error->code] = [
157157
'count' => 1,

lib/Helper/UserFolderHelper.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ private function getOrCreateFolder(string $path): Folder {
129129
);
130130
}
131131

132-
if (! $node->isCreatable()) {
132+
if (!$node->isCreatable()) {
133133
throw new UserFolderNotWritableException(
134134
$this->l->t('User cannot create recipe folder')
135135
);

lib/Migration/Version000000Date20210427082010.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
2626
$schema = $schemaClosure();
2727

2828
$categoriesTable = $schema->getTable('cookbook_categories');
29-
if (! $categoriesTable->hasIndex('categories_recipe_idx')) {
29+
if (!$categoriesTable->hasIndex('categories_recipe_idx')) {
3030
$categoriesTable->addIndex([
3131
'user_id',
3232
'recipe_id',
3333
], 'categories_recipe_idx');
3434
}
3535

3636
$keywordsTable = $schema->getTable('cookbook_keywords');
37-
if (! $keywordsTable->hasIndex('keywords_recipe_idx')) {
37+
if (!$keywordsTable->hasIndex('keywords_recipe_idx')) {
3838
$keywordsTable->addIndex([
3939
'user_id',
4040
'recipe_id',

lib/Migration/Version000000Date20210701093123.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
9797
if ($namesTable->hasPrimaryKey()) {
9898
$namesTable->dropPrimaryKey();
9999
}
100-
if (! $namesTable->hasIndex('names_recipe_idx')) {
100+
if (!$namesTable->hasIndex('names_recipe_idx')) {
101101
$namesTable->addUniqueIndex([
102102
'recipe_id',
103103
'user_id'

lib/Migration/Version000000Date20220703174647.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
3333

3434
$table = $schema->getTable('cookbook_names');
3535

36-
if (! $table->hasColumn('date_created')) {
36+
if (!$table->hasColumn('date_created')) {
3737
$table->addColumn('date_created', 'datetime_immutable', [
3838
'notnull' => false,
3939
]);

lib/Service/JsonService.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ class JsonService {
2121
* @return bool true, if $obj is an object and optionally satisfies the type check
2222
*/
2323
public function isSchemaObject($obj, string $type = null, bool $checkContext = true, bool $uniqueType = true): bool {
24-
if (! is_array($obj)) {
24+
if (!is_array($obj)) {
2525
// Objects must bve encoded as arrays in JSON
2626
return false;
2727
}
2828

2929
if ($checkContext) {
30-
if (!isset($obj['@context']) || ! preg_match('@^https?://schema\.org/?$@', $obj['@context'])) {
30+
if (!isset($obj['@context']) || !preg_match('@^https?://schema\.org/?$@', $obj['@context'])) {
3131
// We have no correct context property
3232
return false;
3333
}

lib/Service/RecipeService.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ public function addRecipe($json, $importedHtml = null) {
256256

257257
$recipe_file->putContent(json_encode($json));
258258

259-
if (! is_null($importedHtml)) {
259+
if (!is_null($importedHtml)) {
260260
// We imported a recipe. Save the import html file as a backup
261261
$importFile = $recipe_folder->newFile('import.html');
262262
$importFile->putContent($importedHtml);
@@ -423,7 +423,7 @@ public function getAllCategoriesInSearchIndex() {
423423
*/
424424
private function addDatesToRecipes(array &$recipes) {
425425
foreach ($recipes as $i => $recipe) {
426-
if (! array_key_exists('dateCreated', $recipe) || ! array_key_exists('dateModified', $recipe)) {
426+
if (!array_key_exists('dateCreated', $recipe) || !array_key_exists('dateModified', $recipe)) {
427427
$r = $this->getRecipeById($recipe['recipe_id']);
428428
$recipes[$i]['dateCreated'] = $r['dateCreated'];
429429
$recipes[$i]['dateModified'] = $r['dateModified'];

tests/Migration/Setup/Migrations/AbstractMigrationTestCase.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function setUp(): void {
7878

7979
// Reinstall app partially (just before the migration)
8080
$migrationBefore = $this->getPreviousMigrationName();
81-
if (! empty($migrationBefore)) {
81+
if (!empty($migrationBefore)) {
8282
// We need to run a migration beforehand
8383
$this->migrationService->migrate($migrationBefore);
8484
$this->renewSchema();
@@ -101,7 +101,7 @@ private function enableApp() {
101101
}
102102

103103
private function hideMigrations() {
104-
if (! file_exists(self::TMP_MIGRATIONS)) {
104+
if (!file_exists(self::TMP_MIGRATIONS)) {
105105
mkdir(self::TMP_MIGRATIONS);
106106
}
107107

tests/Unit/Helper/ImageService/ThumbnailFileHelperTest.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,11 @@ public function testRecreateThumbnails($thumbExists, $miniExists) {
208208
$f->method('get')->willReturnMap($fileMap);
209209

210210
$cnt = 0;
211-
if (! $thumbExists) {
212-
$cnt ++;
211+
if (!$thumbExists) {
212+
$cnt++;
213213
}
214-
if (! $miniExists) {
215-
$cnt ++;
214+
if (!$miniExists) {
215+
$cnt++;
216216
}
217217
$newFileMap = [
218218
['thumb.jpg', null, $thumb],

0 commit comments

Comments
 (0)