@@ -18,43 +18,43 @@ |
||
18 | 18 | { |
19 | 19 | |
20 | 20 | |
21 | - /** |
|
22 | - * @return string |
|
23 | - */ |
|
24 | - public function type() |
|
25 | - { |
|
26 | - return CoffeeMaker::BREW_SHARED; |
|
27 | - } |
|
21 | + /** |
|
22 | + * @return string |
|
23 | + */ |
|
24 | + public function type() |
|
25 | + { |
|
26 | + return CoffeeMaker::BREW_SHARED; |
|
27 | + } |
|
28 | 28 | |
29 | 29 | |
30 | - /** |
|
31 | - * @param RecipeInterface $recipe |
|
32 | - * @param array $arguments |
|
33 | - * @return mixed |
|
34 | - */ |
|
35 | - public function brew(RecipeInterface $recipe, $arguments = array()) |
|
36 | - { |
|
37 | - $this->resolveClassAndFilepath($recipe); |
|
38 | - $reflector = $this->injector()->getReflectionClass($recipe->fqcn()); |
|
39 | - $method = $this->resolveInstantiationMethod($reflector); |
|
40 | - switch ($method) { |
|
41 | - case 'instance': |
|
42 | - case 'new_instance': |
|
43 | - case 'new_instance_from_db': |
|
44 | - $service = call_user_func_array( |
|
45 | - array($reflector->getName(), $method), |
|
46 | - $this->injector()->resolveDependencies($recipe, $reflector, $arguments) |
|
47 | - ); |
|
48 | - break; |
|
49 | - case 'newInstance': |
|
50 | - $service = $reflector->newInstance(); |
|
51 | - break; |
|
52 | - case 'newInstanceArgs': |
|
53 | - default: |
|
54 | - $service = $reflector->newInstanceArgs( |
|
55 | - $this->injector()->resolveDependencies($recipe, $reflector, $arguments) |
|
56 | - ); |
|
57 | - } |
|
58 | - return $this->coffeePot()->addService($recipe->identifier(), $service); |
|
59 | - } |
|
30 | + /** |
|
31 | + * @param RecipeInterface $recipe |
|
32 | + * @param array $arguments |
|
33 | + * @return mixed |
|
34 | + */ |
|
35 | + public function brew(RecipeInterface $recipe, $arguments = array()) |
|
36 | + { |
|
37 | + $this->resolveClassAndFilepath($recipe); |
|
38 | + $reflector = $this->injector()->getReflectionClass($recipe->fqcn()); |
|
39 | + $method = $this->resolveInstantiationMethod($reflector); |
|
40 | + switch ($method) { |
|
41 | + case 'instance': |
|
42 | + case 'new_instance': |
|
43 | + case 'new_instance_from_db': |
|
44 | + $service = call_user_func_array( |
|
45 | + array($reflector->getName(), $method), |
|
46 | + $this->injector()->resolveDependencies($recipe, $reflector, $arguments) |
|
47 | + ); |
|
48 | + break; |
|
49 | + case 'newInstance': |
|
50 | + $service = $reflector->newInstance(); |
|
51 | + break; |
|
52 | + case 'newInstanceArgs': |
|
53 | + default: |
|
54 | + $service = $reflector->newInstanceArgs( |
|
55 | + $this->injector()->resolveDependencies($recipe, $reflector, $arguments) |
|
56 | + ); |
|
57 | + } |
|
58 | + return $this->coffeePot()->addService($recipe->identifier(), $service); |
|
59 | + } |
|
60 | 60 | } |
@@ -21,23 +21,23 @@ |
||
21 | 21 | class LoadOnlyCoffeeMaker extends CoffeeMaker |
22 | 22 | { |
23 | 23 | |
24 | - /** |
|
25 | - * @return string |
|
26 | - */ |
|
27 | - public function type() |
|
28 | - { |
|
29 | - return CoffeeMaker::BREW_LOAD_ONLY; |
|
30 | - } |
|
24 | + /** |
|
25 | + * @return string |
|
26 | + */ |
|
27 | + public function type() |
|
28 | + { |
|
29 | + return CoffeeMaker::BREW_LOAD_ONLY; |
|
30 | + } |
|
31 | 31 | |
32 | 32 | |
33 | - /** |
|
34 | - * @param RecipeInterface $recipe |
|
35 | - * @param array $arguments |
|
36 | - * @return mixed |
|
37 | - * @throws InvalidClassException |
|
38 | - */ |
|
39 | - public function brew(RecipeInterface $recipe, $arguments = array()) |
|
40 | - { |
|
41 | - return $this->resolveClassAndFilepath($recipe); |
|
42 | - } |
|
33 | + /** |
|
34 | + * @param RecipeInterface $recipe |
|
35 | + * @param array $arguments |
|
36 | + * @return mixed |
|
37 | + * @throws InvalidClassException |
|
38 | + */ |
|
39 | + public function brew(RecipeInterface $recipe, $arguments = array()) |
|
40 | + { |
|
41 | + return $this->resolveClassAndFilepath($recipe); |
|
42 | + } |
|
43 | 43 | } |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | */ |
122 | 122 | protected function setId($id = '') |
123 | 123 | { |
124 | - if (! is_string($id)) { |
|
124 | + if ( ! is_string($id)) { |
|
125 | 125 | throw new InvalidDataTypeException('$id', $id, 'string'); |
126 | 126 | } |
127 | 127 | $this->id = $id; |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | */ |
145 | 145 | protected function setOrder($order = 0) |
146 | 146 | { |
147 | - if (! is_int($order)) { |
|
147 | + if ( ! is_int($order)) { |
|
148 | 148 | throw new InvalidDataTypeException('$order', $order, 'integer'); |
149 | 149 | } |
150 | 150 | $this->order = $order; |
@@ -173,11 +173,11 @@ discard block |
||
173 | 173 | */ |
174 | 174 | protected function setHtmlClass($html_class) |
175 | 175 | { |
176 | - if (! is_string($html_class)) { |
|
176 | + if ( ! is_string($html_class)) { |
|
177 | 177 | throw new InvalidDataTypeException('$html_class', $html_class, 'string'); |
178 | 178 | } |
179 | 179 | if (strpos($html_class, 'progress-step-') === false) { |
180 | - $html_class = 'progress-step-' . $html_class; |
|
180 | + $html_class = 'progress-step-'.$html_class; |
|
181 | 181 | } |
182 | 182 | $this->html_class = $html_class; |
183 | 183 | } |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | */ |
200 | 200 | protected function setText($text) |
201 | 201 | { |
202 | - if (! is_string($text)) { |
|
202 | + if ( ! is_string($text)) { |
|
203 | 203 | throw new InvalidDataTypeException('$text', $text, 'string'); |
204 | 204 | } |
205 | 205 | $this->text = $text; |
@@ -18,190 +18,190 @@ |
||
18 | 18 | { |
19 | 19 | |
20 | 20 | |
21 | - /** |
|
22 | - * @var boolean $current |
|
23 | - */ |
|
24 | - private $current = false; |
|
25 | - |
|
26 | - |
|
27 | - /** |
|
28 | - * @var boolean $completed |
|
29 | - */ |
|
30 | - private $completed = false; |
|
31 | - |
|
32 | - |
|
33 | - /** |
|
34 | - * @var string $html_class |
|
35 | - */ |
|
36 | - private $html_class; |
|
37 | - |
|
38 | - /** |
|
39 | - * @var string $id |
|
40 | - */ |
|
41 | - private $id = ''; |
|
42 | - |
|
43 | - /** |
|
44 | - * @var int $order |
|
45 | - */ |
|
46 | - private $order = 0; |
|
47 | - |
|
48 | - /** |
|
49 | - * @var string $text |
|
50 | - */ |
|
51 | - private $text = ''; |
|
52 | - |
|
53 | - |
|
54 | - /** |
|
55 | - * ProgressStep constructor |
|
56 | - * |
|
57 | - * @param int $order |
|
58 | - * @param string $id |
|
59 | - * @param string $html_class |
|
60 | - * @param string $text |
|
61 | - * @throws InvalidDataTypeException |
|
62 | - */ |
|
63 | - public function __construct($order, $id, $html_class, $text) |
|
64 | - { |
|
65 | - $this->setOrder($order); |
|
66 | - $this->setId($id); |
|
67 | - $this->setHtmlClass($html_class); |
|
68 | - $this->setText($text); |
|
69 | - } |
|
70 | - |
|
71 | - |
|
72 | - /** |
|
73 | - * @return boolean |
|
74 | - */ |
|
75 | - public function isCurrent() |
|
76 | - { |
|
77 | - return $this->current; |
|
78 | - } |
|
79 | - |
|
80 | - |
|
81 | - /** |
|
82 | - * @param boolean $current |
|
83 | - */ |
|
84 | - public function setIsCurrent($current = true) |
|
85 | - { |
|
86 | - $this->current = filter_var($current, FILTER_VALIDATE_BOOLEAN); |
|
87 | - } |
|
88 | - |
|
89 | - |
|
90 | - /** |
|
91 | - * @return boolean |
|
92 | - */ |
|
93 | - public function isCompleted() |
|
94 | - { |
|
95 | - return $this->completed; |
|
96 | - } |
|
97 | - |
|
98 | - |
|
99 | - /** |
|
100 | - * @param boolean $completed |
|
101 | - */ |
|
102 | - public function setIsCompleted($completed = true) |
|
103 | - { |
|
104 | - $this->completed = filter_var($completed, FILTER_VALIDATE_BOOLEAN); |
|
105 | - } |
|
106 | - |
|
107 | - |
|
108 | - /** |
|
109 | - * @return string |
|
110 | - */ |
|
111 | - public function id() |
|
112 | - { |
|
113 | - return $this->id; |
|
114 | - } |
|
115 | - |
|
116 | - |
|
117 | - /** |
|
118 | - * @access protected |
|
119 | - * @param string $id |
|
120 | - * @throws InvalidDataTypeException |
|
121 | - */ |
|
122 | - protected function setId($id = '') |
|
123 | - { |
|
124 | - if (! is_string($id)) { |
|
125 | - throw new InvalidDataTypeException('$id', $id, 'string'); |
|
126 | - } |
|
127 | - $this->id = $id; |
|
128 | - } |
|
129 | - |
|
130 | - |
|
131 | - /** |
|
132 | - * @return int |
|
133 | - */ |
|
134 | - public function order() |
|
135 | - { |
|
136 | - return $this->order; |
|
137 | - } |
|
138 | - |
|
139 | - |
|
140 | - /** |
|
141 | - * @access protected |
|
142 | - * @param int $order |
|
143 | - * @throws InvalidDataTypeException |
|
144 | - */ |
|
145 | - protected function setOrder($order = 0) |
|
146 | - { |
|
147 | - if (! is_int($order)) { |
|
148 | - throw new InvalidDataTypeException('$order', $order, 'integer'); |
|
149 | - } |
|
150 | - $this->order = $order; |
|
151 | - } |
|
152 | - |
|
153 | - |
|
154 | - /** |
|
155 | - * @return string |
|
156 | - */ |
|
157 | - public function htmlClass() |
|
158 | - { |
|
159 | - $html_class = $this->html_class; |
|
160 | - if ($this->isCurrent()) { |
|
161 | - $html_class .= ' progress-step-active'; |
|
162 | - } elseif ($this->isCompleted()) { |
|
163 | - $html_class .= ' progress-step-completed'; |
|
164 | - } |
|
165 | - return $html_class; |
|
166 | - } |
|
167 | - |
|
168 | - |
|
169 | - /** |
|
170 | - * @access protected |
|
171 | - * @param string $html_class |
|
172 | - * @throws InvalidDataTypeException |
|
173 | - */ |
|
174 | - protected function setHtmlClass($html_class) |
|
175 | - { |
|
176 | - if (! is_string($html_class)) { |
|
177 | - throw new InvalidDataTypeException('$html_class', $html_class, 'string'); |
|
178 | - } |
|
179 | - if (strpos($html_class, 'progress-step-') === false) { |
|
180 | - $html_class = 'progress-step-' . $html_class; |
|
181 | - } |
|
182 | - $this->html_class = $html_class; |
|
183 | - } |
|
184 | - |
|
185 | - |
|
186 | - /** |
|
187 | - * @return string |
|
188 | - */ |
|
189 | - public function text() |
|
190 | - { |
|
191 | - return $this->text; |
|
192 | - } |
|
193 | - |
|
194 | - |
|
195 | - /** |
|
196 | - * @access protected |
|
197 | - * @param string $text |
|
198 | - * @throws InvalidDataTypeException |
|
199 | - */ |
|
200 | - protected function setText($text) |
|
201 | - { |
|
202 | - if (! is_string($text)) { |
|
203 | - throw new InvalidDataTypeException('$text', $text, 'string'); |
|
204 | - } |
|
205 | - $this->text = $text; |
|
206 | - } |
|
21 | + /** |
|
22 | + * @var boolean $current |
|
23 | + */ |
|
24 | + private $current = false; |
|
25 | + |
|
26 | + |
|
27 | + /** |
|
28 | + * @var boolean $completed |
|
29 | + */ |
|
30 | + private $completed = false; |
|
31 | + |
|
32 | + |
|
33 | + /** |
|
34 | + * @var string $html_class |
|
35 | + */ |
|
36 | + private $html_class; |
|
37 | + |
|
38 | + /** |
|
39 | + * @var string $id |
|
40 | + */ |
|
41 | + private $id = ''; |
|
42 | + |
|
43 | + /** |
|
44 | + * @var int $order |
|
45 | + */ |
|
46 | + private $order = 0; |
|
47 | + |
|
48 | + /** |
|
49 | + * @var string $text |
|
50 | + */ |
|
51 | + private $text = ''; |
|
52 | + |
|
53 | + |
|
54 | + /** |
|
55 | + * ProgressStep constructor |
|
56 | + * |
|
57 | + * @param int $order |
|
58 | + * @param string $id |
|
59 | + * @param string $html_class |
|
60 | + * @param string $text |
|
61 | + * @throws InvalidDataTypeException |
|
62 | + */ |
|
63 | + public function __construct($order, $id, $html_class, $text) |
|
64 | + { |
|
65 | + $this->setOrder($order); |
|
66 | + $this->setId($id); |
|
67 | + $this->setHtmlClass($html_class); |
|
68 | + $this->setText($text); |
|
69 | + } |
|
70 | + |
|
71 | + |
|
72 | + /** |
|
73 | + * @return boolean |
|
74 | + */ |
|
75 | + public function isCurrent() |
|
76 | + { |
|
77 | + return $this->current; |
|
78 | + } |
|
79 | + |
|
80 | + |
|
81 | + /** |
|
82 | + * @param boolean $current |
|
83 | + */ |
|
84 | + public function setIsCurrent($current = true) |
|
85 | + { |
|
86 | + $this->current = filter_var($current, FILTER_VALIDATE_BOOLEAN); |
|
87 | + } |
|
88 | + |
|
89 | + |
|
90 | + /** |
|
91 | + * @return boolean |
|
92 | + */ |
|
93 | + public function isCompleted() |
|
94 | + { |
|
95 | + return $this->completed; |
|
96 | + } |
|
97 | + |
|
98 | + |
|
99 | + /** |
|
100 | + * @param boolean $completed |
|
101 | + */ |
|
102 | + public function setIsCompleted($completed = true) |
|
103 | + { |
|
104 | + $this->completed = filter_var($completed, FILTER_VALIDATE_BOOLEAN); |
|
105 | + } |
|
106 | + |
|
107 | + |
|
108 | + /** |
|
109 | + * @return string |
|
110 | + */ |
|
111 | + public function id() |
|
112 | + { |
|
113 | + return $this->id; |
|
114 | + } |
|
115 | + |
|
116 | + |
|
117 | + /** |
|
118 | + * @access protected |
|
119 | + * @param string $id |
|
120 | + * @throws InvalidDataTypeException |
|
121 | + */ |
|
122 | + protected function setId($id = '') |
|
123 | + { |
|
124 | + if (! is_string($id)) { |
|
125 | + throw new InvalidDataTypeException('$id', $id, 'string'); |
|
126 | + } |
|
127 | + $this->id = $id; |
|
128 | + } |
|
129 | + |
|
130 | + |
|
131 | + /** |
|
132 | + * @return int |
|
133 | + */ |
|
134 | + public function order() |
|
135 | + { |
|
136 | + return $this->order; |
|
137 | + } |
|
138 | + |
|
139 | + |
|
140 | + /** |
|
141 | + * @access protected |
|
142 | + * @param int $order |
|
143 | + * @throws InvalidDataTypeException |
|
144 | + */ |
|
145 | + protected function setOrder($order = 0) |
|
146 | + { |
|
147 | + if (! is_int($order)) { |
|
148 | + throw new InvalidDataTypeException('$order', $order, 'integer'); |
|
149 | + } |
|
150 | + $this->order = $order; |
|
151 | + } |
|
152 | + |
|
153 | + |
|
154 | + /** |
|
155 | + * @return string |
|
156 | + */ |
|
157 | + public function htmlClass() |
|
158 | + { |
|
159 | + $html_class = $this->html_class; |
|
160 | + if ($this->isCurrent()) { |
|
161 | + $html_class .= ' progress-step-active'; |
|
162 | + } elseif ($this->isCompleted()) { |
|
163 | + $html_class .= ' progress-step-completed'; |
|
164 | + } |
|
165 | + return $html_class; |
|
166 | + } |
|
167 | + |
|
168 | + |
|
169 | + /** |
|
170 | + * @access protected |
|
171 | + * @param string $html_class |
|
172 | + * @throws InvalidDataTypeException |
|
173 | + */ |
|
174 | + protected function setHtmlClass($html_class) |
|
175 | + { |
|
176 | + if (! is_string($html_class)) { |
|
177 | + throw new InvalidDataTypeException('$html_class', $html_class, 'string'); |
|
178 | + } |
|
179 | + if (strpos($html_class, 'progress-step-') === false) { |
|
180 | + $html_class = 'progress-step-' . $html_class; |
|
181 | + } |
|
182 | + $this->html_class = $html_class; |
|
183 | + } |
|
184 | + |
|
185 | + |
|
186 | + /** |
|
187 | + * @return string |
|
188 | + */ |
|
189 | + public function text() |
|
190 | + { |
|
191 | + return $this->text; |
|
192 | + } |
|
193 | + |
|
194 | + |
|
195 | + /** |
|
196 | + * @access protected |
|
197 | + * @param string $text |
|
198 | + * @throws InvalidDataTypeException |
|
199 | + */ |
|
200 | + protected function setText($text) |
|
201 | + { |
|
202 | + if (! is_string($text)) { |
|
203 | + throw new InvalidDataTypeException('$text', $text, 'string'); |
|
204 | + } |
|
205 | + $this->text = $text; |
|
206 | + } |
|
207 | 207 | } |
@@ -17,13 +17,13 @@ |
||
17 | 17 | class ProgressStepCollection extends Collection |
18 | 18 | { |
19 | 19 | |
20 | - /** |
|
21 | - * ProgressStepCollection constructor. |
|
22 | - * |
|
23 | - * @throws \EventEspresso\core\exceptions\InvalidInterfaceException |
|
24 | - */ |
|
25 | - public function __construct() |
|
26 | - { |
|
27 | - parent::__construct('\EventEspresso\core\services\progress_steps\ProgressStepInterface'); |
|
28 | - } |
|
20 | + /** |
|
21 | + * ProgressStepCollection constructor. |
|
22 | + * |
|
23 | + * @throws \EventEspresso\core\exceptions\InvalidInterfaceException |
|
24 | + */ |
|
25 | + public function __construct() |
|
26 | + { |
|
27 | + parent::__construct('\EventEspresso\core\services\progress_steps\ProgressStepInterface'); |
|
28 | + } |
|
29 | 29 | } |
@@ -14,19 +14,19 @@ |
||
14 | 14 | { |
15 | 15 | |
16 | 16 | |
17 | - /** |
|
18 | - * @var LoaderDecoratorInterface $loader |
|
19 | - */ |
|
20 | - protected $loader; |
|
17 | + /** |
|
18 | + * @var LoaderDecoratorInterface $loader |
|
19 | + */ |
|
20 | + protected $loader; |
|
21 | 21 | |
22 | 22 | |
23 | - /** |
|
24 | - * LoaderDecorator constructor. |
|
25 | - * |
|
26 | - * @param LoaderDecoratorInterface $loader |
|
27 | - */ |
|
28 | - public function __construct(LoaderDecoratorInterface $loader) |
|
29 | - { |
|
30 | - $this->loader = $loader; |
|
31 | - } |
|
23 | + /** |
|
24 | + * LoaderDecorator constructor. |
|
25 | + * |
|
26 | + * @param LoaderDecoratorInterface $loader |
|
27 | + */ |
|
28 | + public function __construct(LoaderDecoratorInterface $loader) |
|
29 | + { |
|
30 | + $this->loader = $loader; |
|
31 | + } |
|
32 | 32 | } |
@@ -17,43 +17,43 @@ |
||
17 | 17 | abstract class Locator implements LocatorInterface, Countable |
18 | 18 | { |
19 | 19 | |
20 | - /** |
|
21 | - * @var array $flags |
|
22 | - */ |
|
23 | - protected $flags = array(); |
|
24 | - |
|
25 | - |
|
26 | - /** |
|
27 | - * FileLocator constructor. |
|
28 | - * |
|
29 | - * @access public |
|
30 | - * @param array $flags controls how files are found and/or file data is returned |
|
31 | - * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
|
32 | - */ |
|
33 | - public function __construct($flags = array()) |
|
34 | - { |
|
35 | - if (empty($flags)) { |
|
36 | - $flags = array( |
|
37 | - FilesystemIterator::SKIP_DOTS, |
|
38 | - FilesystemIterator::UNIX_PATHS, |
|
39 | - FilesystemIterator::CURRENT_AS_PATHNAME, |
|
40 | - ); |
|
41 | - } |
|
42 | - $this->setFlags($flags); |
|
43 | - } |
|
44 | - |
|
45 | - |
|
46 | - /** |
|
47 | - * @see http://php.net/manual/en/class.filesystemiterator.php#filesystemiterator.constants |
|
48 | - * @access public |
|
49 | - * @param array $flags |
|
50 | - * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
|
51 | - */ |
|
52 | - public function setFlags($flags) |
|
53 | - { |
|
54 | - if (! is_array($flags)) { |
|
55 | - throw new InvalidDataTypeException('$flags', $flags, 'array'); |
|
56 | - } |
|
57 | - $this->flags = $flags; |
|
58 | - } |
|
20 | + /** |
|
21 | + * @var array $flags |
|
22 | + */ |
|
23 | + protected $flags = array(); |
|
24 | + |
|
25 | + |
|
26 | + /** |
|
27 | + * FileLocator constructor. |
|
28 | + * |
|
29 | + * @access public |
|
30 | + * @param array $flags controls how files are found and/or file data is returned |
|
31 | + * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
|
32 | + */ |
|
33 | + public function __construct($flags = array()) |
|
34 | + { |
|
35 | + if (empty($flags)) { |
|
36 | + $flags = array( |
|
37 | + FilesystemIterator::SKIP_DOTS, |
|
38 | + FilesystemIterator::UNIX_PATHS, |
|
39 | + FilesystemIterator::CURRENT_AS_PATHNAME, |
|
40 | + ); |
|
41 | + } |
|
42 | + $this->setFlags($flags); |
|
43 | + } |
|
44 | + |
|
45 | + |
|
46 | + /** |
|
47 | + * @see http://php.net/manual/en/class.filesystemiterator.php#filesystemiterator.constants |
|
48 | + * @access public |
|
49 | + * @param array $flags |
|
50 | + * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
|
51 | + */ |
|
52 | + public function setFlags($flags) |
|
53 | + { |
|
54 | + if (! is_array($flags)) { |
|
55 | + throw new InvalidDataTypeException('$flags', $flags, 'array'); |
|
56 | + } |
|
57 | + $this->flags = $flags; |
|
58 | + } |
|
59 | 59 | } |
@@ -51,7 +51,7 @@ |
||
51 | 51 | */ |
52 | 52 | public function setFlags($flags) |
53 | 53 | { |
54 | - if (! is_array($flags)) { |
|
54 | + if ( ! is_array($flags)) { |
|
55 | 55 | throw new InvalidDataTypeException('$flags', $flags, 'array'); |
56 | 56 | } |
57 | 57 | $this->flags = $flags; |
@@ -12,38 +12,38 @@ |
||
12 | 12 | */ |
13 | 13 | class AddressFormatter |
14 | 14 | { |
15 | - // phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
16 | - /** |
|
17 | - * @param string $address |
|
18 | - * @param string $address2 |
|
19 | - * @param string $city |
|
20 | - * @param string $state |
|
21 | - * @param string $zip |
|
22 | - * @param string $country |
|
23 | - * @param string $formatted_address |
|
24 | - * @param string $sub |
|
25 | - * @return mixed |
|
26 | - */ |
|
27 | - protected function parse_formatted_address( |
|
28 | - $address, |
|
29 | - $address2, |
|
30 | - $city, |
|
31 | - $state, |
|
32 | - $zip, |
|
33 | - $country, |
|
34 | - $formatted_address, |
|
35 | - $sub |
|
36 | - ) { |
|
37 | - // swap address part placeholders for the real text |
|
38 | - $formatted_address = str_replace( |
|
39 | - // find |
|
40 | - array('{address}', '{address2}', '{city}', '{state}', '{zip}', '{country}'), |
|
41 | - // replace |
|
42 | - array($address, $address2, $city, $state, $zip, $country), |
|
43 | - // string |
|
44 | - $formatted_address |
|
45 | - ); |
|
46 | - // remove placeholder from start and end, reduce repeating placeholders to singles, then replace with HTML line breaks |
|
47 | - return preg_replace('/%+/', $sub, trim($formatted_address, '%')); |
|
48 | - } |
|
15 | + // phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
16 | + /** |
|
17 | + * @param string $address |
|
18 | + * @param string $address2 |
|
19 | + * @param string $city |
|
20 | + * @param string $state |
|
21 | + * @param string $zip |
|
22 | + * @param string $country |
|
23 | + * @param string $formatted_address |
|
24 | + * @param string $sub |
|
25 | + * @return mixed |
|
26 | + */ |
|
27 | + protected function parse_formatted_address( |
|
28 | + $address, |
|
29 | + $address2, |
|
30 | + $city, |
|
31 | + $state, |
|
32 | + $zip, |
|
33 | + $country, |
|
34 | + $formatted_address, |
|
35 | + $sub |
|
36 | + ) { |
|
37 | + // swap address part placeholders for the real text |
|
38 | + $formatted_address = str_replace( |
|
39 | + // find |
|
40 | + array('{address}', '{address2}', '{city}', '{state}', '{zip}', '{country}'), |
|
41 | + // replace |
|
42 | + array($address, $address2, $city, $state, $zip, $country), |
|
43 | + // string |
|
44 | + $formatted_address |
|
45 | + ); |
|
46 | + // remove placeholder from start and end, reduce repeating placeholders to singles, then replace with HTML line breaks |
|
47 | + return preg_replace('/%+/', $sub, trim($formatted_address, '%')); |
|
48 | + } |
|
49 | 49 | } |
@@ -13,18 +13,18 @@ |
||
13 | 13 | class NullAddressFormatter implements \EEI_Address_Formatter |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * @param string $address |
|
18 | - * @param string $address2 |
|
19 | - * @param string $city |
|
20 | - * @param string $state |
|
21 | - * @param string $zip |
|
22 | - * @param string $country |
|
23 | - * @param string $CNT_ISO |
|
24 | - * @return string |
|
25 | - */ |
|
26 | - public function format($address, $address2, $city, $state, $zip, $country, $CNT_ISO) |
|
27 | - { |
|
28 | - return null; |
|
29 | - } |
|
16 | + /** |
|
17 | + * @param string $address |
|
18 | + * @param string $address2 |
|
19 | + * @param string $city |
|
20 | + * @param string $state |
|
21 | + * @param string $zip |
|
22 | + * @param string $country |
|
23 | + * @param string $CNT_ISO |
|
24 | + * @return string |
|
25 | + */ |
|
26 | + public function format($address, $address2, $city, $state, $zip, $country, $CNT_ISO) |
|
27 | + { |
|
28 | + return null; |
|
29 | + } |
|
30 | 30 | } |
@@ -18,36 +18,36 @@ |
||
18 | 18 | { |
19 | 19 | |
20 | 20 | |
21 | - /** |
|
22 | - * @var LoaderInterface $loader |
|
23 | - */ |
|
24 | - private $loader; |
|
25 | - |
|
26 | - |
|
27 | - /** |
|
28 | - * CommandFactory constructor |
|
29 | - * |
|
30 | - * @param LoaderInterface $loader |
|
31 | - * @throws InvalidDataTypeException |
|
32 | - * @throws InvalidInterfaceException |
|
33 | - * @throws InvalidArgumentException |
|
34 | - */ |
|
35 | - public function __construct(LoaderInterface $loader = null) |
|
36 | - { |
|
37 | - $this->loader = $loader; |
|
38 | - } |
|
39 | - |
|
40 | - |
|
41 | - /** |
|
42 | - * @param string $command_fqcn |
|
43 | - * @param array $arguments |
|
44 | - * @return mixed |
|
45 | - * @throws InvalidArgumentException |
|
46 | - * @throws InvalidDataTypeException |
|
47 | - * @throws InvalidInterfaceException |
|
48 | - */ |
|
49 | - public function getNew($command_fqcn, $arguments = array()) |
|
50 | - { |
|
51 | - return $this->loader->getNew($command_fqcn, $arguments); |
|
52 | - } |
|
21 | + /** |
|
22 | + * @var LoaderInterface $loader |
|
23 | + */ |
|
24 | + private $loader; |
|
25 | + |
|
26 | + |
|
27 | + /** |
|
28 | + * CommandFactory constructor |
|
29 | + * |
|
30 | + * @param LoaderInterface $loader |
|
31 | + * @throws InvalidDataTypeException |
|
32 | + * @throws InvalidInterfaceException |
|
33 | + * @throws InvalidArgumentException |
|
34 | + */ |
|
35 | + public function __construct(LoaderInterface $loader = null) |
|
36 | + { |
|
37 | + $this->loader = $loader; |
|
38 | + } |
|
39 | + |
|
40 | + |
|
41 | + /** |
|
42 | + * @param string $command_fqcn |
|
43 | + * @param array $arguments |
|
44 | + * @return mixed |
|
45 | + * @throws InvalidArgumentException |
|
46 | + * @throws InvalidDataTypeException |
|
47 | + * @throws InvalidInterfaceException |
|
48 | + */ |
|
49 | + public function getNew($command_fqcn, $arguments = array()) |
|
50 | + { |
|
51 | + return $this->loader->getNew($command_fqcn, $arguments); |
|
52 | + } |
|
53 | 53 | } |