1 | <?php |
||
2 | |||
3 | namespace CleaniqueCoders\Console\Traits; |
||
4 | |||
5 | trait ComposerTrait |
||
6 | { |
||
7 | /** |
||
8 | * Get the composer command for the environment. |
||
9 | * |
||
10 | * @return string |
||
11 | */ |
||
12 | public function findComposer() |
||
13 | { |
||
14 | if (file_exists(getcwd() . '/composer.phar')) { |
||
15 | return '"' . PHP_BINARY . '" composer.phar'; |
||
16 | } |
||
17 | |||
18 | return 'composer'; |
||
19 | } |
||
20 | |||
21 | /** |
||
22 | * Get Composer Configuration. |
||
23 | * |
||
24 | * @param string $path |
||
25 | * |
||
26 | * @return json |
||
0 ignored issues
–
show
|
|||
27 | */ |
||
28 | public function getComposerConfig($path) |
||
29 | { |
||
30 | $composerJson = file_get_contents($path . DIRECTORY_SEPARATOR . 'composer.json'); |
||
31 | |||
32 | return json_decode($composerJson); |
||
33 | } |
||
34 | |||
35 | /** |
||
36 | * Get Qualified Namespace from Path Given. |
||
37 | * |
||
38 | * @param string $path |
||
39 | * |
||
40 | * @return string |
||
41 | */ |
||
42 | public function getQualifiedNamespaceFromPath($path) |
||
43 | { |
||
44 | $json = $this->getComposerConfig($path); |
||
45 | $qualifiedNamespace = key((array) $json->autoload->{'psr-4'}); |
||
46 | |||
47 | return $qualifiedNamespace; |
||
48 | } |
||
49 | |||
50 | /** |
||
51 | * Install Package Dependencies. |
||
52 | */ |
||
53 | public function composerInstall() |
||
54 | { |
||
55 | if ('testing' != env('APP_ENV')) { |
||
0 ignored issues
–
show
|
|||
56 | exec($this->findComposer() . ' install --no-progress --no-suggest'); |
||
57 | } |
||
58 | } |
||
59 | |||
60 | /** |
||
61 | * UPdate Package Dependencies. |
||
62 | */ |
||
63 | public function composerUpdate() |
||
64 | { |
||
65 | if ('testing' != env('APP_ENV')) { |
||
0 ignored issues
–
show
|
|||
66 | exec($this->findComposer() . ' update --no-progress --no-suggest'); |
||
67 | } |
||
68 | } |
||
69 | |||
70 | /** |
||
71 | * Link local package to target project. |
||
72 | * |
||
73 | * @see http://calebporzio.com/bash-alias-composer-link-use-local-folders-as-composer-dependancies/ |
||
74 | * |
||
75 | * @param string $name |
||
76 | * @param string $pathOrUrl |
||
77 | */ |
||
78 | public function composerLink($name, $pathOrUrl) |
||
79 | { |
||
80 | if ('testing' != env('APP_ENV')) { |
||
0 ignored issues
–
show
|
|||
81 | exec($this->findComposer() . ' config repositories.' . $name . ' \'{"type": "path", "url": "' . $pathOrUrl . '"}\' --file composer.json'); |
||
82 | |||
83 | return true; |
||
84 | } |
||
85 | |||
86 | return false; |
||
87 | } |
||
88 | } |
||
89 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths