| Conditions | 1 |
| Paths | 1 |
| Total Lines | 63 |
| Code Lines | 43 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | 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 |
||
| 41 | private function getPropertyData(): array |
||
| 42 | { |
||
| 43 | return [ |
||
| 44 | /* |
||
| 45 | $propertyData = [$operation_id, $category_id, $locality_id, |
||
| 46 | $title, $address, $latitude, $longitude, |
||
| 47 | $price, $price_type]; |
||
| 48 | */ |
||
| 49 | [ |
||
| 50 | $this->getReference('Rent'), |
||
| 51 | $this->getReference('Apartment'), |
||
| 52 | $this->getReference('Miami'), |
||
| 53 | 'Modern one-bedroom apartment in Miami', |
||
| 54 | '1451 Ocean Dr, Miami Beach, FL 33139', |
||
| 55 | '25.785107', '-80.129460', 250, 'day', |
||
| 56 | ], |
||
| 57 | [ |
||
| 58 | $this->getReference('Rent'), |
||
| 59 | $this->getReference('Apartment'), |
||
| 60 | $this->getReference('Miami'), |
||
| 61 | 'Bright and Cheerful alcove studio', |
||
| 62 | '1451 Ocean Dr, Miami Beach, FL 33139', |
||
| 63 | '25.785107', '-80.129460', 200, 'day', |
||
| 64 | ], |
||
| 65 | [ |
||
| 66 | $this->getReference('Rent'), |
||
| 67 | $this->getReference('Penthouse'), |
||
| 68 | $this->getReference('Palm Beach'), |
||
| 69 | 'Stylish two-level penthouse in Palm Beach', |
||
| 70 | '101 Worth Ave, Palm Beach, FL 33480', |
||
| 71 | '26.701320', '-80.033688', 2000, 'mo', |
||
| 72 | ], |
||
| 73 | [ |
||
| 74 | $this->getReference('Rent'), |
||
| 75 | $this->getReference('Apartment'), |
||
| 76 | $this->getReference('Palm Beach'), |
||
| 77 | 'Bright fully furnished 1-bedroom flat on the 2nd floor', |
||
| 78 | '300 S Ocean Blvd, Palm Beach, FL', |
||
| 79 | '26.705007', '-80.033574', 180, 'day', |
||
| 80 | ], |
||
| 81 | [ |
||
| 82 | $this->getReference('Sale'), |
||
| 83 | $this->getReference('Villa'), |
||
| 84 | $this->getReference('Tampa'), |
||
| 85 | 'Beautiful villa for sale in Tampa', |
||
| 86 | '4935 New Providence Ave, Tampa, FL', |
||
| 87 | '27.932255', '-82.533187', 1600, 'sq. foot', |
||
| 88 | ], |
||
| 89 | [ |
||
| 90 | $this->getReference('Rent'), |
||
| 91 | $this->getReference('Apartment'), |
||
| 92 | $this->getReference('Tampa'), |
||
| 93 | 'Furnished renovated 2-bedroom 2-bathroom flat', |
||
| 94 | '5411 Bayshore Blvd, Tampa, FL 33611', |
||
| 95 | '27.885095', '-82.486153', 2200, 'mo', |
||
| 96 | ], |
||
| 97 | [ |
||
| 98 | $this->getReference('Sale'), |
||
| 99 | $this->getReference('Apartment'), |
||
| 100 | $this->getReference('Miami'), |
||
| 101 | 'Interesting two-bedroom apartment for sale', |
||
| 102 | '111 NE 2nd Ave, Miami, FL 33132', |
||
| 103 | '25.775565', '-80.190125', 190000, '', |
||
| 104 | ], |
||
| 132 |