| Conditions | 1 |
| Paths | 1 |
| Total Lines | 121 |
| Code Lines | 80 |
| 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 |
||
| 51 | public function createSymbolsConfiguration(array $config): SymbolsConfiguration |
||
| 52 | { |
||
| 53 | [ |
||
| 54 | $excludedNamespaceNames, |
||
| 55 | $excludedNamespaceRegexes, |
||
| 56 | ] = $this->retrieveElements( |
||
| 57 | $config, |
||
| 58 | ConfigurationKeys::EXCLUDE_NAMESPACES_KEYWORD, |
||
| 59 | ); |
||
| 60 | |||
| 61 | [ |
||
| 62 | $exposedNamespaceNames, |
||
| 63 | $exposedNamespaceRegexes, |
||
| 64 | ] = $this->retrieveElements( |
||
| 65 | $config, |
||
| 66 | ConfigurationKeys::EXPOSE_NAMESPACES_KEYWORD, |
||
| 67 | ); |
||
| 68 | |||
| 69 | $legacyExposedElements = self::retrieveLegacyExposedElements($config); |
||
| 70 | |||
| 71 | [ |
||
| 72 | $legacyExposedSymbols, |
||
| 73 | $legacyExposedSymbolsPatterns, |
||
| 74 | $legacyExposedConstants, |
||
| 75 | $excludedNamespaceNames, |
||
| 76 | ] = self::parseLegacyExposedElements($legacyExposedElements, $excludedNamespaceNames); |
||
|
|
|||
| 77 | |||
| 78 | $exposeGlobalConstants = self::retrieveExposeGlobalSymbol( |
||
| 79 | $config, |
||
| 80 | ConfigurationKeys::EXPOSE_GLOBAL_CONSTANTS_KEYWORD, |
||
| 81 | ); |
||
| 82 | $exposeGlobalClasses = self::retrieveExposeGlobalSymbol( |
||
| 83 | $config, |
||
| 84 | ConfigurationKeys::EXPOSE_GLOBAL_CLASSES_KEYWORD, |
||
| 85 | ); |
||
| 86 | $exposeGlobalFunctions = self::retrieveExposeGlobalSymbol( |
||
| 87 | $config, |
||
| 88 | ConfigurationKeys::EXPOSE_GLOBAL_FUNCTIONS_KEYWORD, |
||
| 89 | ); |
||
| 90 | |||
| 91 | [$exposedClassNames, $exposedClassRegexes] = $this->retrieveElements( |
||
| 92 | $config, |
||
| 93 | ConfigurationKeys::EXPOSE_CLASSES_SYMBOLS_KEYWORD, |
||
| 94 | ); |
||
| 95 | |||
| 96 | [$exposedFunctionNames, $exposedFunctionRegexes] = $this->retrieveElements( |
||
| 97 | $config, |
||
| 98 | ConfigurationKeys::EXPOSE_FUNCTIONS_SYMBOLS_KEYWORD, |
||
| 99 | ); |
||
| 100 | |||
| 101 | [$exposedConstantNames, $exposedConstantRegexes] = $this->retrieveElements( |
||
| 102 | $config, |
||
| 103 | ConfigurationKeys::EXPOSE_CONSTANTS_SYMBOLS_KEYWORD, |
||
| 104 | ); |
||
| 105 | |||
| 106 | $excludedClasses = SymbolRegistry::create( |
||
| 107 | ...$this->retrieveElements( |
||
| 108 | $config, |
||
| 109 | ConfigurationKeys::CLASSES_INTERNAL_SYMBOLS_KEYWORD, |
||
| 110 | ), |
||
| 111 | ); |
||
| 112 | |||
| 113 | $excludedFunctions = SymbolRegistry::create( |
||
| 114 | ...$this->retrieveElements( |
||
| 115 | $config, |
||
| 116 | ConfigurationKeys::FUNCTIONS_INTERNAL_SYMBOLS_KEYWORD, |
||
| 117 | ), |
||
| 118 | ); |
||
| 119 | |||
| 120 | $excludedConstants = SymbolRegistry::createForConstants( |
||
| 121 | ...$this->retrieveElements( |
||
| 122 | $config, |
||
| 123 | ConfigurationKeys::CONSTANTS_INTERNAL_SYMBOLS_KEYWORD, |
||
| 124 | ), |
||
| 125 | ); |
||
| 126 | |||
| 127 | return SymbolsConfiguration::create( |
||
| 128 | $exposeGlobalConstants, |
||
| 129 | $exposeGlobalClasses, |
||
| 130 | $exposeGlobalFunctions, |
||
| 131 | NamespaceRegistry::create( |
||
| 132 | $excludedNamespaceNames, |
||
| 133 | $excludedNamespaceRegexes, |
||
| 134 | ), |
||
| 135 | NamespaceRegistry::create( |
||
| 136 | $exposedNamespaceNames, |
||
| 137 | $exposedNamespaceRegexes, |
||
| 138 | ), |
||
| 139 | SymbolRegistry::create( |
||
| 140 | array_merge( |
||
| 141 | $exposedClassNames, |
||
| 142 | $legacyExposedSymbols, |
||
| 143 | ), |
||
| 144 | array_merge( |
||
| 145 | $exposedClassRegexes, |
||
| 146 | $legacyExposedSymbolsPatterns, |
||
| 147 | ), |
||
| 148 | ), |
||
| 149 | SymbolRegistry::create( |
||
| 150 | array_merge( |
||
| 151 | $exposedFunctionNames, |
||
| 152 | $legacyExposedSymbols, |
||
| 153 | ), |
||
| 154 | array_merge( |
||
| 155 | $exposedFunctionRegexes, |
||
| 156 | $legacyExposedSymbolsPatterns, |
||
| 157 | ), |
||
| 158 | ), |
||
| 159 | SymbolRegistry::createForConstants( |
||
| 160 | array_merge( |
||
| 161 | $exposedConstantNames, |
||
| 162 | $legacyExposedConstants, |
||
| 163 | ), |
||
| 164 | array_merge( |
||
| 165 | $exposedConstantRegexes, |
||
| 166 | $legacyExposedSymbolsPatterns, |
||
| 167 | ), |
||
| 168 | ), |
||
| 169 | $excludedClasses, |
||
| 170 | $excludedFunctions, |
||
| 171 | $excludedConstants, |
||
| 172 | ); |
||
| 446 |