| Conditions | 1 |
| Paths | 1 |
| Total Lines | 140 |
| Code Lines | 125 |
| 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 |
||
| 78 | public function getConfigTreeBuilder() |
||
| 79 | { |
||
| 80 | $treeBuilder = new TreeBuilder(); |
||
| 81 | $rootNode = $treeBuilder->root(static::ROOT_NODE); |
||
| 82 | |||
| 83 | // TODO total review to be done see https://github.com/devgiants/websites-backup/projects/1 |
||
| 84 | // add node definitions to the root of the tree |
||
| 85 | $rootNode |
||
| 86 | ->children() |
||
| 87 | ->scalarNode(static::REMANENCE_NODE[static::NODE_NAME]) |
||
| 88 | ->defaultValue(static::REMANENCE_NODE[static::NODE_DEFAULT_VALUE]) |
||
| 89 | ->info('Contains the backup folders max value to keep on defined storages') |
||
| 90 | ->end() |
||
| 91 | ->scalarNode(static::LOG_NODE[static::NODE_NAME]) |
||
| 92 | ->defaultValue(static::LOG_NODE[static::NODE_DEFAULT_VALUE]) |
||
| 93 | ->info('Contains the backup log folder') |
||
| 94 | ->end() |
||
| 95 | ->arrayNode(static::SITES) |
||
| 96 | ->isRequired() |
||
| 97 | ->requiresAtLeastOneElement() |
||
| 98 | ->prototype('array') |
||
| 99 | ->children() |
||
| 100 | ->arrayNode(static::PRE_SAVE_COMMANDS) |
||
| 101 | ->requiresAtLeastOneElement() |
||
| 102 | ->prototype('scalar')->end() |
||
| 103 | ->end() |
||
| 104 | ->arrayNode(static::DATABASE) |
||
| 105 | ->children() |
||
| 106 | ->scalarNode(static::DATABASE_SERVER[static::NODE_NAME]) |
||
| 107 | ->defaultValue(static::DATABASE_SERVER[static::NODE_DEFAULT_VALUE]) |
||
| 108 | ->info('Contains the MySQL database server IP or domain name. default is localhost') |
||
| 109 | ->end() |
||
| 110 | ->scalarNode(static::USER) |
||
| 111 | ->info('Contains the MySQL user to connect to database with') |
||
| 112 | ->isRequired() |
||
| 113 | ->cannotBeEmpty() |
||
| 114 | ->end() |
||
| 115 | ->scalarNode(static::PASSWORD) |
||
| 116 | ->info('Contains password for MySQL user') |
||
| 117 | ->isRequired() |
||
| 118 | ->cannotBeEmpty() |
||
| 119 | ->end() |
||
| 120 | ->scalarNode(static::NAME) |
||
| 121 | ->info('Contains database name') |
||
| 122 | ->isRequired() |
||
| 123 | ->cannotBeEmpty() |
||
| 124 | ->end() |
||
| 125 | ->end() |
||
| 126 | ->end() |
||
| 127 | ->arrayNode(static::FILES) |
||
| 128 | ->children() |
||
| 129 | ->scalarNode(static::ROOT_DIR) |
||
| 130 | ->info('Contains the root directory for backup') |
||
| 131 | ->isRequired() |
||
| 132 | ->cannotBeEmpty() |
||
| 133 | ->end() |
||
| 134 | ->arrayNode(static::FOLDERS_TO_INCLUDE) |
||
| 135 | ->requiresAtLeastOneElement() |
||
| 136 | ->prototype('scalar')->end() |
||
| 137 | ->end() |
||
| 138 | ->arrayNode(static::FOLDERS_TO_EXCLUDE) |
||
| 139 | ->requiresAtLeastOneElement() |
||
| 140 | ->prototype('scalar')->end() |
||
| 141 | ->end() |
||
| 142 | ->end() |
||
| 143 | ->end() |
||
| 144 | // TODO make checks to ensure storage is defined |
||
| 145 | ->arrayNode(static::BACKUP_STORAGES) |
||
| 146 | ->requiresAtLeastOneElement() |
||
| 147 | ->prototype('scalar')->end() |
||
| 148 | ->end() |
||
| 149 | ->arrayNode(static::POST_SAVE_COMMANDS) |
||
| 150 | ->requiresAtLeastOneElement() |
||
| 151 | ->prototype('scalar')->end() |
||
| 152 | ->end() |
||
| 153 | ->end() |
||
| 154 | ->end() |
||
| 155 | ->end() |
||
| 156 | ->arrayNode(static::BACKUP_STORAGES) |
||
| 157 | ->isRequired() |
||
| 158 | ->requiresAtLeastOneElement() |
||
| 159 | ->prototype('array') |
||
| 160 | ->children() |
||
| 161 | // TODO add checks if true to contextualize options with storage type |
||
| 162 | ->enumNode(static::STORAGE_TYPE) |
||
| 163 | ->info('Contains the storage type for backup') |
||
| 164 | ->values(static::AUTHORIZED_STORAGE) |
||
| 165 | ->end() |
||
| 166 | ->booleanNode(static::SSL) |
||
| 167 | ->info('For FTP connections, decides if connection is STP or regular FTP. Default regular.') |
||
| 168 | ->defaultFalse() |
||
| 169 | ->end() |
||
| 170 | ->booleanNode(static::PASSIVE) |
||
| 171 | ->info('For FTP connections, decides if transfer mode is passive or not. Default passive') |
||
| 172 | ->defaultTrue() |
||
| 173 | ->end() |
||
| 174 | ->integerNode(static::TRANSFER) |
||
| 175 | ->info('For FTP connections, decides transfer type. Default FTP_BINARY') |
||
| 176 | ->defaultValue(FTP_BINARY) |
||
| 177 | ->end() |
||
| 178 | ->scalarNode(static::SERVER) |
||
| 179 | ->info('Contains the server to connect with') |
||
| 180 | // ->isRequired() |
||
| 181 | ->cannotBeEmpty() |
||
| 182 | ->end() |
||
| 183 | ->scalarNode(static::USER) |
||
| 184 | ->info('Contains the user to connect server with') |
||
| 185 | // ->isRequired() |
||
| 186 | ->cannotBeEmpty() |
||
| 187 | ->end() |
||
| 188 | ->scalarNode(static::PASSWORD) |
||
| 189 | ->info('Contains the password to connect server with') |
||
| 190 | // ->isRequired() |
||
| 191 | ->cannotBeEmpty() |
||
| 192 | ->end() |
||
| 193 | ->scalarNode(static::ROOT_DIR) |
||
| 194 | ->info('Contains the root dir on remote server to start with') |
||
| 195 | ->isRequired() |
||
| 196 | ->cannotBeEmpty() |
||
| 197 | ->end() |
||
| 198 | ->scalarNode(static::CLIENT_ID) |
||
| 199 | ->info('The Dropbox app client id') |
||
| 200 | // ->isRequired() |
||
| 201 | ->cannotBeEmpty() |
||
| 202 | ->end() |
||
| 203 | ->scalarNode(static::CLIENT_SECRET) |
||
| 204 | ->info('The Dropbox app client secret') |
||
| 205 | // ->isRequired() |
||
| 206 | ->cannotBeEmpty() |
||
| 207 | ->end() |
||
| 208 | ->scalarNode(static::ACCESS_TOKEN) |
||
| 209 | ->info('The Dropbox app access token') |
||
| 210 | // ->isRequired() |
||
| 211 | ->cannotBeEmpty() |
||
| 212 | ->end() |
||
| 213 | ->end() |
||
| 214 | ->end() |
||
| 215 | ; |
||
| 216 | |||
| 217 | return $treeBuilder; |
||
| 218 | } |
||
| 219 | } |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths