| Conditions | 1 |
| Paths | 1 |
| Total Lines | 381 |
| Code Lines | 263 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 1 | Features | 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 |
||
| 193 | public function provideEndpoints() |
||
| 194 | { |
||
| 195 | $items = array( |
||
| 196 | |||
| 197 | /* --- INVALID TESTS ------------------------------------------- */ |
||
| 198 | |||
| 199 | array('Traffic', 'RuntimeException', array('json' => 'invalid/invalid.json'), |
||
| 200 | array(), array(), array(), array()), |
||
| 201 | array('Traffic', 'RuntimeException', array('xml' => 'invalid/invalid.xml'), |
||
| 202 | array(), array(), array(), array()), |
||
| 203 | |||
| 204 | /* --- V0 TESTS ------------------------------------------------ */ |
||
| 205 | |||
| 206 | array('GlobalRank', null, |
||
| 207 | array( |
||
| 208 | 'json' => 'v0/globalRank/200_google.json', |
||
| 209 | 'xml' => 'v0/globalRank/200_google.xml', |
||
| 210 | ), |
||
| 211 | array('rank' => 2), |
||
| 212 | array(/* no arrays */), |
||
| 213 | array(/* no maps */), |
||
| 214 | array(/* no tuples */), |
||
| 215 | ), |
||
| 216 | |||
| 217 | array('SimilarSites', null, array( |
||
| 218 | 'json' => 'v0/similarSites/200_google.json', |
||
| 219 | 'xml' => 'v0/similarSites/200_google.xml', |
||
| 220 | ), |
||
| 221 | array(/* no values */), |
||
| 222 | array(/* no arrays */), |
||
| 223 | array('similarSites' => array('count' => 20)), |
||
| 224 | array(/* no tuples */), |
||
| 225 | ), |
||
| 226 | |||
| 227 | array('Tagging', null, array( |
||
| 228 | 'json' => 'v0/tagging/200_google.json', |
||
| 229 | 'xml' => 'v0/tagging/200_google.xml', |
||
| 230 | ), |
||
| 231 | array(/* no values */), |
||
| 232 | array(/* no arrays */), |
||
| 233 | array('tags' => array('count' => 10)), |
||
| 234 | array(/* no tuples */), |
||
| 235 | ), |
||
| 236 | |||
| 237 | array('V0WebsiteCategorization', null, array( |
||
| 238 | 'json' => 'v0/websiteCategorization/200_google.json', |
||
| 239 | 'xml' => 'v0/websiteCategorization/200_google.xml', |
||
| 240 | ), |
||
| 241 | array('category' => 'Internet_and_Telecom/Search_Engine'), |
||
| 242 | array(/* no arrays */), |
||
| 243 | array(/* no maps */), |
||
| 244 | array(/* no tuples */), |
||
| 245 | ), |
||
| 246 | |||
| 247 | array('WebsiteCategoryRank', null, array( |
||
| 248 | 'json' => 'v0/websiteCategoryRank/200_google.json', |
||
| 249 | 'xml' => 'v0/websiteCategoryRank/200_google.xml', |
||
| 250 | ), |
||
| 251 | array( |
||
| 252 | 'category' => 'Internet_and_Telecom/Search_Engine', |
||
| 253 | 'rank' => 1, |
||
| 254 | ), |
||
| 255 | array(/* no arrays */), |
||
| 256 | array(/* no maps */), |
||
| 257 | array(/* no tuples */), |
||
| 258 | ), |
||
| 259 | |||
| 260 | array('WebsiteCountryRank', null, array( |
||
| 261 | 'json' => 'v0/websiteCountryRanking/200_google.json', |
||
| 262 | 'xml' => 'v0/websiteCountryRanking/200_google.xml', |
||
| 263 | ), |
||
| 264 | array(/* no values */), |
||
| 265 | array(/* no arrays */), |
||
| 266 | array('topCountryRanks' => array('count' => 5)), |
||
| 267 | array(/* no tuples */), |
||
| 268 | ), |
||
| 269 | |||
| 270 | /* --- V1 TESTS ------------------------------------------------ */ |
||
| 271 | |||
| 272 | array('Traffic', null, |
||
| 273 | array( |
||
| 274 | 'json' => 'v1/traffic/200_google.json', |
||
| 275 | 'xml' => 'v1/traffic/200_google.xml', |
||
| 276 | ), |
||
| 277 | array( |
||
| 278 | 'globalRank' => 2, |
||
| 279 | 'countryRank' => 1, |
||
| 280 | 'countryCode' => 840, |
||
| 281 | 'date' => '12/2013', |
||
| 282 | ), |
||
| 283 | array(/* no arrays */), |
||
| 284 | array( |
||
| 285 | 'topCountryShares' => array('count' => 228), |
||
| 286 | 'trafficReach' => array('count' => 27), |
||
| 287 | 'trafficShares' => array('count' => 6), |
||
| 288 | ), |
||
| 289 | array(/* no tuples */), |
||
| 290 | ), |
||
| 291 | |||
| 292 | array('Engagement', null, array( |
||
| 293 | 'json' => 'v1/engagement/200_google.json', |
||
| 294 | 'xml' => 'v1/engagement/200_google.xml', |
||
| 295 | ), |
||
| 296 | array( |
||
| 297 | 'averagePageViews' => 10.131644139915386, |
||
| 298 | 'averageTimeOnSite' => 662.9348950744902, |
||
| 299 | 'bounceRate' => 0.2576071545711606, |
||
| 300 | 'date' => '12/2013', |
||
| 301 | ), |
||
| 302 | array(/* no arrays */), |
||
| 303 | array(/* no maps */), |
||
| 304 | array(/* no tuples */), |
||
| 305 | ), |
||
| 306 | |||
| 307 | array('Keywords', null, array( |
||
| 308 | 'json' => 'v1/keywords/200_google.json', |
||
| 309 | 'xml' => 'v1/keywords/200_google.xml', |
||
| 310 | ), |
||
| 311 | array( |
||
| 312 | 'organicSearchShare' => 0.991548209408053, |
||
| 313 | 'paidSearchShare' => 0.008451790591947006, |
||
| 314 | 'startDate' => '10/2013', |
||
| 315 | 'endDate' => '12/2013', |
||
| 316 | ), |
||
| 317 | array( |
||
| 318 | 'topOrganicTerms' => array('count' => 10), |
||
| 319 | 'topPaidTerms' => array('count' => 7), |
||
| 320 | ), |
||
| 321 | array(/* no maps */), |
||
| 322 | array(/* no tuples */), |
||
| 323 | ), |
||
| 324 | |||
| 325 | array('SocialReferrals', null, array( |
||
| 326 | 'json' => 'v1/socialReferrals/200_google.json', |
||
| 327 | 'xml' => 'v1/socialReferrals/200_google.xml', |
||
| 328 | ), |
||
| 329 | array( |
||
| 330 | 'startDate' => '10/2013', |
||
| 331 | 'endDate' => '12/2013', |
||
| 332 | ), |
||
| 333 | array(/* no arrays */), |
||
| 334 | array('socialSources' => array('count' => 152)), |
||
| 335 | array(/* no tuples */), |
||
| 336 | ), |
||
| 337 | |||
| 338 | /* --- V2 TESTS ------------------------------------------------ */ |
||
| 339 | |||
| 340 | array('AdultWebsites', null, array( |
||
| 341 | 'json' => 'v2/adultWebsites/200_google.json', |
||
| 342 | 'xml' => 'v2/adultWebsites/200_google.xml', |
||
| 343 | ), |
||
| 344 | array('category' => 'Internet_and_Telecom/Search_Engine'), |
||
| 345 | array(/* no arrays */), |
||
| 346 | array(/* no maps */), |
||
| 347 | array(/* no tuples */), |
||
| 348 | ), |
||
| 349 | array('AdultWebsites', null, array( |
||
| 350 | 'json' => 'v2/adultWebsites/200_sex.json', |
||
| 351 | 'xml' => 'v2/adultWebsites/200_sex.xml', |
||
| 352 | ), |
||
| 353 | array('category' => 'Adult'), |
||
| 354 | array(/* no arrays */), |
||
| 355 | array(/* no maps */), |
||
| 356 | array(/* no tuples */), |
||
| 357 | ), |
||
| 358 | |||
| 359 | array('AlsoVisited', null, array( |
||
| 360 | 'json' => 'v2/alsoVisited/200_google.json', |
||
| 361 | 'xml' => 'v2/alsoVisited/200_google.xml', |
||
| 362 | ), |
||
| 363 | array(/* no values */), |
||
| 364 | array(/* no arrays */), |
||
| 365 | array('alsoVisited' => array('count' => 13)), |
||
| 366 | array(/* no tuples */), |
||
| 367 | ), |
||
| 368 | |||
| 369 | array('CategoryRank', null, array( |
||
| 370 | 'json' => 'v2/categoryRank/200_google.json', |
||
| 371 | 'xml' => 'v2/categoryRank/200_google.xml', |
||
| 372 | ), |
||
| 373 | array( |
||
| 374 | 'category' => 'Internet_and_Telecom/Search_Engine', |
||
| 375 | 'rank' => 1, |
||
| 376 | ), |
||
| 377 | array(/* no arrays */), |
||
| 378 | array(/* no maps */), |
||
| 379 | array(/* no tuples */), |
||
| 380 | ), |
||
| 381 | |||
| 382 | array('Destinations', null, array( |
||
| 383 | 'json' => 'v2/destinations/200_google.json', |
||
| 384 | 'xml' => 'v2/destinations/200_google.xml', |
||
| 385 | ), |
||
| 386 | array('startDate' => '10/2013', 'endDate' => '12/2013'), |
||
| 387 | array('sites' => array('count' => 10)), |
||
| 388 | array(/* no maps */), |
||
| 389 | array(/* no tuples */), |
||
| 390 | ), |
||
| 391 | |||
| 392 | array('EstimatedVisitors', null, array( |
||
| 393 | 'json' => 'v2/estimatedVisitors/200_google.json', |
||
| 394 | 'xml' => 'v2/estimatedVisitors/200_google.xml', |
||
| 395 | ), |
||
| 396 | array('estimatedVisitors' => 8788535663), |
||
| 397 | array(/* no arrays */), |
||
| 398 | array(/* no maps */), |
||
| 399 | array(/* no tuples */), |
||
| 400 | ), |
||
| 401 | |||
| 402 | array('Referrals', null, array( |
||
| 403 | 'json' => 'v2/referrals/200_google.json', |
||
| 404 | 'xml' => 'v2/referrals/200_google.xml', |
||
| 405 | ), |
||
| 406 | array('startDate' => '10/2013', 'endDate' => '12/2013'), |
||
| 407 | array('sites' => array('count' => 10)), |
||
| 408 | array(/* no maps */), |
||
| 409 | array(/* no tuples */), |
||
| 410 | ), |
||
| 411 | |||
| 412 | array('SimilarWebsites', null, array( |
||
| 413 | 'json' => 'v2/similarWebsites/200_google.json', |
||
| 414 | 'xml' => 'v2/similarWebsites/200_google.xml', |
||
| 415 | ), |
||
| 416 | array(/* no values */), |
||
| 417 | array(/* no arrays */), |
||
| 418 | array('similarWebsites' => array('count' => 20)), |
||
| 419 | array(/* no tuples */), |
||
| 420 | ), |
||
| 421 | |||
| 422 | array('WebsiteCategorization', null, array( |
||
| 423 | 'json' => 'v2/websiteCategorization/200_google.json', |
||
| 424 | 'xml' => 'v2/websiteCategorization/200_google.xml', |
||
| 425 | ), |
||
| 426 | array('category' => 'Internet_and_Telecom/Search_Engine'), |
||
| 427 | array(/* no arrays */), |
||
| 428 | array(/* no maps */), |
||
| 429 | array(/* no tuples */), |
||
| 430 | ), |
||
| 431 | |||
| 432 | array('WebsiteTags', null, array( |
||
| 433 | 'json' => 'v2/websiteTags/200_google.json', |
||
| 434 | 'xml' => 'v2/websiteTags/200_google.xml', |
||
| 435 | ), |
||
| 436 | array(/* no values */), |
||
| 437 | array(/* no arrays */), |
||
| 438 | array('tags' => array('count' => 10)), |
||
| 439 | array(/* no tuples */), |
||
| 440 | ), |
||
| 441 | |||
| 442 | /* --- V1 PRO TESTS -------------------------------------------- */ |
||
| 443 | |||
| 444 | array('TrafficPro', null, array( |
||
| 445 | 'json' => 'v1pro/traffic/200_google.json', |
||
| 446 | 'xml' => 'v1pro/traffic/200_google.xml', |
||
| 447 | ), |
||
| 448 | array(/* no values */), |
||
| 449 | array(/* no arrays */), |
||
| 450 | array('values' => array('count' => 7)), |
||
| 451 | array(/* no tuples */), |
||
| 452 | ), |
||
| 453 | |||
| 454 | array('EngagementBounceRate', null, array( |
||
| 455 | 'json' => 'v1pro/engagement/bouncerate/200_google.json', |
||
| 456 | 'xml' => 'v1pro/engagement/bouncerate/200_google.xml', |
||
| 457 | ), |
||
| 458 | array(/* no values */), |
||
| 459 | array(/* no arrays */), |
||
| 460 | array('values' => array('count' => 2)), |
||
| 461 | array(/* no tuples */), |
||
| 462 | ), |
||
| 463 | array('EngagementPageViews', null, array( |
||
| 464 | 'json' => 'v1pro/engagement/pageviews/200_google.json', |
||
| 465 | 'xml' => 'v1pro/engagement/pageviews/200_google.xml', |
||
| 466 | ), |
||
| 467 | array(/* no values */), |
||
| 468 | array(/* no arrays */), |
||
| 469 | array('values' => array('count' => 2)), |
||
| 470 | array(/* no tuples */), |
||
| 471 | ), |
||
| 472 | array('EngagementVisitDuration', null, array( |
||
| 473 | 'json' => 'v1pro/engagement/visitduration/200_google.json', |
||
| 474 | 'xml' => 'v1pro/engagement/visitduration/200_google.xml', |
||
| 475 | ), |
||
| 476 | array(/* no values */), |
||
| 477 | array(/* no arrays */), |
||
| 478 | array('values' => array('count' => 2)), |
||
| 479 | array(/* no tuples */), |
||
| 480 | ), |
||
| 481 | |||
| 482 | array('ReferralsPro', null, array( |
||
| 483 | 'json' => 'v1pro/referrals/200_google.json', |
||
| 484 | 'xml' => 'v1pro/referrals/200_google.xml', |
||
| 485 | ), |
||
| 486 | array('results' => 10, 'total' => 1058), |
||
| 487 | array(/* no arrays */), |
||
| 488 | array(/* no maps */), |
||
| 489 | array('sites' => array('count' => 10)), |
||
| 490 | ), |
||
| 491 | |||
| 492 | array('KeywordsOrganicSearch', null, array( |
||
| 493 | 'json' => 'v1pro/searchKeywords/organic/200_google.json', |
||
| 494 | 'xml' => 'v1pro/searchKeywords/organic/200_google.xml', |
||
| 495 | ), |
||
| 496 | array('results' => 10, 'total' => 35125), |
||
| 497 | array(/* no arrays */), |
||
| 498 | array(/* no maps */), |
||
| 499 | array('terms' => array('count' => 10)), |
||
| 500 | ), |
||
| 501 | array('KeywordsPaidSearch', null, array( |
||
| 502 | 'json' => 'v1pro/searchKeywords/paid/200_google.json', |
||
| 503 | 'xml' => 'v1pro/searchKeywords/paid/200_google.xml', |
||
| 504 | ), |
||
| 505 | array('results' => 10, 'total' => 1412), |
||
| 506 | array(/* no arrays */), |
||
| 507 | array(/* no maps */), |
||
| 508 | array('terms' => array('count' => 10)), |
||
| 509 | ), |
||
| 510 | |||
| 511 | array('KeywordCompetitorsOrganic', null, array( |
||
| 512 | 'json' => 'v1pro/searchCompetitors/organic/200_google.json', |
||
| 513 | 'xml' => 'v1pro/searchCompetitors/organic/200_google.xml', |
||
| 514 | ), |
||
| 515 | array('results' => 10, 'total' => 1435), |
||
| 516 | array(/* no arrays */), |
||
| 517 | array('values' => array('count' => 10)), |
||
| 518 | array(/* no tuples */), |
||
| 519 | ), |
||
| 520 | array('KeywordCompetitorsPaid', null, array( |
||
| 521 | 'json' => 'v1pro/searchCompetitors/paid/200_google.json', |
||
| 522 | 'xml' => 'v1pro/searchCompetitors/paid/200_google.xml', |
||
| 523 | ), |
||
| 524 | array('results' => 10, 'total' => 1680), |
||
| 525 | array(/* no arrays */), |
||
| 526 | array('values' => array('count' => 10)), |
||
| 527 | array(/* no tuples */), |
||
| 528 | ), |
||
| 529 | |||
| 530 | /* --- MOBILE TESTS -------------------------------------------- */ |
||
| 531 | |||
| 532 | array('MobileApp', null, array( |
||
| 533 | 'json' => 'mobile/app/android_gmail.json', |
||
| 534 | 'xml' => 'mobile/app/android_gmail.xml', |
||
| 535 | ), |
||
| 536 | array( |
||
| 537 | 'title' => 'Gmail', |
||
| 538 | 'cover' => 'https://lh5.ggpht.com/jVUU0A5NY5EzMqn9AyakWNb0mUHWAkDTjnnamSGqTiEW9FEqnq4CpIEsi-5U2wzo-eYq=w300', |
||
| 539 | 'author' => 'Google Inc.', |
||
| 540 | 'price' => 'Free', |
||
| 541 | 'mainCategory' => 'Communication', |
||
| 542 | 'mainCategoryId' => 'communication', |
||
| 543 | 'rating' => 4.3047308921813965, |
||
| 544 | ), |
||
| 545 | array(/* no arrays */), |
||
| 546 | array(/* no maps */), |
||
| 547 | array(/* no tuples */), |
||
| 548 | ), |
||
| 549 | array('MobileAppInstalls', null, array( |
||
| 550 | 'json' => 'mobile/installs/android_gmail.json', |
||
| 551 | 'xml' => 'mobile/installs/android_gmail.xml', |
||
| 552 | ), |
||
| 553 | array('min' => 1000000000, 'max' => 5000000000), |
||
| 554 | array(/* no arrays */), |
||
| 555 | array(/* no maps */), |
||
| 556 | array(/* no tuples */), |
||
| 557 | ), |
||
| 558 | array('MobileRelatedApps', null, array( |
||
| 559 | 'json' => 'mobile/relatedApps/200_google.json', |
||
| 560 | 'xml' => 'mobile/relatedApps/200_google.xml', |
||
| 561 | ), |
||
| 562 | array(/* no values */), |
||
| 563 | array(/* no arrays */), |
||
| 564 | array('apps' => array('count' => 101)), |
||
| 565 | array(/* no tuples */), |
||
| 566 | ), |
||
| 567 | |||
| 568 | /* --- END TESTS ----------------------------------------------- */ |
||
| 569 | |||
| 570 | ); |
||
| 571 | |||
| 572 | return $items; |
||
| 573 | } |
||
| 574 | |||
| 593 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.