[Workflow] Added more PHPDoc

This commit is contained in:
Grégoire Pineau 2017-03-28 09:52:43 +02:00
parent da7893a7bf
commit 8f090bca12
1 changed files with 21 additions and 4 deletions

View File

@ -35,14 +35,31 @@ class WorkflowExtension extends \Twig_Extension
);
}
public function canTransition($object, $transition, $name = null)
/**
* Returns true if the transition is enabled.
*
* @param object $subject A subject
* @param string $transitionName A transition
* @param string $name A workflow name
*
* @return bool true if the transition is enabled
*/
public function canTransition($subject, $transitionName, $name = null)
{
return $this->workflowRegistry->get($object, $name)->can($object, $transition);
return $this->workflowRegistry->get($subject, $name)->can($subject, $transitionName);
}
public function getEnabledTransitions($object, $name = null)
/**
* Returns all enabled transitions.
*
* @param object $subject A subject
* @param string $name A workflow name
*
* @return Transition[] All enabled transitions
*/
public function getEnabledTransitions($subject, $name = null)
{
return $this->workflowRegistry->get($object, $name)->getEnabledTransitions($object);
return $this->workflowRegistry->get($subject, $name)->getEnabledTransitions($subject);
}
public function getName()