Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commitaaa1437

Browse 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 parentsb385ef1 +4c8963c commitaaa1437

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

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

Lines 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
publicfunctionreset()
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
publicfunctionsetInitialPlace($place)
5865
{
5966
$this->initialPlace =$place;
67+
68+
return$this;
6069
}
6170

71+
/**
72+
* @return $this
73+
*/
6274
publicfunctionaddPlace($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
publicfunctionaddPlaces(array$places)
7693
{
7794
foreach ($placesas$place) {
7895
$this->addPlace($place);
7996
}
97+
98+
return$this;
8099
}
81100

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

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp