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