Completed
Push — master ( 265a2d...f9e310 )
by jerome
05:38 queued 02:58
created

FtpExceptionExtension   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 3
dl 0
loc 20
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getTests() 0 12 2
A getName() 0 4 1
1
<?php
2
3
namespace DP\GameServer\GameServerBundle\Twig;
4
5
use Dedipanel\PHPSeclibWrapperBundle\SFTP\Exception\InvalidPathException;
6
use Symfony\Component\Debug\Exception\FlattenException;
7
8
class FtpExceptionExtension extends \Twig_Extension
9
{
10
    public function getTests()
11
    {
12
        return [
13
            new \Twig_SimpleTest('ftp exception', function ($exception) {
14
                if ($exception instanceof FlattenException) {
15
                    $exception = $exception->getClass();
16
                }
17
18
                return is_a($exception, InvalidPathException::CLASSNAME, true);
19
            }),
20
        ];
21
    }
22
23
    public function getName()
24
    {
25
        return 'ftp_exception';
26
    }
27
}
28