Skip to content

Commit 9bac7bf

Browse files
committed
remove space when object access to member using arrow syntax
1 parent b285c8e commit 9bac7bf

File tree

20 files changed

+44
-44
lines changed

20 files changed

+44
-44
lines changed

01-Factory/02-CreateDependency/Hello.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class Hello
66
public function greeting()
77
{
88
$ko = new Korean;
9-
return $ko -> text();
9+
return $ko->text();
1010
}
1111
}
1212
?>

01-Factory/04-DependencyInjection/Hello.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ class Hello
55

66
public function __construct($obj)
77
{
8-
$this -> korean = $obj;
8+
$this->korean = $obj;
99
}
1010

1111
public function greeting()
1212
{
13-
return $this -> korean -> text();
13+
return $this->korean->text();
1414
}
1515
}
1616

01-Factory/04-DependencyInjection/index.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66

77
$obj = new Hello($korean);
88

9-
echo $obj -> greeting();
9+
echo $obj->greeting();
1010
?>

01-refactoring.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class CustomersController {
4646
```
4747
<h2>Customers</h2>
4848
<ul>
49-
<?php foreach ($this -> customers as $customer): ?>
49+
<?php foreach ($this->customers as $customer): ?>
5050
<li><?= $customer['name'] ?></li>
5151
<?php endforeach; ?>
5252
</ul>
@@ -107,12 +107,12 @@ class CustomersController extends AbstractActionController {
107107
protected $customerRepository;
108108
109109
public function __construct(CustomerRepositoryInterface $repository) {
110-
$this -> $customerRepository = $repository;
110+
$this->$customerRepository = $repository;
111111
}
112112
113113
public function indexAction() {
114114
return [
115-
'users' => $this -> customerRepository -> getAll();
115+
'users' => $this->customerRepository->getAll();
116116
];
117117
}
118118
}

02-Singleton/01-NonResourceShare/index.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ public function greeting()
1414
$obj5 = new Hello;
1515

1616

17-
echo $obj1 -> greeting();
18-
echo $obj2 -> greeting();
19-
echo $obj3 -> greeting();
20-
echo $obj4 -> greeting();
21-
echo $obj5 -> greeting();
17+
echo $obj1->greeting();
18+
echo $obj2->greeting();
19+
echo $obj3->greeting();
20+
echo $obj4->greeting();
21+
echo $obj5->greeting();
2222

2323
?>

02-Singleton/02-GlobalVariableInClass/index.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ public function conf()
1414

1515

1616
$obj = new GlobalVariableSideEffectLisk;
17-
print_r($obj -> conf());
17+
print_r($obj->conf());
1818

1919
?>

02-Singleton/04-CloneInstance/index.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
$obj2 = Config::getInstance();
66
echo "<br>";
77
$obj3 = new Config();
8-
$obj3 -> getInstance();
8+
$obj3->getInstance();
99
echo "<br>";
1010
$obj4 = new Config();
11-
$obj4 -> getInstance();
11+
$obj4->getInstance();
1212

1313
?>

02-Singleton/05-SelfReference/index.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
$obj1 = Config::getInstance();
55
$obj2 = Config::getInstance();
66
$obj3 = new Config();
7-
$obj3 -> getInstance();
7+
$obj3->getInstance();
88
$obj4 = new Config();
9-
$obj4 -> getInstance();
9+
$obj4->getInstance();
1010

1111
?>

02-Singleton/06-ResourceShareStatic/index.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
echo Config::get();
1111

1212
$obj = new Config();
13-
$obj -> set("world<br>");
14-
echo $obj -> get();
13+
$obj->set("world<br>");
14+
echo $obj->get();
1515
echo Config::get();
1616

1717

02-decoupling.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
class UsersController {
2323
public function indexAction() {
2424
$repo = new UserRepository();
25-
$users = $repo -> getAll();
25+
$users = $repo->getAll();
2626
return $users;
2727
}
2828
}

03-Factory.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
class CustomerFactory {
44
protected $accountManagerRepo;
55
public function __construct(AccountManagerRepository $repo) {
6-
$this -> accountManagerRepo = $repo;
6+
$this->accountManagerRepo = $repo;
77
}
88
99
public function createCustomer($name) {
1010
$customer = new Customer();
11-
$customer -> setName($name);
12-
$customer -> setCreditLimit(0);
13-
$customer -> setStatus('pending');
14-
$customer -> setAccountManager(
15-
$this -> accountManagerRepo -> getRandom()
11+
$customer->setName($name);
12+
$customer->setCreditLimit(0);
13+
$customer->setStatus('pending');
14+
$customer->setAccountManager(
15+
$this->accountManagerRepo->getRandom()
1616
);
1717
return $customer;
1818
}
@@ -32,9 +32,9 @@ static factory is made static method only
3232
```
3333
class CustomerFactory {
3434
public static function createCustomer($name) {
35-
$customer -> setName($name);
36-
$customer -> setCreditLimit(0);
37-
$customer -> setStatus('pending');
35+
$customer->setName($name);
36+
$customer->setCreditLimit(0);
37+
$customer->setStatus('pending');
3838
3939
return $customer;
4040
}

03-FactoryMethod/01-Factory/index.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
$fac = new Factory;
66

7-
$pro = $fac -> create();
8-
$pro -> name();
7+
$pro = $fac->create();
8+
$pro->name();
99

1010
?>

03-FactoryMethod/02-abstract/factory.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ abstract class Factory
33
{
44
public final function create()
55
{
6-
return $this -> createProduct();
6+
return $this->createProduct();
77
}
88

99
abstract public function createProduct();

03-FactoryMethod/02-abstract/index.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
$fac = new Factory;
66

7-
$pro = $fac -> create();
8-
$pro -> name();
7+
$pro = $fac->create();
8+
$pro->name();
99

1010
?>
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
public final function create()
33
{
4-
return $this -> createProduct();
4+
return $this->createProduct();
55
}
66

77
?>
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
public final function create()
33
{
4-
return $this -> createProduct();
4+
return $this->createProduct();
55
}
66

77
?>

03-FactoryMethod/05-FactoryExtends/index.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
require "ProductFactory.php";
66

77
$fac = new ProductFactory;
8-
$pro = $fac -> create();
9-
$pro -> name();
8+
$pro = $fac->create();
9+
$pro->name();
1010

1111
?>

03-FactoryMethod/06-FactoryAbstract/Factory.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ abstract class Factory
33
{
44
public final function create($model)
55
{
6-
return $this -> createProduct($model);
6+
return $this->createProduct($model);
77
}
88

99
abstract public function createProduct($model);

03-FactoryMethod/07-parameterizedFactoryMethod.php/Factory.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ abstract class Factory
33
{
44
public final function create($model)
55
{
6-
return $this -> createProduct($model);
6+
return $this->createProduct($model);
77
}
88

99
abstract public function createProduct($model);

03-FactoryMethod/07-parameterizedFactoryMethod.php/index.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
require "ProductFactory.php";
66

77
$fac = new ProductFactory;
8-
$pro = $fac -> create("Apple");
9-
$pro -> name();
8+
$pro = $fac->create("Apple");
9+
$pro->name();
1010

1111
echo "<br>";
1212

13-
$pro = $fac -> create("MS");
14-
$pro -> name();
13+
$pro = $fac->create("MS");
14+
$pro->name();
1515

1616
?>

0 commit comments

Comments
 (0)