Skip to content

Commit 4ef0408

Browse files
committed
- Just small code cleaning
1 parent d523f33 commit 4ef0408

22 files changed

+95
-105
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
{
1111
"name" : "iPublikuj:cms",
1212
"email" : "[email protected]",
13-
"homepage" : "http://www.ipublikuj.eu/"
13+
"homepage" : "https://www.ipublikuj.eu/"
1414
}
1515
],
1616

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,4 @@ class BasePresenter extends Nette\Application\UI\Presenter
5050
Learn how to get info about visitor device in [documentation](https://github.com/iPublikuj/mobile-detect/blob/master/docs/en/index.md).
5151

5252
***
53-
Homepage [http://www.ipublikuj.eu](http://www.ipublikuj.eu) and repository [http://github.com/iPublikuj/mobile-detect](http://github.com/iPublikuj/mobile-detect).
53+
Homepage [https://www.ipublikuj.eu](https://www.ipublikuj.eu) and repository [http://github.com/iPublikuj/mobile-detect](http://github.com/iPublikuj/mobile-detect).

src/IPub/MobileDetect/DI/MobileDetectExtension.php

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
* MobileDetectExtension.php
44
*
55
* @copyright More in license.md
6-
* @license http://www.ipublikuj.eu
7-
* @author Adam Kadlec http://www.ipublikuj.eu
6+
* @license https://www.ipublikuj.eu
7+
* @author Adam Kadlec https://www.ipublikuj.eu
88
* @package iPublikuj:MobileDetect!
99
* @subpackage DI
1010
* @since 1.0.0
@@ -21,8 +21,10 @@
2121
use Nette\DI;
2222
use Nette\PhpGenerator as Code;
2323

24-
use IPub;
24+
use Tracy;
25+
2526
use IPub\MobileDetect;
27+
use IPub\MobileDetect\Diagnostics;
2628
use IPub\MobileDetect\Events;
2729
use IPub\MobileDetect\Helpers;
2830
use IPub\MobileDetect\Templating;
@@ -41,7 +43,7 @@ final class MobileDetectExtension extends DI\CompilerExtension
4143
* @var array
4244
*/
4345
private $defaults = [
44-
'redirect' => [
46+
'redirect' => [
4547
'mobile' => [
4648
'isEnabled' => FALSE,
4749
'host' => NULL,
@@ -63,19 +65,19 @@ final class MobileDetectExtension extends DI\CompilerExtension
6365
'detectPhoneAsMobile' => FALSE,
6466
'detectTabletAsMobile' => FALSE,
6567
],
66-
'switchDeviceView' => [
68+
'switchDeviceView' => [
6769
'saveRefererPath' => TRUE
6870
],
6971
'switchParameterName' => 'device_view',
70-
'deviceViewCookie' => [
72+
'deviceViewCookie' => [
7173
'name' => 'device_view',
7274
'domain' => NULL,
7375
'expireAfter' => '+1 month',
7476
'path' => '/',
7577
'secure' => FALSE,
7678
'httpOnly' => TRUE,
7779
],
78-
'debugger' => '%debugMode%'
80+
'debugger' => '%debugMode%'
7981
];
8082

8183
/**
@@ -90,14 +92,14 @@ public function loadConfiguration() : void
9092

9193
// Install mobile detect service
9294
$mobileDetect = $builder->addDefinition($this->prefix('mobileDetect'))
93-
->setClass(MobileDetect\MobileDetect::class);
95+
->setType(MobileDetect\MobileDetect::class);
9496

9597
$builder->addDefinition($this->prefix('deviceView'))
96-
->setClass(Helpers\DeviceView::class)
98+
->setType(Helpers\DeviceView::class)
9799
->setArguments(['setSwitchParameterName' => $configuration['switchParameterName']]);
98100

99101
$builder->addDefinition($this->prefix('cookieSettings'))
100-
->setClass(Helpers\CookieSettings::class)
102+
->setType(Helpers\CookieSettings::class)
101103
->setArguments([
102104
'name' => $configuration['deviceViewCookie']['name'],
103105
'domain' => $configuration['deviceViewCookie']['domain'],
@@ -107,24 +109,24 @@ public function loadConfiguration() : void
107109
'httpOnly' => $configuration['deviceViewCookie']['httpOnly'],
108110
]);
109111

110-
if ($configuration['debugger'] && interface_exists('Tracy\IBarPanel')) {
112+
if ($configuration['debugger'] && interface_exists(Tracy\IBarPanel::class)) {
111113
$builder->addDefinition($this->prefix('panel'))
112-
->setClass('IPub\MobileDetect\Diagnostics\Panel');
114+
->setType(Diagnostics\Panel::class);
113115

114116
$mobileDetect->addSetup('?->register(?)', [$this->prefix('@panel'), '@self']);
115117
}
116118

117119
$builder->addDefinition($this->prefix('onRequestHandler'))
118-
->setClass(Events\OnRequestHandler::class)
120+
->setType(Events\OnRequestHandler::class)
119121
->addSetup('$redirectConf', [$configuration['redirect']])
120122
->addSetup('$isFullPath', [$configuration['switchDeviceView']['saveRefererPath']]);
121123

122124
$builder->addDefinition($this->prefix('onResponseHandler'))
123-
->setClass(Events\OnResponseHandler::class);
125+
->setType(Events\OnResponseHandler::class);
124126

125127
// Register template helpers
126128
$builder->addDefinition($this->prefix('helpers'))
127-
->setClass(Templating\Helpers::class)
129+
->setType(Templating\Helpers::class)
128130
->setAutowired(FALSE);
129131

130132
$application = $builder->getDefinition('application');
@@ -166,7 +168,7 @@ public function beforeCompile() : void
166168
*
167169
* @return void
168170
*/
169-
public static function register(Nette\Configurator $config, string $extensionName = 'mobileDetect')
171+
public static function register(Nette\Configurator $config, string $extensionName = 'mobileDetect') : void
170172
{
171173
$config->onCompile[] = function (Nette\Configurator $config, Nette\DI\Compiler $compiler) use ($extensionName) : void {
172174
$compiler->addExtension($extensionName, new MobileDetectExtension());

src/IPub/MobileDetect/Diagnostics/Panel.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
* Panel.php
44
*
55
* @copyright More in license.md
6-
* @license http://www.ipublikuj.eu
7-
* @author Adam Kadlec http://www.ipublikuj.eu
6+
* @license https://www.ipublikuj.eu
7+
* @author Adam Kadlec https://www.ipublikuj.eu
88
* @package iPublikuj:MobileDetect!
99
* @subpackage Diagnostics
1010
* @since 1.0.0

src/IPub/MobileDetect/Events/OnRequestHandler.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
* OnRequestHandler.php
44
*
55
* @copyright More in license.md
6-
* @license http://www.ipublikuj.eu
7-
* @author Adam Kadlec http://www.ipublikuj.eu
6+
* @license https://www.ipublikuj.eu
7+
* @author Adam Kadlec https://www.ipublikuj.eu
88
* @package iPublikuj:MobileDetect!
99
* @subpackage Events
1010
* @since 1.0.0
@@ -33,13 +33,13 @@
3333
*/
3434
final class OnRequestHandler
3535
{
36-
const REDIRECT = 'redirect';
37-
const NO_REDIRECT = 'noRedirect';
38-
const REDIRECT_WITHOUT_PATH = 'redirectWithoutPath';
36+
private const REDIRECT = 'redirect';
37+
private const NO_REDIRECT = 'noRedirect';
38+
private const REDIRECT_WITHOUT_PATH = 'redirectWithoutPath';
3939

40-
const MOBILE = 'mobile';
41-
const TABLET = 'tablet';
42-
const PHONE = 'phone';
40+
private const MOBILE = 'mobile';
41+
private const TABLET = 'tablet';
42+
private const PHONE = 'phone';
4343

4444
/**
4545
* @var array

src/IPub/MobileDetect/Events/OnResponseHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
* OnResponseHandler.php
44
*
55
* @copyright More in license.md
6-
* @license http://www.ipublikuj.eu
7-
* @author Adam Kadlec http://www.ipublikuj.eu
6+
* @license https://www.ipublikuj.eu
7+
* @author Adam Kadlec https://www.ipublikuj.eu
88
* @package iPublikuj:MobileDetect!
99
* @subpackage Events
1010
* @since 1.0.0

src/IPub/MobileDetect/Exceptions/CompileException.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
* CompileException.php
44
*
55
* @copyright More in license.md
6-
* @license http://www.ipublikuj.eu
7-
* @author Adam Kadlec http://www.ipublikuj.eu
6+
* @license https://www.ipublikuj.eu
7+
* @author Adam Kadlec https://www.ipublikuj.eu
88
* @package iPublikuj:MobileDetect!
99
* @subpackage Exceptions
1010
* @since 2.0.0

src/IPub/MobileDetect/Exceptions/IException.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
* IException.php
44
*
55
* @copyright More in license.md
6-
* @license http://www.ipublikuj.eu
7-
* @author Adam Kadlec http://www.ipublikuj.eu
6+
* @license https://www.ipublikuj.eu
7+
* @author Adam Kadlec https://www.ipublikuj.eu
88
* @package iPublikuj:MobileDetect!
99
* @subpackage Exceptions
1010
* @since 2.0.0

src/IPub/MobileDetect/Exceptions/InvalidArgumentException.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
* InvalidArgumentException.php
44
*
55
* @copyright More in license.md
6-
* @license http://www.ipublikuj.eu
7-
* @author Adam Kadlec http://www.ipublikuj.eu
6+
* @license https://www.ipublikuj.eu
7+
* @author Adam Kadlec https://www.ipublikuj.eu
88
* @package iPublikuj:MobileDetect!
99
* @subpackage Exceptions
1010
* @since 2.0.0
@@ -16,8 +16,6 @@
1616

1717
namespace IPub\MobileDetect\Exceptions;
1818

19-
use Nette;
20-
21-
class MobileDetect extends Nette\InvalidArgumentException implements IException
19+
class InvalidArgumentException extends \InvalidArgumentException implements IException
2220
{
2321
}

src/IPub/MobileDetect/Helpers/CookieSettings.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
* CookieSettings.php
44
*
55
* @copyright More in license.md
6-
* @license http://www.ipublikuj.eu
7-
* @author Adam Kadlec http://www.ipublikuj.eu
6+
* @license https://www.ipublikuj.eu
7+
* @author Adam Kadlec https://www.ipublikuj.eu
88
* @package iPublikuj:MobileDetect!
99
* @subpackage Helpers
1010
* @since 1.0.0
@@ -18,7 +18,6 @@
1818

1919
use Nette;
2020

21-
use IPub;
2221
use IPub\MobileDetect\Exceptions;
2322

2423
/**
@@ -76,7 +75,7 @@ final class CookieSettings
7675
*
7776
* @throws Exceptions\InvalidArgumentException
7877
*/
79-
public function __construct(string $name, string $domain = NULL, string $expireAfter = NULL, string $path = '/', bool $secure = FALSE, bool $httpOnly = TRUE)
78+
public function __construct(string $name, ?string $domain = NULL, ?string $expireAfter = NULL, string $path = '/', bool $secure = FALSE, bool $httpOnly = TRUE)
8079
{
8180
// from PHP source code
8281
if (preg_match("/[=,; \t\r\n\013\014]/", $name)) {
@@ -116,7 +115,7 @@ public function getName() : string
116115
*
117116
* @return string|NULL
118117
*/
119-
public function getDomain()
118+
public function getDomain() : ?string
120119
{
121120
return $this->domain;
122121
}

0 commit comments

Comments
 (0)