Code Duplication    Length = 10-11 lines in 5 locations

src/Addon/AddonPaths.php 5 locations

@@ 123-133 (lines=11) @@
120
     *
121
     * @return bool
122
     */
123
    public function core()
124
    {
125
        $path = base_path('core');
126
127
        if (!is_dir($path)) {
128
            return false;
129
        }
130
131
        return $this->vendorAddons(glob("{$path}/*", GLOB_ONLYDIR));
132
    }
133
134
    /**
135
     * Return vendor addons of a given type.
136
     *
@@ 158-168 (lines=11) @@
155
     *
156
     * @return bool
157
     */
158
    public function shared()
159
    {
160
        $path = base_path('addons/shared');
161
162
        if (!is_dir($path)) {
163
            return false;
164
        }
165
166
        return $this->vendorAddons(glob("{$path}/*", GLOB_ONLYDIR));
167
    }
168
169
    /**
170
     * Return all application addon paths in a given folder.
171
     *
@@ 174-184 (lines=11) @@
171
     *
172
     * @return bool
173
     */
174
    public function application()
175
    {
176
        $path = base_path('addons/' . $this->application->getReference());
177
178
        if (!is_dir($path)) {
179
            return false;
180
        }
181
182
        return $this->vendorAddons(glob("{$path}/*", GLOB_ONLYDIR));
183
    }
184
185
    /**
186
     * Return paths to testing only addons.
187
     *
@@ 190-199 (lines=10) @@
187
     *
188
     * @return array|bool
189
     */
190
    protected function testing()
191
    {
192
        $path = base_path('vendor/anomaly/streams-platform/addons');
193
194
        if (!is_dir($path) || env('APP_ENV') !== 'testing') {
195
            return false;
196
        }
197
198
        return $this->vendorAddons(glob("{$path}/*", GLOB_ONLYDIR));
199
    }
200
201
    /**
202
     * Return paths to testing only addons.
@@ 206-215 (lines=10) @@
203
     *
204
     * @return array|bool
205
     */
206
    protected function directory($directory)
207
    {
208
        $path = base_path($directory);
209
210
        if (!is_dir($path)) {
211
            return false;
212
        }
213
214
        return $this->vendorAddons(glob("{$path}/*", GLOB_ONLYDIR));
215
    }
216
217
    /**
218
     * Return paths to configured addons.