Guest User

Untitled

a guest
Jun 22nd, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.29 KB | None | 0 0
  1. <?php
  2. ini_set('display_errors', 1);
  3. ini_set('display_startup_errors', 1);
  4. error_reporting(E_ALL);
  5.  
  6. class Main
  7. {
  8. // Parameters
  9. protected $rule_type;
  10. protected $layer_number;
  11. protected $limiter;
  12. protected $multiplier;
  13. protected $main_client_id;
  14. protected $daterange;
  15. protected $level;
  16. protected $cpc_type;
  17. protected $ruleId;
  18.  
  19. public function ruleType($ruleType)
  20. {
  21. $this->rule_type = $ruleType;
  22. return $this;
  23. }
  24.  
  25. public function layerNumber($layerNumber)
  26. {
  27. $this->layer_number = $layerNumber;
  28. return $this;
  29. }
  30.  
  31. public function limiter($limiter)
  32. {
  33. $this->limiter = $limiter;
  34. return $this;
  35. }
  36.  
  37. public function multiplier($multiplier)
  38. {
  39. $this->multiplier = $multiplier;
  40. return $this;
  41. }
  42.  
  43. public function mainClientId($mainClientId)
  44. {
  45. $this->main_client_id = $mainClientId;
  46. return $this;
  47. }
  48.  
  49. public function dateRange($dateRange)
  50. {
  51. $this->daterange = $dateRange;
  52. return $this;
  53. }
  54.  
  55. public function level($level)
  56. {
  57. $this->level = $level;
  58. return $this;
  59. }
  60.  
  61. public function cpcType($cpcType)
  62. {
  63. $this->cpc_type = $cpcType;
  64. return $this;
  65. }
  66. }
  67.  
  68. class Cpc extends Main
  69. {
  70. public function __construct()
  71. {
  72. echo 'this cpc construct <br>';
  73. }
  74.  
  75. public function generateCpc()
  76. {
  77. echo 'this cpc generated <br>';
  78. echo $this->rule_type;
  79. echo $this->layer_number;
  80. echo $this->limiter;
  81. echo $this->multiplier;
  82. echo $this->main_client_id;
  83. echo $this->daterange;
  84. echo $this->level;
  85. echo $this->cpc_type;
  86. echo $this->ruleId;
  87. echo '<br>';
  88. }
  89. }
  90.  
  91. class Basetable extends Cpc
  92. {
  93. public function __construct()
  94. {
  95. echo 'this basetable construct <br>';
  96. }
  97.  
  98. public function generateBasetable()
  99. {
  100. echo 'this basetable generated <br>';
  101. echo $this->rule_type;
  102. echo $this->layer_number;
  103. echo $this->limiter;
  104. echo $this->multiplier;
  105. echo $this->main_client_id;
  106. echo $this->daterange;
  107. echo $this->level;
  108. echo $this->cpc_type;
  109. echo $this->ruleId;
  110. echo '<br>';
  111. }
  112. }
  113.  
  114. class Layer extends Basetable
  115. {
  116. public function __construct()
  117. {
  118. echo 'this layer construct <br>';
  119. }
  120.  
  121. public function generateLayer()
  122. {
  123. echo 'this layer generated <br>';
  124. echo $this->rule_type;
  125. echo $this->layer_number;
  126. echo $this->limiter;
  127. echo $this->multiplier;
  128. echo $this->main_client_id;
  129. echo $this->daterange;
  130. echo $this->level;
  131. echo $this->cpc_type;
  132. echo $this->ruleId;
  133. echo '<br>';
  134. }
  135. }
  136.  
  137. class Master extends Layer
  138. {
  139. public function __construct()
  140. {
  141. echo 'this Master construct <br>';
  142. }
  143.  
  144. public function generate()
  145. {
  146.  
  147. $this->generateCpc();
  148. $this->generateBasetable();
  149. $this->generateLayer();
  150.  
  151. echo 'this master generated <br>';
  152. echo $this->rule_type;
  153. echo $this->layer_number;
  154. echo $this->limiter;
  155. echo $this->multiplier;
  156. echo $this->main_client_id;
  157. echo $this->daterange;
  158. echo $this->level;
  159. echo $this->cpc_type;
  160. echo $this->ruleId;
  161. echo '<br>';
  162. }
  163. }
  164.  
  165.  
  166. $o = new Master();
  167. $o = $o->mainClientId('all')
  168. ->level('layer')
  169. ->ruleType('placement')
  170. ->layerNumber(1)
  171. ->limiter(10)
  172. ->multiplier(1.5)
  173. ->cpcType('last_day')
  174. ->dateRange(20170701)
  175. ->generate();
  176. ?>
  177.  
  178. <?php
  179. class Main
  180. {
  181. }
  182. class Cpc extends Main
  183. {
  184. }
  185. class Basetable extends Cpc
  186. {
  187. }
  188. class Layer extends Basetable
  189. {
  190. }
  191. class Master extends Layer
  192. {
  193. }
  194. ?>
  195.  
  196. <?php
  197. class Main
  198. {
  199. }
  200. class Cpc extends Main
  201. {
  202. public function generateSomething(){
  203.  
  204. }
  205. }
  206. class Basetable extends Main
  207. {
  208. public function generateSomething(){
  209.  
  210. }
  211. }
  212. class Layer extends Main
  213. {
  214. public function generateSomething(){
  215.  
  216. }
  217. }
  218. class Master extends Main
  219. {
  220. $cpc = new Cpc();
  221. $cpc = $cpc->generateSomething();
  222.  
  223. $basetable = new Basetable();
  224. $basetable = $basetable->generateSomething();
  225.  
  226. $layer = new Layer();
  227. $layer = $layer->generateSomething();
  228. }
  229. ?>
Add Comment
Please, Sign In to add comment