From 82dee2c8eacf8996918ad1f3969e86037dbb2e82 Mon Sep 17 00:00:00 2001 From: Acuster Date: Thu, 27 Sep 2018 18:24:59 +0300 Subject: [PATCH] Added support for available graph names --- src/SM/Factory/AbstractFactory.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/SM/Factory/AbstractFactory.php b/src/SM/Factory/AbstractFactory.php index 37248c7..f195614 100644 --- a/src/SM/Factory/AbstractFactory.php +++ b/src/SM/Factory/AbstractFactory.php @@ -59,7 +59,20 @@ public function get($object, $graph = 'default') $graph )); } - + + /** + * @return array returns available graph names + */ + public function getGraphs() + { + $graphNames = []; + + foreach ($this->configs as $config) { + $graphNames[] = $config['graph']; + } + return $graphNames; + } + /** * {@inheritDoc} */ @@ -84,7 +97,7 @@ public function addConfig(array $config, $graph = 'default') if (!isset($config['class'])) { throw new SMException(sprintf( - 'Index "class" needed for the state machine configuration of graph "%s"', + 'Index "class" needed for the state machine configuration of graph "%s"', $config['graph'] )); }