Code Duplication    Length = 8-8 lines in 2 locations

src/StateMachine/StateMachine.php 2 locations

@@ 44-51 (lines=8) @@
41
     */
42
    public function can($transition, array $context = [])
43
    {
44
        if (! isset($this->config['transitions'][$transition])) {
45
            throw new SMException(sprintf(
46
                'Transition "%s" does not exist on object "%s" with graph "%s".',
47
                $transition,
48
                get_class($this->object),
49
                $this->config['graph']
50
            ));
51
        }
52
53
        if (! in_array($this->getState(), $this->config['transitions'][$transition]['from'])) {
54
            return false;
@@ 125-132 (lines=8) @@
122
     */
123
    protected function setState($state)
124
    {
125
        if (! $this->hasState($state)) {
126
            throw new SMException(sprintf(
127
                'Cannot set the state to "%s" to object "%s" with graph "%s" because it is not pre-defined.',
128
                $state,
129
                get_class($this->object),
130
                $this->config['graph']
131
            ));
132
        }
133
134
        $accessor = new PropertyAccessor();
135
        $accessor->setValue($this->object, $this->config['property_path'], $state);