diff --git a/src/Session.php b/src/Session.php index fae4211..4bbfe27 100644 --- a/src/Session.php +++ b/src/Session.php @@ -18,6 +18,11 @@ class Session implements SessionInterface { } } + /** @inheritDoc */ + public function __invoke(string $name = "", string $type = ""): mixed { + return $this->get($name, $type); + } + /** @inheritDoc */ public function has(string $name = "") : bool { return (!empty($name)) ? isset($this->getSession()[$name]) : !empty($this->getSession()); @@ -50,8 +55,10 @@ class Session implements SessionInterface { else $_SESSION = []; } - /** @inheritDoc */ + /** + * @return array + */ private function getSession() : array { return $_SESSION; } -} \ No newline at end of file +} diff --git a/src/SessionInterface.php b/src/SessionInterface.php index 4956e45..29308e5 100644 --- a/src/SessionInterface.php +++ b/src/SessionInterface.php @@ -16,6 +16,13 @@ interface SessionInterface { */ public function has(string $name = "") : bool; + /** + * @param string $name + * @param string $type + * @return mixed + */ + public function __invoke(string $name = "", string $type = ""): mixed; + /** * @param string $name * @param string $type @@ -35,4 +42,4 @@ interface SessionInterface { */ public function clear(string $name = null) : void; -} \ No newline at end of file +}