Complex classes like Service often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use Service, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 21 | class Service extends AbstractService |
||
| 22 | { |
||
| 23 | public function listClusters(array $options = [], callable $mapFn = null): \Generator |
||
| 27 | |||
| 28 | public function getCluster(array $options = []): Cluster |
||
| 35 | |||
| 36 | public function createCluster(array $options = []): Cluster |
||
| 40 | |||
| 41 | public function createMultipleClusters(array $options = []) |
||
| 59 | |||
| 60 | public function scaleCluster(array $options = []): Cluster |
||
| 64 | |||
| 65 | public function createDataSource(array $options = []): Datasource |
||
| 69 | |||
| 70 | public function getDataSource(array $options = []): Datasource |
||
| 77 | |||
| 78 | public function listDataSources(array $options = [], callable $mapFn = null): \Generator |
||
| 82 | |||
| 83 | public function createClusterTemplate(array $options = []): ClusterTemplate |
||
| 87 | |||
| 88 | public function getClusterTemplate(array $options = []): ClusterTemplate |
||
| 95 | |||
| 96 | public function listClusterTemplates(array $options = [], callable $mapFn = null): \Generator |
||
| 100 | |||
| 101 | public function getNodeGroupTemplate(array $options = []): NodeGroupTemplate |
||
| 108 | |||
| 109 | public function listNodeGroupTemplates(array $options = [], callable $mapFn = null): \Generator |
||
| 113 | |||
| 114 | public function createNodeGroupTemplate(array $options = []): NodeGroupTemplate |
||
| 118 | |||
| 119 | public function listJobBinaries(array $options = [], callable $mapFn = null): \Generator |
||
| 123 | |||
| 124 | public function getJobBinary(array $options = []): JobBinary |
||
| 131 | |||
| 132 | public function createJobBinary(array $options = []): JobBinary |
||
| 136 | |||
| 137 | public function getJobBinaryInternal(array $options = []): JobBinaryInternal |
||
| 144 | |||
| 145 | public function listJobBinaryInternals(array $options = [], callable $mapFn = null): \Generator |
||
| 149 | |||
| 150 | public function createJobBinaryInternal(StreamInterface $stream): JobBinaryInternal |
||
| 159 | |||
| 160 | public function createJob(array $options = []): Job |
||
| 164 | |||
| 165 | public function getJob(array $options = []): Job |
||
| 172 | |||
| 173 | public function listJobs(array $options = [], callable $mapFn = null): \Generator |
||
| 177 | |||
| 178 | public function getJobExecution(array $options = []): JobExecution |
||
| 185 | |||
| 186 | public function listJobExecutions(array $options = [], callable $mapFn = null): \Generator |
||
| 190 | |||
| 191 | public function runJob(array $options = []): JobExecution |
||
| 195 | |||
| 196 | public function getPlugin(array $options = []): Plugin |
||
| 203 | |||
| 204 | public function listPlugins(array $options = [], callable $mapFn = null): \Generator |
||
| 208 | |||
| 209 | public function getImage(array $options = []): Image |
||
| 216 | |||
| 217 | public function listImages(array $options = [], callable $mapFn = null): \Generator |
||
| 221 | |||
| 222 | public function listJobTypes(array $options = [], callable $mapFn = null): array |
||
| 226 | |||
| 227 | public function listNodeGroups(array $options = [], callable $mapFn = null): \Generator |
||
| 231 | |||
| 232 | public function getNodeGroup(array $options = [], callable $mapFn = null): array |
||
| 246 | |||
| 247 | public function listJobConfigs(array $options = [], callable $mapFn = null): \Generator |
||
| 251 | |||
| 252 | public function getJobConfig(array $options = []): JobConfig |
||
| 259 | } |
||
| 260 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.