- Done fixing Container build caching and WIP on Picea's asset
This commit is contained in:
1 parent
4dcc7f407e
commit
4c0cddd617
10 files changed
+208
-79
No files matched your search
+23
-4
@@ -71,16 +71,35 @@ class Composer
|
||||
}
|
||||
}
|
||||
|
||||
protected static function readComposerJson(Event $event) : ? array
|
||||
public static function readComposerLock() : false|array
|
||||
{
|
||||
static $content = null;
|
||||
|
||||
$path = static::createPath('composer.lock');
|
||||
|
||||
if (! file_exists($path) ) {
|
||||
throw new \UnexpectedValueException("Composer file 'composer.lock' could not be found within your project's root folder.");
|
||||
}
|
||||
|
||||
return $content ??= file_exists($path) ? json_decode(file_get_contents($path), true) : false;
|
||||
}
|
||||
|
||||
public static function readComposerJson() : false|array
|
||||
{
|
||||
static $content = null;
|
||||
|
||||
$path = static::createPath('composer.json');
|
||||
|
||||
return file_exists($path) ? json_decode(file_get_contents($path), true) : null;
|
||||
if (! file_exists($path) ) {
|
||||
throw new \UnexpectedValueException("Composer file 'composer.json' could not be found within your project's root folder.");
|
||||
}
|
||||
|
||||
return $content ??= file_exists($path) ? json_decode(file_get_contents($path), true) : false;
|
||||
}
|
||||
|
||||
protected static function getNamespaceFromAutoload(Event $event) : ? string
|
||||
{
|
||||
if ( null !== $composerJson = static::readComposerJson($event) ) {
|
||||
if ( false !== $composerJson = static::readComposerJson() ) {
|
||||
if ( $psr4 = $composerJson['autoload']['psr-4'] ?? false ) {
|
||||
foreach($psr4 as $ns => $directory) {
|
||||
if ($directory === 'src/') {
|
||||
@@ -103,6 +122,6 @@ class Composer
|
||||
|
||||
protected static function createPath(... $path) : string
|
||||
{
|
||||
return implode(DIRECTORY_SEPARATOR, array_merge([ $_SERVER['PWD'] ], $path));
|
||||
return implode(DIRECTORY_SEPARATOR, array_merge([ $_SERVER['PWD'] ?? getenv('PROJECT_PATH') ], $path));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user