@@ -1182,40 +1182,40 @@ all of the settings. Making them optional helps prevent having a "fat interface"
11821182** Bad:**
11831183``` php
11841184interface WorkerInterface {
1185- public function work();
1186- public function eat();
1185+ public function work();
1186+ public function eat();
11871187}
11881188
11891189class Worker implements WorkerInterface {
1190- public function work() {
1191- // ....working
1192- }
1193- public function eat() {
1194- // ...... eating in launch break
1195- }
1190+ public function work() {
1191+ // ....working
1192+ }
1193+ public function eat() {
1194+ // ...... eating in launch break
1195+ }
11961196}
11971197
11981198class SuperWorker implements WorkerInterface {
1199- public function work() {
1200- //.... working much more
1201- }
1199+ public function work() {
1200+ //.... working much more
1201+ }
12021202
1203- public function eat() {
1204- //.... eating in launch break
1205- }
1203+ public function eat() {
1204+ //.... eating in launch break
1205+ }
12061206}
12071207
12081208class Manager {
12091209 /** @var WorkerInterface $worker **/
12101210 private $worker;
12111211
12121212 public void setWorker(WorkerInterface $worker) {
1213- $this->worker = $worker;
1214- }
1213+ $this->worker = $worker;
1214+ }
12151215
1216- public function manage() {
1217- $this->worker->work();
1218- }
1216+ public function manage() {
1217+ $this->worker->work();
1218+ }
12191219}
12201220```
12211221
@@ -1225,50 +1225,50 @@ interface WorkerInterface extends FeedableInterface, WorkableInterface {
12251225}
12261226
12271227interface WorkableInterface {
1228- public function work();
1228+ public function work();
12291229}
12301230
12311231interface FeedableInterface {
1232- public function eat();
1232+ public function eat();
12331233}
12341234
12351235class Worker implements WorkableInterface, FeedableInterface {
1236- public function work() {
1237- // ....working
1238- }
1236+ public function work() {
1237+ // ....working
1238+ }
12391239
1240- public function eat() {
1241- //.... eating in launch break
1242- }
1240+ public function eat() {
1241+ //.... eating in launch break
1242+ }
12431243}
12441244
12451245class Robot implements WorkableInterface {
1246- public void work() {
1247- // ....working
1248- }
1246+ public void work() {
1247+ // ....working
1248+ }
12491249}
12501250
12511251class SuperWorker implements WorkerInterface {
1252- public function work() {
1253- //.... working much more
1254- }
1252+ public function work() {
1253+ //.... working much more
1254+ }
12551255
1256- public function eat() {
1257- //.... eating in launch break
1258- }
1256+ public function eat() {
1257+ //.... eating in launch break
1258+ }
12591259}
12601260
12611261class Manager {
12621262 /** @var $worker WorkableInterface **/
1263- private $worker;
1263+ private $worker;
12641264
1265- public function setWorker(WorkableInterface $w) {
1266- $this->worker = $w;
1267- }
1265+ public function setWorker(WorkableInterface $w) {
1266+ $this->worker = $w;
1267+ }
12681268
1269- public function manage() {
1270- $this->worker->work();
1271- }
1269+ public function manage() {
1270+ $this->worker->work();
1271+ }
12721272}
12731273```
12741274** [ ⬆ back to top] ( #table-of-contents ) **
@@ -1309,9 +1309,9 @@ class Manager {
13091309}
13101310
13111311class SuperWorker extends Worker {
1312- public function work() {
1313- //.... working much more
1314- }
1312+ public function work() {
1313+ //.... working much more
1314+ }
13151315}
13161316```
13171317