Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature/add-currently-installed-package-versions #17

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/Decomposer.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,16 @@ public static function getComposerArray()

public static function getPackagesAndDependencies($packagesArray)
{
$packageLockDetails = [];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spaces must be used to indent lines; tabs are not allowed

if(file_exists(base_path('composer.lock'))) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Spaces must be used to indent lines; tabs are not allowed
  • Expected 1 space after IF keyword; 0 found

$lockFile = json_decode(file_get_contents(base_path('composer.lock')));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spaces must be used to indent lines; tabs are not allowed


$packageLockDetails = [];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spaces must be used to indent lines; tabs are not allowed

foreach ($lockFile->packages as $package) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spaces must be used to indent lines; tabs are not allowed

$packageLockDetails[$package->name] = $package;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spaces must be used to indent lines; tabs are not allowed

}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spaces must be used to indent lines; tabs are not allowed

}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spaces must be used to indent lines; tabs are not allowed


foreach ($packagesArray as $key => $value) {
$packageFile = base_path("/vendor/{$key}/composer.json");

Expand All @@ -146,7 +156,8 @@ public static function getPackagesAndDependencies($packagesArray)
'name' => $key,
'version' => $value,
'dependencies' => $dependencies,
'dev-dependencies' => $devDependencies
'dev-dependencies' => $devDependencies,
'version-installed' => isset($packageLockDetails[$key]) ? $packageLockDetails[$key] : ""
];
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/views/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,15 @@
<table id="decomposer" class="table table-hover table-bordered">
<thead>
<tr>
<th>Package Name : Version</th>
<th>Package Name : Version : Version Installed</th>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can make this Package name : Required version : Version installed

<th>Dependency Name : Version</th>
</tr>
</thead>
<tbody>

@foreach($packages as $package)
<tr>
<td>{{ $package['name'] }} : <span class="label ld-version-tag">{{ $package['version'] }}</span></td>
<td>{{ $package['name'] }} : <span class="label ld-version-tag">{{ $package['version'] }}</span> : <span class="label ld-version-tag">{{ isset($package['version-installed']->version) ? $package['version-installed']->version : "N/A" }}</span> </td>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on the array above why $package['version-installed']->version I guess $package['version-installed'] should be enough?

<td>
<ul>
@if(is_array($package['dependencies']))
Expand Down