Skip to content

Commit

Permalink
fixing cs
Browse files Browse the repository at this point in the history
  • Loading branch information
2amjsouza committed Dec 8, 2023
1 parent 572e092 commit 5a1bbee
Show file tree
Hide file tree
Showing 14 changed files with 45 additions and 34 deletions.
3 changes: 2 additions & 1 deletion config/2am-qrcode.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

<?php
return [

Expand Down Expand Up @@ -104,4 +105,4 @@
'size' => 16,
'align' => \Da\QrCode\Enums\Label::ALIGN_CENTER,
]
];
];
5 changes: 3 additions & 2 deletions routes/laravel.route.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@

<?php
use Illuminate\Support\Facades\Route;
use Da\QrCode\Controllers\LaravelResourceController;

Route::prefix('da-qrcode')->name('da-qrcode.')->group(function() {
Route::prefix('da-qrcode')->name('da-qrcode.')->group(function () {
Route::get('/build', LaravelResourceController::class)->name('build');
});
});
16 changes: 13 additions & 3 deletions src/Component/QrCodeBladeComponent.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@

<?php

declare(strict_types=1);

namespace Da\QrCode\Component;
Expand Down Expand Up @@ -83,15 +85,23 @@ class QrCodeBladeComponent extends Component
public $alignment = null;

/**
* @param string|array $content
* @param $content
* @param string|null $format
* @param array|null $foreground
* @param array|null $background
* @param string|null $pathStyle
* @param float|null $intensity
* @param array|null $foreground2
* @param int|null $margin
* @param int|null $size
* @param string|null $logoPath
* @param string|null $logoSize
* @param bool|null $scaleLogoHeight
* @param string|null $gradientType
* @param string|null $label
* @param string|null $font
* @param int|null $fontSize
* @param string|null $fontAlign
*/
public function __construct(
$content,
Expand All @@ -111,7 +121,7 @@ public function __construct(
?string $font = null,
?int $fontSize = null,
?string $fontAlign = null
){
) {
$this->content = $content;
$this->format = $format;
$this->foreground = $foreground;
Expand Down Expand Up @@ -164,4 +174,4 @@ public function render()
{
return view('2am-qrcode::components.qrcode');
}
}
}
2 changes: 1 addition & 1 deletion src/Contracts/ColorsInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,4 @@ public function buildFillColor();
* @return void
*/
public function forceUniformRgbColors(): void;
}
}
2 changes: 1 addition & 1 deletion src/Contracts/PathStyleInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ public function buildModule();
* @return EyeInterface
*/
public function buildEye();
}
}
2 changes: 1 addition & 1 deletion src/Controllers/LaravelResourceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ public function __invoke(Request $request)
'Content-Type' => $qrCode->getContentType(),
]);
}
}
}
2 changes: 1 addition & 1 deletion src/Enums/Format.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ final class Format extends Enum
const VCard = VCardFormat::class;
const Wifi = WifiFormat::class;
const Youtube = YoutubeFormat::class;
}
}
2 changes: 1 addition & 1 deletion src/Enums/Gradient.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ class Gradient extends Enum
public const GRADIENT_RADIAL = 'radial';
public const GRADIENT_DIAGONAL = 'diagonal';
public const GRADIENT_INVERSE_DIAGONAL = 'diagonal_inverse';
}
}
2 changes: 1 addition & 1 deletion src/Enums/Label.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ final class Label extends Enum
const ALIGN_LEFT = 'left';
const ALIGN_RIGHT = 'right';
const ALIGN_CENTER = 'center';
}
}
2 changes: 1 addition & 1 deletion src/Enums/Path.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ class Path extends Enum
const DOTS = 'dots';
const SQUARE = 'square';
const ROUNDED = 'rounded';
}
}
5 changes: 2 additions & 3 deletions src/Factory/LaravelQrCodeFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ public static function make(
?string $fontPath = null,
?int $fontSize = null,
?string $alignment = null
): QrCodeInterface
{
): QrCodeInterface {
$qrCode = self::buildQrCode($content, $format);

self::applyForeground($qrCode, $foreground);
Expand Down Expand Up @@ -245,4 +244,4 @@ protected static function validate($content, ?string $format): void
throw new Exception('Invalid format. It should be instance of Enum or null, ' . gettype($format) . ' given');
}
}
}
}
16 changes: 6 additions & 10 deletions src/Providers/QrCodeServiceProvider.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace Da\QrCode\Providers;
Expand All @@ -13,23 +14,18 @@ public function boot(): void
{
/** Load package views */
$this->loadViewsFrom(__DIR__ . '/../../resources/views', '2am-qrcode');

/** Load package routes */
/** Load package routes */
$this->loadRoutesFrom(__DIR__ . '/../../routes/laravel.route.php');

/** publishes package config */
/** publishes package config */
$this->publishes([
__DIR__ . '/../../config/2am-qrcode.php' => config_path('2am-qrcode.php'),
], '2am-qrcode-config');

$this->publishes([
__DIR__ . '/../../resources/views' => resource_path('views/vendor/2am-qrcode'),
], '2am-qrcode-views');

/** merges config file with user's published version */
/** merges config file with user's published version */
$this->mergeConfigFrom(__DIR__ . '/../../config/2am-qrcode.php', '2am-qrcode');

/** Declares package's components */
/** Declares package's components */
Blade::component('qrcode', QrCodeBladeComponent::class, config('2am-qrcode.prefix'));
}
}
}
17 changes: 10 additions & 7 deletions src/StyleManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,8 @@ public function getGradientTye()
case GradientEnum::GRADIENT_RADIAL: {
return GradientType::RADIAL();
}
default: return GradientType::VERTICAL();
default:
return GradientType::VERTICAL();
}
}

Expand Down Expand Up @@ -244,8 +245,7 @@ public function buildFillColor()
$this->getGradientTye(),
)
);
}
else {
} else {
return Fill::uniformColor(
$this->getBackgroundColor(),
$this->getForegroundColor()
Expand All @@ -259,9 +259,12 @@ public function buildFillColor()
public function buildModule()
{
switch ($this->getPathStyle()) {
case PathStyleInterface::DOTS: return new DotsModule($this->getIntensity());
case PathStyleInterface::ROUNDED: return new RoundnessModule($this->getIntensity());
default: return SquareModule::instance();
case PathStyleInterface::DOTS:
return new DotsModule($this->getIntensity());
case PathStyleInterface::ROUNDED:
return new RoundnessModule($this->getIntensity());
default:
return SquareModule::instance();
}
}

Expand All @@ -272,4 +275,4 @@ public function buildEye()
{
return new ModuleEye($this->buildModule());
}
}
}
3 changes: 2 additions & 1 deletion src/Writer/EpsWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ public function __construct()
*/
public function writeString(QrCodeInterface $qrCode): string
{
$renderer = $this->buildRenderer($qrCode);;
$renderer = $this->buildRenderer($qrCode);
;

$writer = new Writer($renderer);

Expand Down

0 comments on commit 5a1bbee

Please sign in to comment.