Code Duplication    Length = 9-9 lines in 3 locations

src/Parser/ClassParser.php 1 location

@@ 81-89 (lines=9) @@
78
    protected function getDefinitionFromTokens($tokens, $getRecursive = true)
79
    {
80
        // First of all we need a new ClassDefinition to fill
81
        if (is_null($this->currentDefinition)) {
82
            $this->currentDefinition = new ClassDefinition();
83
84
        } elseif (!$this->currentDefinition instanceof ClassDefinition) {
85
            throw new GeneratorException(sprintf(
86
                'The structure definition %s does not seem to be a class definition.',
87
                $this->currentDefinition->getQualifiedName()
88
            ));
89
        }
90
91
        // Save the path of the original definition for later use
92
        $this->currentDefinition->setPath($this->file);

src/Parser/InterfaceParser.php 1 location

@@ 116-124 (lines=9) @@
113
    protected function getDefinitionFromTokens($tokens, $getRecursive = true)
114
    {
115
        // First of all we need a new InterfaceDefinition to fill
116
        if (is_null($this->currentDefinition)) {
117
            $this->currentDefinition = new InterfaceDefinition();
118
119
        } elseif (!$this->currentDefinition instanceof InterfaceDefinition) {
120
            throw new GeneratorException(sprintf(
121
                'The structure definition %s does not seem to be a interface definition.',
122
                $this->currentDefinition->getQualifiedName()
123
            ));
124
        }
125
126
        // Save the path of the original definition for later use
127
        $this->currentDefinition->setPath($this->file);

src/Parser/TraitParser.php 1 location

@@ 89-97 (lines=9) @@
86
    protected function getDefinitionFromTokens($tokens, $getRecursive = false)
87
    {
88
        // First of all we need a new TraitDefinition to fill
89
        if (is_null($this->currentDefinition)) {
90
            $this->currentDefinition = new TraitDefinition();
91
92
        } elseif (!$this->currentDefinition instanceof TraitDefinition) {
93
            throw new GeneratorException(sprintf(
94
                'The structure definition %s does not seem to be a trait definition.',
95
                $this->currentDefinition->getQualifiedName()
96
            ));
97
        }
98
99
        // Save the path of the original definition for later use
100
        $this->currentDefinition->setPath($this->file);