| Conditions | 11 | 
| Paths | 216 | 
| Total Lines | 45 | 
| Code Lines | 27 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 4 | ||
| Bugs | 0 | Features | 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 | ||
| 58 | public function transform( string $target = null, string $controller = null, string $action = null, | ||
| 59 | array $params = [], array $trailing = [], array $config = [] ) : string | ||
| 60 | 	{ | ||
| 61 | $locale = $this->getValue( $params, 'locale' ); | ||
| 62 | |||
| 63 | 		if( (bool) $this->getValue( $config, 'BE', false ) === false ) { | ||
| 64 | $params['controller'] = $controller !== null ? ucfirst( $controller ) : null; | ||
| 65 | $params['action'] = $action; | ||
| 66 | } | ||
| 67 | |||
| 68 | 		if( $this->prefix != '' && (bool) $this->getValue( $config, 'namespace', true ) === true ) { | ||
| 69 | $params = [$this->prefix => $params]; | ||
| 70 | } | ||
| 71 | $params += $this->fixed; | ||
| 72 | |||
| 73 | 		if( (bool) $this->getValue( $config, 'BE', false ) === true ) { | ||
| 74 | $params['controller'] = $controller !== null ? ucfirst( $controller ) : null; | ||
| 75 | $params['action'] = $action; | ||
| 76 | } | ||
| 77 | |||
| 78 | 		if( ( $eid = $this->getValue( $config, 'eID' ) ) !== null ) { | ||
| 79 | $params['eID'] = $eid; | ||
| 80 | } | ||
| 81 | |||
| 82 | 		if( $locale !== null ) { | ||
| 83 | $params['L'] = $locale; | ||
| 84 | } | ||
| 85 | |||
| 86 | $useCHash = (bool) $this->getValue( $config, 'chash', false ); | ||
| 87 | |||
| 88 | $this->uriBuilder->reset() | ||
| 89 | ->setTargetPageUid( (int) $target ) | ||
| 90 | ->setCreateAbsoluteUri( (bool) $this->getValue( $config, 'absoluteUri', false ) ) | ||
| 91 | ->setTargetPageType( (int) $this->getValue( $config, 'type', 0 ) ) | ||
| 92 | ->setNoCache( (bool) $this->getValue( $config, 'nocache', false ) ) | ||
| 93 | ->setFormat( (string) $this->getValue( $config, 'format', '' ) ) | ||
| 94 | ->setArguments( $this->sanitize( $params ) ) | ||
| 95 | ->setSection( join( '/', $trailing ) ); | ||
| 96 | |||
| 97 | 		if( (bool) $this->getValue( $config, 'BE', false ) === true ) { | ||
| 98 | return (string) $this->uriBuilder->buildBackendUri(); | ||
| 99 | } | ||
| 100 | |||
| 101 | $url = (string) $this->uriBuilder->buildFrontendUri(); | ||
| 102 | 		return $useCHash ? $url : preg_replace( '/\&cHash=[0-9a-f]{32}/', '', $url ); // wokaround for bad TYPO3 behavior | ||
| 103 | } | ||
| 123 |