Code Duplication    Length = 13-13 lines in 2 locations

src/ProjectVersion.php 1 location

@@ 104-116 (lines=13) @@
101
     * Get composer file structure
102
     * @return Object
103
     */
104
    protected function getStructure()
105
    {
106
        if (!$this->structure) {
107
            if (!is_file($this->getComposerPath())) {
108
                throw new \LogicException('composer.json does not exist');
109
            }
110
            $this->structure = json_decode(file_get_contents($this->getComposerPath()));
111
            if (!$this->structure) {
112
                throw new \LogicException('composer.json invalid structure');
113
            }
114
        }
115
        return $this->structure;
116
    }
117
}
118

src/Version.php 1 location

@@ 69-81 (lines=13) @@
66
     * @return Object
67
     * @throws Exception
68
     */
69
    protected function getStructure()
70
    {
71
        if (!$this->structure) {
72
            if (!is_file($this->getComposerPath())) {
73
                throw new Exception('composer.lock does not exist');
74
            }
75
            $this->structure = json_decode(file_get_contents($this->getComposerPath()));
76
            if (!$this->structure) {
77
                throw new Exception('composer.lock invalid structure');
78
            }
79
        }
80
        return $this->structure;
81
    }
82
}
83