| Total Complexity | 52 | 
| Total Lines | 560 | 
| Duplicated Lines | 0 % | 
| Changes | 0 | ||
Complex classes like PlaylistDataProvider 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.
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 PlaylistDataProvider, and based on these observations, apply Extract Interface, too.
| 1 | <?php  | 
            ||
| 8 | final class PlaylistDataProvider extends \Xervice\DataProvider\Business\Model\DataProvider\AbstractDataProvider implements \Xervice\DataProvider\Business\Model\DataProvider\DataProviderInterface  | 
            ||
| 9 | { | 
            ||
| 10 | /** @var string */  | 
            ||
| 11 | protected $description;  | 
            ||
| 12 | |||
| 13 | /** @var \SpotifyApiConnect\Domain\DataTransferObject\ExternalUrlDataProvider */  | 
            ||
| 14 | protected $external_urls;  | 
            ||
| 15 | |||
| 16 | /** @var \SpotifyApiConnect\Domain\DataTransferObject\FollowersDataProvider */  | 
            ||
| 17 | protected $followers;  | 
            ||
| 18 | |||
| 19 | /** @var string */  | 
            ||
| 20 | protected $id;  | 
            ||
| 21 | |||
| 22 | /** @var string */  | 
            ||
| 23 | protected $href;  | 
            ||
| 24 | |||
| 25 | /** @var string */  | 
            ||
| 26 | protected $name;  | 
            ||
| 27 | |||
| 28 | /** @var bool */  | 
            ||
| 29 | protected $public;  | 
            ||
| 30 | |||
| 31 | /** @var \SpotifyApiConnect\Domain\DataTransferObject\PlaylistTracksDataProvider */  | 
            ||
| 32 | protected $tracks;  | 
            ||
| 33 | |||
| 34 | /** @var string */  | 
            ||
| 35 | protected $type;  | 
            ||
| 36 | |||
| 37 | /** @var string */  | 
            ||
| 38 | protected $uri;  | 
            ||
| 39 | |||
| 40 | |||
| 41 | /**  | 
            ||
| 42 | * @return string  | 
            ||
| 43 | */  | 
            ||
| 44 | public function getDescription(): ?string  | 
            ||
| 45 |     { | 
            ||
| 46 | return $this->description;  | 
            ||
| 47 | }  | 
            ||
| 48 | |||
| 49 | |||
| 50 | /**  | 
            ||
| 51 | * @param string $description  | 
            ||
| 52 | * @return PlaylistDataProvider  | 
            ||
| 53 | */  | 
            ||
| 54 | public function setDescription(?string $description = null)  | 
            ||
| 55 |     { | 
            ||
| 56 | $this->description = $description;  | 
            ||
| 57 | |||
| 58 | return $this;  | 
            ||
| 59 | }  | 
            ||
| 60 | |||
| 61 | |||
| 62 | /**  | 
            ||
| 63 | * @return PlaylistDataProvider  | 
            ||
| 64 | */  | 
            ||
| 65 | public function unsetDescription()  | 
            ||
| 66 |     { | 
            ||
| 67 | $this->description = null;  | 
            ||
| 68 | |||
| 69 | return $this;  | 
            ||
| 70 | }  | 
            ||
| 71 | |||
| 72 | |||
| 73 | /**  | 
            ||
| 74 | * @return bool  | 
            ||
| 75 | */  | 
            ||
| 76 | public function hasDescription()  | 
            ||
| 77 |     { | 
            ||
| 78 | return ($this->description !== null && $this->description !== []);  | 
            ||
| 79 | }  | 
            ||
| 80 | |||
| 81 | |||
| 82 | /**  | 
            ||
| 83 | * @return \SpotifyApiConnect\Domain\DataTransferObject\ExternalUrlDataProvider  | 
            ||
| 84 | */  | 
            ||
| 85 | public function getExternal_urls(): ?\SpotifyApiConnect\Domain\DataTransferObject\ExternalUrlDataProvider  | 
            ||
| 86 |     { | 
            ||
| 87 | return $this->external_urls;  | 
            ||
| 88 | }  | 
            ||
| 89 | |||
| 90 | |||
| 91 | /**  | 
            ||
| 92 | * @param \SpotifyApiConnect\Domain\DataTransferObject\ExternalUrlDataProvider $external_urls  | 
            ||
| 93 | * @return PlaylistDataProvider  | 
            ||
| 94 | */  | 
            ||
| 95 | public function setExternal_urls(?\SpotifyApiConnect\Domain\DataTransferObject\ExternalUrlDataProvider $external_urls = null)  | 
            ||
| 96 |     { | 
            ||
| 97 | $this->external_urls = $external_urls;  | 
            ||
| 98 | |||
| 99 | return $this;  | 
            ||
| 100 | }  | 
            ||
| 101 | |||
| 102 | |||
| 103 | /**  | 
            ||
| 104 | * @return PlaylistDataProvider  | 
            ||
| 105 | */  | 
            ||
| 106 | public function unsetExternal_urls()  | 
            ||
| 107 |     { | 
            ||
| 108 | $this->external_urls = null;  | 
            ||
| 109 | |||
| 110 | return $this;  | 
            ||
| 111 | }  | 
            ||
| 112 | |||
| 113 | |||
| 114 | /**  | 
            ||
| 115 | * @return bool  | 
            ||
| 116 | */  | 
            ||
| 117 | public function hasExternal_urls()  | 
            ||
| 118 |     { | 
            ||
| 119 | return ($this->external_urls !== null && $this->external_urls !== []);  | 
            ||
| 120 | }  | 
            ||
| 121 | |||
| 122 | |||
| 123 | /**  | 
            ||
| 124 | * @return \SpotifyApiConnect\Domain\DataTransferObject\FollowersDataProvider  | 
            ||
| 125 | */  | 
            ||
| 126 | public function getFollowers(): ?\SpotifyApiConnect\Domain\DataTransferObject\FollowersDataProvider  | 
            ||
| 127 |     { | 
            ||
| 128 | return $this->followers;  | 
            ||
| 129 | }  | 
            ||
| 130 | |||
| 131 | |||
| 132 | /**  | 
            ||
| 133 | * @param \SpotifyApiConnect\Domain\DataTransferObject\FollowersDataProvider $followers  | 
            ||
| 134 | * @return PlaylistDataProvider  | 
            ||
| 135 | */  | 
            ||
| 136 | public function setFollowers(?\SpotifyApiConnect\Domain\DataTransferObject\FollowersDataProvider $followers = null)  | 
            ||
| 137 |     { | 
            ||
| 138 | $this->followers = $followers;  | 
            ||
| 139 | |||
| 140 | return $this;  | 
            ||
| 141 | }  | 
            ||
| 142 | |||
| 143 | |||
| 144 | /**  | 
            ||
| 145 | * @return PlaylistDataProvider  | 
            ||
| 146 | */  | 
            ||
| 147 | public function unsetFollowers()  | 
            ||
| 148 |     { | 
            ||
| 149 | $this->followers = null;  | 
            ||
| 150 | |||
| 151 | return $this;  | 
            ||
| 152 | }  | 
            ||
| 153 | |||
| 154 | |||
| 155 | /**  | 
            ||
| 156 | * @return bool  | 
            ||
| 157 | */  | 
            ||
| 158 | public function hasFollowers()  | 
            ||
| 159 |     { | 
            ||
| 160 | return ($this->followers !== null && $this->followers !== []);  | 
            ||
| 161 | }  | 
            ||
| 162 | |||
| 163 | |||
| 164 | /**  | 
            ||
| 165 | * @return string  | 
            ||
| 166 | */  | 
            ||
| 167 | public function getId(): ?string  | 
            ||
| 168 |     { | 
            ||
| 169 | return $this->id;  | 
            ||
| 170 | }  | 
            ||
| 171 | |||
| 172 | |||
| 173 | /**  | 
            ||
| 174 | * @param string $id  | 
            ||
| 175 | * @return PlaylistDataProvider  | 
            ||
| 176 | */  | 
            ||
| 177 | public function setId(?string $id = null)  | 
            ||
| 178 |     { | 
            ||
| 179 | $this->id = $id;  | 
            ||
| 180 | |||
| 181 | return $this;  | 
            ||
| 182 | }  | 
            ||
| 183 | |||
| 184 | |||
| 185 | /**  | 
            ||
| 186 | * @return PlaylistDataProvider  | 
            ||
| 187 | */  | 
            ||
| 188 | public function unsetId()  | 
            ||
| 189 |     { | 
            ||
| 190 | $this->id = null;  | 
            ||
| 191 | |||
| 192 | return $this;  | 
            ||
| 193 | }  | 
            ||
| 194 | |||
| 195 | |||
| 196 | /**  | 
            ||
| 197 | * @return bool  | 
            ||
| 198 | */  | 
            ||
| 199 | public function hasId()  | 
            ||
| 200 |     { | 
            ||
| 201 | return ($this->id !== null && $this->id !== []);  | 
            ||
| 202 | }  | 
            ||
| 203 | |||
| 204 | |||
| 205 | /**  | 
            ||
| 206 | * @return string  | 
            ||
| 207 | */  | 
            ||
| 208 | public function getHref(): ?string  | 
            ||
| 209 |     { | 
            ||
| 210 | return $this->href;  | 
            ||
| 211 | }  | 
            ||
| 212 | |||
| 213 | |||
| 214 | /**  | 
            ||
| 215 | * @param string $href  | 
            ||
| 216 | * @return PlaylistDataProvider  | 
            ||
| 217 | */  | 
            ||
| 218 | public function setHref(?string $href = null)  | 
            ||
| 219 |     { | 
            ||
| 220 | $this->href = $href;  | 
            ||
| 221 | |||
| 222 | return $this;  | 
            ||
| 223 | }  | 
            ||
| 224 | |||
| 225 | |||
| 226 | /**  | 
            ||
| 227 | * @return PlaylistDataProvider  | 
            ||
| 228 | */  | 
            ||
| 229 | public function unsetHref()  | 
            ||
| 230 |     { | 
            ||
| 231 | $this->href = null;  | 
            ||
| 232 | |||
| 233 | return $this;  | 
            ||
| 234 | }  | 
            ||
| 235 | |||
| 236 | |||
| 237 | /**  | 
            ||
| 238 | * @return bool  | 
            ||
| 239 | */  | 
            ||
| 240 | public function hasHref()  | 
            ||
| 241 |     { | 
            ||
| 242 | return ($this->href !== null && $this->href !== []);  | 
            ||
| 243 | }  | 
            ||
| 244 | |||
| 245 | |||
| 246 | /**  | 
            ||
| 247 | * @return string  | 
            ||
| 248 | */  | 
            ||
| 249 | public function getName(): ?string  | 
            ||
| 252 | }  | 
            ||
| 253 | |||
| 254 | |||
| 255 | /**  | 
            ||
| 256 | * @param string $name  | 
            ||
| 257 | * @return PlaylistDataProvider  | 
            ||
| 258 | */  | 
            ||
| 259 | public function setName(?string $name = null)  | 
            ||
| 260 |     { | 
            ||
| 261 | $this->name = $name;  | 
            ||
| 262 | |||
| 263 | return $this;  | 
            ||
| 264 | }  | 
            ||
| 265 | |||
| 266 | |||
| 267 | /**  | 
            ||
| 268 | * @return PlaylistDataProvider  | 
            ||
| 269 | */  | 
            ||
| 270 | public function unsetName()  | 
            ||
| 271 |     { | 
            ||
| 272 | $this->name = null;  | 
            ||
| 273 | |||
| 274 | return $this;  | 
            ||
| 275 | }  | 
            ||
| 276 | |||
| 277 | |||
| 278 | /**  | 
            ||
| 279 | * @return bool  | 
            ||
| 280 | */  | 
            ||
| 281 | public function hasName()  | 
            ||
| 282 |     { | 
            ||
| 283 | return ($this->name !== null && $this->name !== []);  | 
            ||
| 284 | }  | 
            ||
| 285 | |||
| 286 | |||
| 287 | /**  | 
            ||
| 288 | * @return bool  | 
            ||
| 289 | */  | 
            ||
| 290 | public function getPublic(): ?bool  | 
            ||
| 291 |     { | 
            ||
| 292 | return $this->public;  | 
            ||
| 293 | }  | 
            ||
| 294 | |||
| 295 | |||
| 296 | /**  | 
            ||
| 297 | * @param bool $public  | 
            ||
| 298 | * @return PlaylistDataProvider  | 
            ||
| 299 | */  | 
            ||
| 300 | public function setPublic(?bool $public = null)  | 
            ||
| 301 |     { | 
            ||
| 302 | $this->public = $public;  | 
            ||
| 303 | |||
| 304 | return $this;  | 
            ||
| 305 | }  | 
            ||
| 306 | |||
| 307 | |||
| 308 | /**  | 
            ||
| 309 | * @return PlaylistDataProvider  | 
            ||
| 310 | */  | 
            ||
| 311 | public function unsetPublic()  | 
            ||
| 312 |     { | 
            ||
| 313 | $this->public = null;  | 
            ||
| 314 | |||
| 315 | return $this;  | 
            ||
| 316 | }  | 
            ||
| 317 | |||
| 318 | |||
| 319 | /**  | 
            ||
| 320 | * @return bool  | 
            ||
| 321 | */  | 
            ||
| 322 | public function hasPublic()  | 
            ||
| 323 |     { | 
            ||
| 324 | return ($this->public !== null && $this->public !== []);  | 
            ||
| 325 | }  | 
            ||
| 326 | |||
| 327 | |||
| 328 | /**  | 
            ||
| 329 | * @return \SpotifyApiConnect\Domain\DataTransferObject\PlaylistTracksDataProvider  | 
            ||
| 330 | */  | 
            ||
| 331 | public function getTracks(): ?\SpotifyApiConnect\Domain\DataTransferObject\PlaylistTracksDataProvider  | 
            ||
| 332 |     { | 
            ||
| 333 | return $this->tracks;  | 
            ||
| 334 | }  | 
            ||
| 335 | |||
| 336 | |||
| 337 | /**  | 
            ||
| 338 | * @param \SpotifyApiConnect\Domain\DataTransferObject\PlaylistTracksDataProvider $tracks  | 
            ||
| 339 | * @return PlaylistDataProvider  | 
            ||
| 340 | */  | 
            ||
| 341 | public function setTracks(?\SpotifyApiConnect\Domain\DataTransferObject\PlaylistTracksDataProvider $tracks = null)  | 
            ||
| 342 |     { | 
            ||
| 343 | $this->tracks = $tracks;  | 
            ||
| 344 | |||
| 345 | return $this;  | 
            ||
| 346 | }  | 
            ||
| 347 | |||
| 348 | |||
| 349 | /**  | 
            ||
| 350 | * @return PlaylistDataProvider  | 
            ||
| 351 | */  | 
            ||
| 352 | public function unsetTracks()  | 
            ||
| 353 |     { | 
            ||
| 354 | $this->tracks = null;  | 
            ||
| 355 | |||
| 356 | return $this;  | 
            ||
| 357 | }  | 
            ||
| 358 | |||
| 359 | |||
| 360 | /**  | 
            ||
| 361 | * @return bool  | 
            ||
| 362 | */  | 
            ||
| 363 | public function hasTracks()  | 
            ||
| 364 |     { | 
            ||
| 365 | return ($this->tracks !== null && $this->tracks !== []);  | 
            ||
| 366 | }  | 
            ||
| 367 | |||
| 368 | |||
| 369 | /**  | 
            ||
| 370 | * @param \SpotifyApiConnect\Domain\DataTransferObject\PlaylistTracksDataProvider $track  | 
            ||
| 371 | * @return PlaylistDataProvider  | 
            ||
| 372 | */  | 
            ||
| 373 | public function addtrack(PlaylistTracksDataProvider $track)  | 
            ||
| 374 |     { | 
            ||
| 375 | $this->tracks[] = $track; return $this;  | 
            ||
| 376 | }  | 
            ||
| 377 | |||
| 378 | |||
| 379 | /**  | 
            ||
| 380 | * @return string  | 
            ||
| 381 | */  | 
            ||
| 382 | public function getType(): ?string  | 
            ||
| 383 |     { | 
            ||
| 384 | return $this->type;  | 
            ||
| 385 | }  | 
            ||
| 386 | |||
| 387 | |||
| 388 | /**  | 
            ||
| 389 | * @param string $type  | 
            ||
| 390 | * @return PlaylistDataProvider  | 
            ||
| 391 | */  | 
            ||
| 392 | public function setType(?string $type = null)  | 
            ||
| 393 |     { | 
            ||
| 394 | $this->type = $type;  | 
            ||
| 395 | |||
| 396 | return $this;  | 
            ||
| 397 | }  | 
            ||
| 398 | |||
| 399 | |||
| 400 | /**  | 
            ||
| 401 | * @return PlaylistDataProvider  | 
            ||
| 402 | */  | 
            ||
| 403 | public function unsetType()  | 
            ||
| 404 |     { | 
            ||
| 405 | $this->type = null;  | 
            ||
| 406 | |||
| 407 | return $this;  | 
            ||
| 408 | }  | 
            ||
| 409 | |||
| 410 | |||
| 411 | /**  | 
            ||
| 412 | * @return bool  | 
            ||
| 413 | */  | 
            ||
| 414 | public function hasType()  | 
            ||
| 415 |     { | 
            ||
| 416 | return ($this->type !== null && $this->type !== []);  | 
            ||
| 417 | }  | 
            ||
| 418 | |||
| 419 | |||
| 420 | /**  | 
            ||
| 421 | * @return string  | 
            ||
| 422 | */  | 
            ||
| 423 | public function getUri(): ?string  | 
            ||
| 426 | }  | 
            ||
| 427 | |||
| 428 | |||
| 429 | /**  | 
            ||
| 430 | * @param string $uri  | 
            ||
| 431 | * @return PlaylistDataProvider  | 
            ||
| 432 | */  | 
            ||
| 433 | public function setUri(?string $uri = null)  | 
            ||
| 434 |     { | 
            ||
| 435 | $this->uri = $uri;  | 
            ||
| 436 | |||
| 437 | return $this;  | 
            ||
| 438 | }  | 
            ||
| 439 | |||
| 440 | |||
| 441 | /**  | 
            ||
| 442 | * @return PlaylistDataProvider  | 
            ||
| 443 | */  | 
            ||
| 444 | public function unsetUri()  | 
            ||
| 445 |     { | 
            ||
| 446 | $this->uri = null;  | 
            ||
| 447 | |||
| 448 | return $this;  | 
            ||
| 449 | }  | 
            ||
| 450 | |||
| 451 | |||
| 452 | /**  | 
            ||
| 453 | * @return bool  | 
            ||
| 454 | */  | 
            ||
| 455 | public function hasUri()  | 
            ||
| 458 | }  | 
            ||
| 459 | |||
| 460 | |||
| 461 | /**  | 
            ||
| 462 | * @return array  | 
            ||
| 463 | */  | 
            ||
| 464 | protected function getElements(): array  | 
            ||
| 465 |     { | 
            ||
| 466 | return array (  | 
            ||
| 467 | 'description' =>  | 
            ||
| 468 | array (  | 
            ||
| 469 | 'name' => 'description',  | 
            ||
| 470 | 'allownull' => true,  | 
            ||
| 471 | 'default' => '',  | 
            ||
| 568 | ),  | 
            ||
| 569 | );  | 
            ||
| 570 | }  | 
            ||
| 571 | }  | 
            ||
| 572 |