Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
0.00% covered (danger)
0.00%
0 / 1
50.00% covered (danger)
50.00%
4 / 8
CRAP
60.00% covered (warning)
60.00%
6 / 10
ArraySession
0.00% covered (danger)
0.00%
0 / 1
50.00% covered (danger)
50.00%
4 / 8
12.10
60.00% covered (warning)
60.00%
6 / 10
 __construct
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 get
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 set
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 has
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 destroy
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 start
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 all
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 clear
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
<?php
declare(strict_types=1);
namespace Eywa\Session {
    use Eywa\Collection\Collect;
    class ArraySession implements SessionInterface
    {
        /**
         *
         * The session
         *
         */
        private Collect $session;
        public function __construct()
        {
            $this->session = collect();
        }
        /**
         * @inheritDoc
         */
        public function get(string $key)
        {
            return $this->session->get($key);
        }
        /**
         * @inheritDoc
         */
        public function set(string $key, $value): SessionInterface
        {
            $this->session->put($key, $value);
            return $this;
        }
        /**
         * @inheritDoc
         */
        public function has(string $key): bool
        {
            return  $this->session->has($key);
        }
        /**
         * @inheritDoc
         */
        public function destroy(array $keys): bool
        {
            return $this->session->del($keys)->ok();
        }
        /**
         * @inheritDoc
         */
        public function start(): SessionInterface
        {
            return  $this;
        }
        /**
         * @inheritDoc
         */
        public function all(): array
        {
            return $this->session->all();
        }
        /**
         * @inheritDoc
         */
        public function clear(): bool
        {
            return  $this->session->del($this->all())->ok();
        }
    }
}