| Conditions | 4 | 
| Paths | 4 | 
| Total Lines | 24 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Tests | 12 | 
| CRAP Score | 4.0466 | 
| Changes | 0 | ||
| 1 | <?php  | 
            ||
| 29 | 30 | public function parse(InlineParserContext $inlineContext): bool  | 
            |
| 30 |     { | 
            ||
| 31 | 30 | $container = $inlineContext->getContainer();  | 
            |
| 32 | 30 | $cursor = $inlineContext->getCursor();  | 
            |
| 33 | 30 | $nextChar = $cursor->peek();  | 
            |
| 34 | 30 |         if ($nextChar !== '^') { | 
            |
| 35 | 18 | return false;  | 
            |
| 36 | }  | 
            ||
| 37 | |||
| 38 | 18 | $state = $cursor->saveState();  | 
            |
| 39 | |||
| 40 | 18 |         $m = $cursor->match('#\[\^([^\]]+)\]#'); | 
            |
| 41 | 18 |         if ($m !== null) { | 
            |
| 42 | 18 |             if (\preg_match('#\[\^([^\]]+)\]#', $m, $matches) > 0) { | 
            |
| 43 | 18 | $container->appendChild(new FootnoteRef($this->createReference($matches[1])));  | 
            |
| 44 | |||
| 45 | 18 | return true;  | 
            |
| 46 | }  | 
            ||
| 47 | }  | 
            ||
| 48 | |||
| 49 | $cursor->restoreState($state);  | 
            ||
| 
                                                                                                    
                        
                         | 
                |||
| 50 | |||
| 51 | return false;  | 
            ||
| 52 | }  | 
            ||
| 53 | |||
| 59 | 
PHP Analyzer performs a side-effects analysis of your code. A side-effect is basically anything that might be visible after the scope of the method is left.
Let’s take a look at an example:
If we look at the
getEmail()method, we can see that it has no side-effect. Whether you call this method or not, no future calls to other methods are affected by this. As such code as the following is useless:On the hand, if we look at the
setEmail(), this method _has_ side-effects. In the following case, we could not remove the method call: