Skip to content

Commit a642a68

Browse files
committed
Merge branch 'master' of github.com:beyondcode/laravel-favicon
2 parents bea2ac8 + b7d7cd5 commit a642a68

File tree

10 files changed

+21
-19
lines changed

10 files changed

+21
-19
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ Create dynamic favicons based on your environment settings.
99

1010
![](https://beyondco.de/github/favicons/screenshot.png)
1111

12+
## Laravel Package Development
13+
14+
[![https://phppackagedevelopment.com](https://beyondco.de/courses/phppd.jpg)](https://phppackagedevelopment.com)
15+
16+
If you want to learn how to create reusable PHP packages yourself, take a look at my upcoming [PHP Package Development](https://phppackagedevelopment.com) video course.
17+
1218
## Installation
1319

1420
You can install the package via composer:

config/favicon.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,4 @@
5656
*/
5757
'generator' => \BeyondCode\LaravelFavicon\Generators\EnvironmentGenerator::class,
5858

59-
60-
];
59+
];

src/Favicon.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@ public function __construct(array $config)
1414

1515
public function getFaviconText(string $environment)
1616
{
17-
return array_get($this->config,'enabled_environments.'.$environment.'.text');
17+
return array_get($this->config, 'enabled_environments.'.$environment.'.text');
1818
}
1919

2020
public function getFaviconColor(string $environment)
2121
{
22-
return array_get($this->config,'enabled_environments.'.$environment.'.color');
22+
return array_get($this->config, 'enabled_environments.'.$environment.'.color');
2323
}
2424

2525
public function getFaviconBackgroundColor(string $environment)
2626
{
27-
return array_get($this->config,'enabled_environments.'.$environment.'.background_color');
27+
return array_get($this->config, 'enabled_environments.'.$environment.'.background_color');
2828
}
29-
}
29+
}

src/FaviconServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function boot()
1919
__DIR__.'/../config/favicon.php' => config_path('favicon.php'),
2020
], 'config');
2121
}
22-
22+
2323
$this->registerRoutes();
2424
}
2525

src/Generators/EnvironmentGenerator.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
use Illuminate\Http\Response;
66
use Intervention\Image\Image;
7-
use Intervention\Image\ImageManager;
87
use Intervention\Image\AbstractFont;
8+
use Intervention\Image\ImageManager;
99
use BeyondCode\LaravelFavicon\Favicon;
1010
use Intervention\Image\Gd\Font as GdFont;
1111
use Intervention\Image\Imagick\Font as ImagickFont;
@@ -26,7 +26,7 @@ public function __construct(Favicon $favicon)
2626
$this->favicon = $favicon;
2727

2828
$this->manager = new ImageManager([
29-
'driver' => config('favicon.image_driver')
29+
'driver' => config('favicon.image_driver'),
3030
]);
3131

3232
$this->environment = config('app.env');
@@ -41,7 +41,7 @@ public function generate(string $icon): Response
4141

4242
$font = $this->getFont($this->favicon->getFaviconText($this->environment));
4343

44-
$font->file(config('favicon.font') ?? __DIR__ . '/../../resources/fonts/OpenSans-Regular.ttf');
44+
$font->file(config('favicon.font') ?? __DIR__.'/../../resources/fonts/OpenSans-Regular.ttf');
4545

4646
$font->valign('top');
4747

@@ -73,10 +73,10 @@ protected function calculateDynamicFontSize(AbstractFont $font, Image $icon, $pa
7373
{
7474
$size = $font->getBoxSize();
7575

76-
while ($size["width"] + $paddingX > $icon->width() && $font->getSize() > 0) {
76+
while ($size['width'] + $paddingX > $icon->width() && $font->getSize() > 0) {
7777
$fontSize = $font->getSize();
7878

79-
$font->size($fontSize-1);
79+
$font->size($fontSize - 1);
8080

8181
$size = $font->getBoxSize();
8282
}
@@ -97,4 +97,4 @@ public function shouldGenerateFavicon(): bool
9797
{
9898
return config('favicon.enabled_environments.'.$this->environment) !== null;
9999
}
100-
}
100+
}

src/Generators/FaviconGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ interface FaviconGenerator
99
public function generate(string $icon): Response;
1010

1111
public function shouldGenerateFavicon(): bool;
12-
}
12+
}

src/Http/Controllers/FaviconController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ public function __invoke(Request $request, FaviconGenerator $generator)
1111
{
1212
return $generator->generate($request->route('icon'));
1313
}
14-
}
14+
}

src/helpers.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
function favicon($image)
77
{
88
if (app(FaviconGenerator::class)->shouldGenerateFavicon(app()->environment())) {
9-
return "/".config('favicon.url_prefix')."/$image";
9+
return '/'.config('favicon.url_prefix')."/$image";
1010
}
1111

1212
return $image;

tests/EnvironmentGeneratorTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22

33
namespace BeyondCode\LaravelFavicon\Tests;
44

5-
65
use BeyondCode\LaravelFavicon\Favicon;
76
use BeyondCode\LaravelFavicon\FaviconServiceProvider;
87

98
class EnvironmentGeneratorTest extends \Orchestra\Testbench\TestCase
109
{
11-
1210
protected function getPackageProviders($app)
1311
{
1412
return [FaviconServiceProvider::class];

tests/FaviconTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace BeyondCode\LaravelFavicon\Tests;
44

5-
65
use BeyondCode\LaravelFavicon\Favicon;
76
use BeyondCode\LaravelFavicon\FaviconServiceProvider;
87

0 commit comments

Comments
 (0)