Overview

Namespaces

  • Chippyash
    • Authentication
      • Manager
        • Digest
        • Encoder
        • Exceptions
        • Traits

Traits

  • RealmHandler
  • Overview
  • Namespace
  • Class
  • Tree
  • Todo
 1: <?php
 2: /**
 3:  * Chippyash Digest Authentication Manager
 4:  * 
 5:  * @copyright Ashley Kitson, UK, 2014
 6:  * @license GPL 3.0+
 7:  */
 8: namespace Chippyash\Authentication\Manager\Traits;
 9: 
10: use Chippyash\Authentication\Manager\Exceptions\AuthManagerException;
11: use Chippyash\Type\String\StringType;
12: 
13: /**
14:  * Setter and Getter for a Realm
15:  */
16: trait RealmHandler
17: {
18:     /**
19:      * Digest Realm
20:      * @var StringType
21:      */
22:     protected $realm;
23:     
24:     /**
25:      * Set the digest realm
26:      * 
27:      * @param StringType $realm
28:      * 
29:      * @return BasicDigestCollection
30:      */
31:     public function setRealm(StringType $realm)
32:     {
33:         $this->realm = $realm;
34:         
35:         return $this;
36:     }
37:     
38:     /**
39:      * Return the digest realm
40:      * 
41:      * @return string
42:      * 
43:      * @throws AuthManagerException
44:      */
45:     protected function realm()
46:     {
47:         if (is_null($this->realm)) {
48:             throw new AuthManagerException('No Realm set');
49:         }
50:         
51:         return $this->realm->get();
52:     }
53: }
54: 
Chippyash Authentication Manager Library API API documentation generated by ApiGen 2.8.0