Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit aaa1437

Browse filesBrowse files
committed
feature #21950 [Workflow] Added fluent interface to the DefinitionBuilder (lyrixx)
This PR was merged into the 3.3-dev branch. Discussion ---------- [Workflow] Added fluent interface to the DefinitionBuilder | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - --- It seems more logic to me to have this fluent interface. Commits ------- 4c8963c [Workflow] Added fluent interface to the DefinitionBuilder
2 parents b385ef1 + 4c8963c commit aaa1437
Copy full SHA for aaa1437

File tree

1 file changed

+28
-0
lines changed
Filter options

1 file changed

+28
-0
lines changed

‎src/Symfony/Component/Workflow/DefinitionBuilder.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Workflow/DefinitionBuilder.php
+28Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,31 @@ public function build()
4646

4747
/**
4848
* Clear all data in the builder.
49+
*
50+
* @return $this
4951
*/
5052
public function reset()
5153
{
5254
$this->places = array();
5355
$this->transitions = array();
5456
$this->initialPlace = null;
57+
58+
return $this;
5559
}
5660

61+
/**
62+
* @return $this
63+
*/
5764
public function setInitialPlace($place)
5865
{
5966
$this->initialPlace = $place;
67+
68+
return $this;
6069
}
6170

71+
/**
72+
* @return $this
73+
*/
6274
public function addPlace($place)
6375
{
6476
if (!preg_match('{^[\w\d_-]+$}', $place)) {
@@ -70,27 +82,43 @@ public function addPlace($place)
7082
}
7183

7284
$this->places[$place] = $place;
85+
86+
return $this;
7387
}
7488

89+
/**
90+
* @return $this
91+
*/
7592
public function addPlaces(array $places)
7693
{
7794
foreach ($places as $place) {
7895
$this->addPlace($place);
7996
}
97+
98+
return $this;
8099
}
81100

82101
/**
83102
* @param Transition[] $transitions
103+
*
104+
* @return $this
84105
*/
85106
public function addTransitions(array $transitions)
86107
{
87108
foreach ($transitions as $transition) {
88109
$this->addTransition($transition);
89110
}
111+
112+
return $this;
90113
}
91114

115+
/**
116+
* @return $this
117+
*/
92118
public function addTransition(Transition $transition)
93119
{
94120
$this->transitions[] = $transition;
121+
122+
return $this;
95123
}
96124
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.