| Conditions | 4 |
| Paths | 6 |
| Total Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | protected function isAuthenticated() { |
||
| 12 | if( $this->securityToken == null ) { |
||
| 13 | $securityToken = $this->container->get( 'security.token_storage' )->getToken(); |
||
|
|
|||
| 14 | if( $securityToken instanceof TokenInterface ) { |
||
| 15 | $this->securityToken = $securityToken; |
||
| 16 | } |
||
| 17 | } |
||
| 18 | |||
| 19 | return $this->securityToken->isAuthenticated() === true && count( $this->securityToken->getRoles() ); |
||
| 20 | } |
||
| 21 | } |
||
| 22 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: