| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | namespace Majora\Component\OAuth\Entity; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | use Majora\Component\OAuth\Model\AccessTokenInterface; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  | use Majora\Component\OAuth\Model\AccountInterface; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  | use Majora\Component\OAuth\Model\ApplicationInterface; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  | use Majora\Component\OAuth\Model\RefreshTokenInterface; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  | use Majora\Framework\Model\CollectionableInterface; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  | use Majora\Framework\Model\CollectionableTrait; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  | use Majora\Framework\Serializer\Model\SerializableTrait; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |  * Access token class. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  | class AccessToken extends Token implements AccessTokenInterface, CollectionableInterface | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |     use CollectionableTrait, SerializableTrait; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |      * @var RefreshTokenInterface | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |     protected $refreshToken; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |      * @see AccessTokenInterface::__construct() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |     public function __construct( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |         ApplicationInterface $application, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |         AccountInterface $account = null, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |         $expireIn = AccessTokenInterface::DEFAULT_TTL, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |         $hash = null, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |         RefreshTokenInterface $refreshToken = null | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |     ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |         parent::__construct($application, $account, $expireIn, $hash); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |         $this->refreshToken = $refreshToken; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |      * @see AccessTokenInterface::getRefreshToken() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |     public function getRefreshToken() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |         return $this->refreshToken; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |      * @inheritdoc | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 49 |  |  |      */ | 
            
                                                        
            
                                    
            
            
                | 50 |  |  |     public static function getScopes() | 
            
                                                        
            
                                    
            
            
                | 51 |  |  |     { | 
            
                                                        
            
                                    
            
            
                | 52 |  |  |         return array( | 
            
                                                        
            
                                    
            
            
                | 53 |  |  |             'identifier' => array('id', 'hash'), | 
            
                                                        
            
                                    
            
            
                | 54 |  |  |         ); | 
            
                                                        
            
                                    
            
            
                | 55 |  |  |     } | 
            
                                                        
            
                                    
            
            
                | 56 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 57 |  |  |  |