platform/api/symfony/Component/Workflow/Registry.yaml

48 lines
2.4 KiB
YAML
Raw Normal View History

2024-09-02 17:44:11 +00:00
name: Registry
class_comment: "# * @author Fabien Potencier <fabien@symfony.com>\n# * @author Gr\xE9\
goire Pineau <lyrixx@lyrixx.info>"
dependencies:
- name: InvalidArgumentException
type: class
source: Symfony\Component\Workflow\Exception\InvalidArgumentException
- name: WorkflowSupportStrategyInterface
type: class
source: Symfony\Component\Workflow\SupportStrategy\WorkflowSupportStrategyInterface
properties: []
methods:
- name: all
visibility: public
parameters:
- name: subject
comment: "# * @author Fabien Potencier <fabien@symfony.com>\n# * @author Gr\xE9\
goire Pineau <lyrixx@lyrixx.info>\n# */\n# class Registry\n# {\n# private array\
\ $workflows = [];\n# \n# public function addWorkflow(WorkflowInterface $workflow,\
\ WorkflowSupportStrategyInterface $supportStrategy): void\n# {\n# $this->workflows[]\
\ = [$workflow, $supportStrategy];\n# }\n# \n# public function has(object $subject,\
\ ?string $workflowName = null): bool\n# {\n# foreach ($this->workflows as [$workflow,\
\ $supportStrategy]) {\n# if ($this->supports($workflow, $supportStrategy, $subject,\
\ $workflowName)) {\n# return true;\n# }\n# }\n# \n# return false;\n# }\n# \n\
# public function get(object $subject, ?string $workflowName = null): WorkflowInterface\n\
# {\n# $matched = [];\n# \n# foreach ($this->workflows as [$workflow, $supportStrategy])\
\ {\n# if ($this->supports($workflow, $supportStrategy, $subject, $workflowName))\
\ {\n# $matched[] = $workflow;\n# }\n# }\n# \n# if (!$matched) {\n# throw new\
\ InvalidArgumentException(\\sprintf('Unable to find a workflow for class \"%s\"\
.', get_debug_type($subject)));\n# }\n# \n# if (2 <= \\count($matched)) {\n# $names\
\ = array_map(static fn (WorkflowInterface $workflow): string => $workflow->getName(),\
\ $matched);\n# \n# throw new InvalidArgumentException(\\sprintf('Too many workflows\
\ (%s) match this subject (%s); set a different name on each and use the second\
\ (name) argument of this method.', implode(', ', $names), get_debug_type($subject)));\n\
# }\n# \n# return $matched[0];\n# }\n# \n# /**\n# * @return Workflow[]"
- name: supports
visibility: private
parameters:
- name: workflow
- name: supportStrategy
- name: subject
- name: workflowName
comment: null
traits:
- Symfony\Component\Workflow\Exception\InvalidArgumentException
- Symfony\Component\Workflow\SupportStrategy\WorkflowSupportStrategyInterface
interfaces: []