| Conditions | 3 |
| Paths | 3 |
| Total Lines | 26 |
| Code Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 3 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 23 | public function findTranslation(Node $node, $locale) |
||
| 24 | { |
||
| 25 | $nodeSource = null; |
||
|
|
|||
| 26 | |||
| 27 | // We are checking if the node is the translation provider or translated |
||
| 28 | // from an other node |
||
| 29 | if ($node->getTranslationSource() !== null) { |
||
| 30 | $nodeSource = $node->getTranslationSource(); |
||
| 31 | if ($nodeSource->getLocale() == $locale) { |
||
| 32 | return $nodeSource; |
||
| 33 | } |
||
| 34 | } else { |
||
| 35 | $nodeSource = $node; |
||
| 36 | } |
||
| 37 | |||
| 38 | return $this->createQueryBuilder('n') |
||
| 39 | ->addSelect('n') |
||
| 40 | ->andWhere('n.translationSource = :source') |
||
| 41 | ->andWhere('n.locale = :locale') |
||
| 42 | ->setParameters([ |
||
| 43 | 'source' => $nodeSource, |
||
| 44 | 'locale' => $locale, |
||
| 45 | ]) |
||
| 46 | ->getQuery() |
||
| 47 | ->getOneOrNullResult(); |
||
| 48 | } |
||
| 49 | } |
||
| 50 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVarassignment in line 1 and the$higherassignment in line 2 are dead. The first because$myVaris never used and the second because$higheris always overwritten for every possible time line.