Skip to content

Commit 74653f6

Browse files
committed
Added declare(strict_types=1)
1 parent 7267f63 commit 74653f6

File tree

11 files changed

+71
-0
lines changed

11 files changed

+71
-0
lines changed

kos/FastFileResponse_dont-use.php

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Inteve\Application;
6+
7+
use Nette;
8+
use Nette\Application\IResponse;
9+
10+
11+
class FastFileResponse implements IResponse
12+
{
13+
/** @var string|NULL */
14+
private $expiration;
15+
16+
17+
/**
18+
* @param string $file file path
19+
* @param string|NULL $name
20+
* @param string|NULL $contentType
21+
* @param string|NULL $expiration
22+
* @param bool $forceDownload
23+
*/
24+
public function __construct(
25+
$file,
26+
$name,
27+
$contentType,
28+
$expiration,
29+
$forceDownload = TRUE
30+
)
31+
{
32+
$this->file = $file;
33+
$this->name = $name;
34+
$this->contentType = $contentType ?: 'application/octet-stream';
35+
$this->expiration = $expiration;
36+
$this->forceDownload = $forceDownload;
37+
}
38+
39+
40+
public function send(Nette\Http\IRequest $httpRequest, Nette\Http\IResponse $httpResponse)
41+
{
42+
$httpResponse->setExpiration($this->expiration);
43+
$httpResponse->setContentType($this->contentType);
44+
$httpResponse->setHeader('Content-Disposition',
45+
($this->forceDownload ? 'attachment' : 'inline')
46+
. '; filename="' . $this->name . '"'
47+
. '; filename*=utf-8\'\'' . rawurlencode($this->name));
48+
// $httpResponse->setHeader('X-SendFile', $this->file);
49+
readfile($this->file);
50+
}
51+
}

src/DI/PresenterMapping.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Inteve\Application\DI;
46

57
use Nette\Application\IPresenterFactory;

src/TFlashMessages.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Inteve\Application;
46

57

src/TSecured.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Inteve\Application;
46

57
use Nette\Application\ForbiddenRequestException;

src/exceptions.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Inteve\Application;
46

57

tests/Application/DI/PresenterMapping.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
use Tester\Assert;
46

57
require __DIR__ . '/../../bootstrap.php';

tests/Application/TFlashMessages.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
use Tester\Assert;
46

57
require __DIR__ . '/../bootstrap.php';

tests/Application/TSecured.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
use Tester\Assert;
46

57
require __DIR__ . '/../bootstrap.php';

tests/bootstrap.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
require __DIR__ . '/../vendor/autoload.php';
46
require __DIR__ . '/libs/ApplicationTester.php';
57
require __DIR__ . '/libs/PresenterTester.php';

tests/libs/ApplicationTester.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Inteve\Application\Tests\Libs;
46

57
use Nette;

0 commit comments

Comments
 (0)