Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
accgit committed Jun 16, 2020
1 parent ca7fd51 commit abf3662
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
13 changes: 7 additions & 6 deletions src/Drago/Http/Session.php → src/Drago/Http/ExtraSession.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,26 @@

namespace Drago\Http;

use Nette\Http;
use Nette\Http\Session;
use Nette\Http\SessionSection;
use Nette\SmartObject;


/**
* Using session outside the presenter.
*/
class Session
class ExtraSession
{
use SmartObject;

/** @var string */
private $section;

/** @var Http\Session */
/** @var Session */
private $session;


public function __construct(Http\Session $session, string $section)
public function __construct(Session $session, string $section)
{
$this->session = $session;
$this->section = $section;
Expand All @@ -37,7 +38,7 @@ public function __construct(Http\Session $session, string $section)
/**
* Provides access to session sections as well as session settings and management methods.
*/
public function getSession(): Http\Session
public function getSession(): Session
{
return $this->session;
}
Expand All @@ -46,7 +47,7 @@ public function getSession(): Http\Session
/**
* Returns specified session section.
*/
public function getSessionSection(): Http\SessionSection
public function getSessionSection(): SessionSection
{
return $this->session->getSection($this->section);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Http/Session.phpt → tests/Http/ExtraSession.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types = 1);

use Drago\Http\Session;
use Drago\Http\ExtraSession;
use Nette\Http;
use Tester\Assert;

Expand All @@ -11,7 +11,7 @@ require __DIR__ . '/../bootstrap.php';
$section = 'section';
$request = new Http\RequestFactory;
$session = new Http\Session($request->fromGlobals(), new Http\Response);
$class = new Session($session, $section);
$class = new ExtraSession($session, $section);

Assert::type($class->getSession(), $session);
Assert::type($class->getSessionSection(), $session->getSection($section));

0 comments on commit abf3662

Please sign in to comment.