Skip to content

Commit a3cd432

Browse files
committed
Resolved errors.
1 parent 76d9ba4 commit a3cd432

File tree

5 files changed

+18
-34
lines changed

5 files changed

+18
-34
lines changed

SandersW-LearningPHPDesignPatterns/Factory/GraphicFactory.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
//GraphicFactory.php
1010
include_once('Creator.php');
1111
include_once('GraphicProduct.php');
12+
1213
class GraphicFactory extends Creator {
1314

1415
protected function factoryMethod() {
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
<?php
22
//GraphicProduct.php
33
include_once('Product.php');
4+
45
class GraphicProduct implements Product {
56

67
private $mfgProduct;
8+
79
public function getProperties() {
810
$this->mfgProduct="This is a graphic.<3";
911
return $this->mfgProduct;
1012
}
11-
1213
}
Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
<?php
2-
//TextProduct.php
3-
include_once('Product.php');
4-
class TextProduct implements Product {
5-
6-
private $mfgProduct;
7-
public function getProperties()
8-
{
9-
$this->mfgProduct="This is text.";
10-
return $this->mfgProduct;
11-
}
2+
//Product.php
3+
interface Product {
124

5+
public function getProperties();
136
}
Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
11
<?php
22

3-
/*
4-
* To change this license header, choose License Headers in Project Properties.
5-
* To change this template file, choose Tools | Templates
6-
* and open the template in the editor.
7-
*/
8-
3+
//TextFactory.php
94
include_once('Creator.php');
105
include_once('TextProduct.php');
116

127
class TextFactory extends Creator {
138

149
protected function factoryMethod() {
15-
$product=new TextProduct();
16-
return($product->getProperties());
10+
$product=new TextProduct();
11+
return($product->getProperties());
1712
}
1813

19-
}
20-
14+
}
Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
11
<?php
22

3-
/*
4-
* To change this license header, choose License Headers in Project Properties.
5-
* To change this template file, choose Tools | Templates
6-
* and open the template in the editor.
7-
*/
3+
//TextProduct.php
4+
include_once('Product.php');
85

9-
include_once('Creator.php');
10-
include_once('TextProduct.php');
6+
class TextProduct implements Product {
117

12-
class TextFactory extends Creator {
8+
private $mfgProduct;
139

14-
protected function factoryMethod() {
15-
$product=new TextProduct();
16-
return($product->getProperties());
10+
public function getProperties() {
11+
$this->mfgProduct="This is text.";
12+
return $this->mfgProduct;
1713
}
1814

19-
}
20-
15+
}

0 commit comments

Comments
 (0)