Passed
Push — main ( af755d...c6deb1 )
by Dimitri
04:08
created

ComposerScripts::postUpdate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 1
b 0
f 0
1
<?php
2
3
/**
4
 * This file is part of Blitz PHP framework.
5
 *
6
 * (c) 2022 Dimitri Sitchet Tomkeu <[email protected]>
7
 *
8
 * For the full copyright and license information, please view
9
 * the LICENSE file that was distributed with this source code.
10
 */
11
12
namespace BlitzPHP\Initializer;
13
14
/**
15
 * Cette classe est utilisee pour deplacer ou supprimer certains fichiers des packages
16
 * c'est notament le cas avec le helpers de Laravel lors de l'installation d'ignition car ce helpers a la function *env* qui entre en colision avec celle de blitz
17
 *
18
 * @codeCoverageIgnore
19
 *
20
 * @internal
21
 */
22
final class ComposerScripts
23
{
24
    /**
25
     * Cette méthode statique est appelée par Composer après chaque événement de mise à jour,
26
     * exp., `composer install`, `composer update`, `composer remove`.
27
     */
28
    public static function postUpdate()
29
    {
30
        self::removeLaravelHelpers();
31
    }
32
33
    private static function removeLaravelHelpers(): void
34
    {
35
        $file = dirname(__DIR__, 4) . '/illuminate/support/helpers.php';
36
37
        if (file_exists($file)) {
38
            file_put_contents($file, '');
39
        }
40
    }
41
}
42