/** * @param string $from * @param string $to * @return array * @throws InvalidArgumentException */ public function transform($from, $to) { if (WordTransformValidator::isInvalid($from, $to)) { throw new InvalidArgumentException('Invalid the input arguments'); } $graph = $this->buildGraph(); return (new BreadthFirstSearchAlgorithm())->traversal($graph, $from, $to); }
public function testInvalidWords() { $this->assertTrue(WordTransformValidator::isInvalid('гид', 777)); $this->assertTrue(WordTransformValidator::isInvalid('роман', 'рассказ')); }