1
0
mirror of https://github.com/jupeter/clean-code-php.git synced 2025-09-27 14:38:59 +02:00

Code formatting - add spaces

This commit is contained in:
Piotr Plenik
2017-04-07 12:02:59 +02:00
parent 6c0df98589
commit 2d3bd93bb3

View File

@@ -34,7 +34,7 @@ $ymdstr = $moment->format('y-m-d');
```
**Good**:
```javascript
```php
$currentDate = $moment->format('y-m-d');
```
**[ back to top](#table-of-contents)**
@@ -104,6 +104,7 @@ Explicit is better than implicit.
**Bad:**
```php
$l = ['Austin', 'New York', 'San Francisco'];
foreach($i=0; $i<count($l); $i++) {
oStuff();
doSomeOtherStuff();
@@ -118,6 +119,7 @@ foreach($i=0; $i<count($l); $i++) {
**Good**:
```php
$locations = ['Austin', 'New York', 'San Francisco'];
foreach($i=0; $i<count($locations); $i++) {
$location = $locations[$i];
@@ -645,7 +647,7 @@ just do one thing.
class Airplane {
// ...
public function getCruisingAltitude() {
switch (this.type) {
switch ($this->type) {
case '777':
return $this->getMaxAltitude() - $this->getPassengerCount();
case 'Air Force One':
@@ -1048,6 +1050,7 @@ get into trouble.
```php
class Rectangle {
private $width, $height;
public function __construct() {
$this->width = 0;
$this->height = 0;
@@ -1136,7 +1139,7 @@ class Rectangle extends Shape {
class Square extends Shape {
public function __construct {
parent::__construct();
this.length = 0;
$this->length = 0;
}
public function setLength($length) {
@@ -1500,7 +1503,7 @@ class Employee {
$this->email = $email;
}
setTaxData($ssn, $salary) {
public function setTaxData($ssn, $salary) {
$this->taxData = new EmployeeTaxData($ssn, $salary);
}
// ...