| Conditions | 1 | 
| Total Lines | 52 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php  | 
            ||
| 44 | protected function setUp(): void  | 
            ||
| 45 |     { | 
            ||
| 46 | parent::setUp();  | 
            ||
| 47 | |||
| 48 | $this->config = Configuration::loadFromArray(  | 
            ||
| 49 | [  | 
            ||
| 50 | 'module.enable' => ['memcookie' => true],  | 
            ||
| 51 | ],  | 
            ||
| 52 | '[ARRAY]',  | 
            ||
| 53 | 'simplesaml'  | 
            ||
| 54 | );  | 
            ||
| 55 | |||
| 56 | $session = $this->createMock(Session::class);  | 
            ||
| 57 |         $session->method('getData')->willReturn(['default-sp' => []]); | 
            ||
| 58 | /** @var \SimpleSAML\Session $session */  | 
            ||
| 59 | $this->session = $session;  | 
            ||
| 60 | |||
| 61 | |||
| 62 | $this->authsources = Configuration::loadFromArray(  | 
            ||
| 63 | [  | 
            ||
| 64 | 'default-sp' => ['saml:SP'],  | 
            ||
| 65 | ],  | 
            ||
| 66 | '[ARRAY]',  | 
            ||
| 67 | 'simplesaml'  | 
            ||
| 68 | );  | 
            ||
| 69 | Configuration::setPreLoadedConfig($this->authsources, 'authsources.php', 'simplesaml');  | 
            ||
| 70 | |||
| 71 |         $this->http_utils = new class () extends Utils\HTTP { | 
            ||
| 72 | public static function setCookie(string $name, ?string $value, array $params = null, bool $throw = true): void  | 
            ||
| 73 |             { | 
            ||
| 74 | // stub  | 
            ||
| 75 | }  | 
            ||
| 76 | |||
| 77 | public static function redirectTrustedURL(string $url, array $parameters = []): void  | 
            ||
| 78 |             { | 
            ||
| 79 | // stub  | 
            ||
| 80 | }  | 
            ||
| 81 | };  | 
            ||
| 82 | |||
| 83 | $this->module_config = Configuration::loadFromArray(  | 
            ||
| 84 | [  | 
            ||
| 85 | 'authsource' => 'default-sp',  | 
            ||
| 86 | 'cookiename' => 'AuthMemCookie',  | 
            ||
| 87 | 'username' => 'uid',  | 
            ||
| 88 | 'groups' => null,  | 
            ||
| 89 | 'memcache.host' => '127.0.0.1',  | 
            ||
| 90 | 'memcache.port' => 11211,  | 
            ||
| 91 | ],  | 
            ||
| 92 | '[ARRAY]',  | 
            ||
| 93 | 'simplesaml'  | 
            ||
| 94 | );  | 
            ||
| 95 | Configuration::setPreLoadedConfig($this->module_config, 'module_authmemcookie.php', 'simplesaml');  | 
            ||
| 96 | }  | 
            ||
| 140 |