@@ 22-56 (lines=35) @@ | ||
19 | /** |
|
20 | * @author GeLo <[email protected]> |
|
21 | */ |
|
22 | class OrderedButtonBuilder extends ButtonBuilder implements OrderedFormConfigBuilderInterface, OrderedFormConfigInterface |
|
23 | { |
|
24 | /** |
|
25 | * @var string|array|null |
|
26 | */ |
|
27 | private $position; |
|
28 | ||
29 | /** |
|
30 | * {@inheritdoc} |
|
31 | */ |
|
32 | public function getPosition() |
|
33 | { |
|
34 | return $this->position; |
|
35 | } |
|
36 | ||
37 | /** |
|
38 | * {@inheritdoc} |
|
39 | */ |
|
40 | public function setPosition($position) |
|
41 | { |
|
42 | if ($this->locked) { |
|
43 | throw new BadMethodCallException('The config builder cannot be modified anymore.'); |
|
44 | } |
|
45 | ||
46 | if (is_string($position) && ($position !== 'first') && ($position !== 'last')) { |
|
47 | throw OrderedConfigurationException::createInvalidStringPosition($this->getName(), $position); |
|
48 | } |
|
49 | ||
50 | if (is_array($position) && !isset($position['before']) && !isset($position['after'])) { |
|
51 | throw OrderedConfigurationException::createInvalidArrayPosition($this->getName(), $position); |
|
52 | } |
|
53 | ||
54 | $this->position = $position; |
|
55 | ||
56 | return $this; |
|
57 | } |
|
58 | } |
|
59 |
@@ 22-56 (lines=35) @@ | ||
19 | /** |
|
20 | * @author GeLo <[email protected]> |
|
21 | */ |
|
22 | class OrderedFormBuilder extends FormBuilder implements OrderedFormConfigBuilderInterface, OrderedFormConfigInterface |
|
23 | { |
|
24 | /** |
|
25 | * @var string|array|null |
|
26 | */ |
|
27 | private $position; |
|
28 | ||
29 | /** |
|
30 | * {@inheritdoc} |
|
31 | */ |
|
32 | public function getPosition() |
|
33 | { |
|
34 | return $this->position; |
|
35 | } |
|
36 | ||
37 | /** |
|
38 | * {@inheritdoc} |
|
39 | */ |
|
40 | public function setPosition($position) |
|
41 | { |
|
42 | if ($this->locked) { |
|
43 | throw new BadMethodCallException('The config builder cannot be modified anymore.'); |
|
44 | } |
|
45 | ||
46 | if (is_string($position) && ($position !== 'first') && ($position !== 'last')) { |
|
47 | throw OrderedConfigurationException::createInvalidStringPosition($this->getName(), $position); |
|
48 | } |
|
49 | ||
50 | if (is_array($position) && !isset($position['before']) && !isset($position['after'])) { |
|
51 | throw OrderedConfigurationException::createInvalidArrayPosition($this->getName(), $position); |
|
52 | } |
|
53 | ||
54 | $this->position = $position; |
|
55 | ||
56 | return $this; |
|
57 | } |
|
58 | } |
|
59 |
@@ 22-56 (lines=35) @@ | ||
19 | /** |
|
20 | * @author GeLo <[email protected]> |
|
21 | */ |
|
22 | class OrderedSubmitButtonBuilder extends SubmitButtonBuilder implements OrderedFormConfigBuilderInterface, OrderedFormConfigInterface |
|
23 | { |
|
24 | /** |
|
25 | * @var string|array|null |
|
26 | */ |
|
27 | private $position; |
|
28 | ||
29 | /** |
|
30 | * {@inheritdoc} |
|
31 | */ |
|
32 | public function getPosition() |
|
33 | { |
|
34 | return $this->position; |
|
35 | } |
|
36 | ||
37 | /** |
|
38 | * {@inheritdoc} |
|
39 | */ |
|
40 | public function setPosition($position) |
|
41 | { |
|
42 | if ($this->locked) { |
|
43 | throw new BadMethodCallException('The config builder cannot be modified anymore.'); |
|
44 | } |
|
45 | ||
46 | if (is_string($position) && ($position !== 'first') && ($position !== 'last')) { |
|
47 | throw OrderedConfigurationException::createInvalidStringPosition($this->getName(), $position); |
|
48 | } |
|
49 | ||
50 | if (is_array($position) && !isset($position['before']) && !isset($position['after'])) { |
|
51 | throw OrderedConfigurationException::createInvalidArrayPosition($this->getName(), $position); |
|
52 | } |
|
53 | ||
54 | $this->position = $position; |
|
55 | ||
56 | return $this; |
|
57 | } |
|
58 | } |
|
59 |