mirror of
https://github.com/jupeter/clean-code-php.git
synced 2025-10-01 00:16:42 +02:00
Duplicated fixes.
Duplicate variables removed. Variable names updated.
This commit is contained in:
@@ -528,8 +528,6 @@ var_dump($name); // ['Ryan', 'McDermott'];
|
|||||||
|
|
||||||
**Good**:
|
**Good**:
|
||||||
```php
|
```php
|
||||||
$name = 'Ryan McDermott';
|
|
||||||
|
|
||||||
function splitIntoFirstAndLastName($name) {
|
function splitIntoFirstAndLastName($name) {
|
||||||
return preg_split('/ /', $name);
|
return preg_split('/ /', $name);
|
||||||
}
|
}
|
||||||
@@ -970,8 +968,9 @@ your codebase.
|
|||||||
```php
|
```php
|
||||||
class UserSettings {
|
class UserSettings {
|
||||||
private $user;
|
private $user;
|
||||||
|
|
||||||
public function __construct($user) {
|
public function __construct($user) {
|
||||||
$this->user = user;
|
$this->user = $user;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function changeSettings($settings) {
|
public function changeSettings($settings) {
|
||||||
@@ -990,8 +989,9 @@ class UserSettings {
|
|||||||
```php
|
```php
|
||||||
class UserAuth {
|
class UserAuth {
|
||||||
private $user;
|
private $user;
|
||||||
|
|
||||||
public function __construct($user) {
|
public function __construct($user) {
|
||||||
$this->user = user;
|
$this->user = $user;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function verifyCredentials() {
|
public function verifyCredentials() {
|
||||||
@@ -1002,6 +1002,7 @@ class UserAuth {
|
|||||||
|
|
||||||
class UserSettings {
|
class UserSettings {
|
||||||
private $user;
|
private $user;
|
||||||
|
|
||||||
public function __construct($user) {
|
public function __construct($user) {
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
$this->auth = new UserAuth($user);
|
$this->auth = new UserAuth($user);
|
||||||
|
Reference in New Issue
Block a user