-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #60 from AydinHassan/code-cleanup
Code cleanup
- Loading branch information
Showing
14 changed files
with
331 additions
and
633 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.idea | ||
vendor | ||
#composer.lock | ||
.phpunit.result.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,50 +3,16 @@ | |
namespace AydinHassan\MagentoCoreComposerInstaller; | ||
|
||
use Composer\Util\Filesystem; | ||
use ErrorException; | ||
use RecursiveIteratorIterator; | ||
use RecursiveDirectoryIterator; | ||
|
||
/** | ||
* Class CoreInstaller | ||
* @package AydinHassan\MagentoCoreComposerInstaller | ||
* @author Aydin Hassan <[email protected]> | ||
*/ | ||
class CoreInstaller | ||
{ | ||
|
||
/** | ||
* @var Exclude | ||
*/ | ||
protected $exclude; | ||
|
||
/** | ||
* @var GitIgnore | ||
*/ | ||
protected $gitIgnore; | ||
|
||
/** | ||
* @var Filesystem | ||
*/ | ||
protected $fileSystem; | ||
|
||
/** | ||
* @param Exclude $exclude | ||
* @param GitIgnore $gitIgnore | ||
* @param Filesystem $fileSystem | ||
*/ | ||
public function __construct(Exclude $exclude, GitIgnore $gitIgnore, Filesystem $fileSystem) | ||
public function __construct(private Exclude $exclude, private GitIgnore $gitIgnore, private Filesystem $fileSystem) | ||
{ | ||
$this->exclude = $exclude; | ||
$this->gitIgnore = $gitIgnore; | ||
$this->fileSystem = $fileSystem; | ||
} | ||
|
||
/** | ||
* @param string $source | ||
* @param string $destination | ||
*/ | ||
public function install($source, $destination) | ||
public function install(string $source, string $destination): void | ||
{ | ||
$iterator = $this->getIterator($source, RecursiveIteratorIterator::SELF_FIRST); | ||
foreach ($iterator as $item) { | ||
|
@@ -80,11 +46,7 @@ public function install($source, $destination) | |
} | ||
} | ||
|
||
/** | ||
* @param string $source | ||
* @param string $destination | ||
*/ | ||
public function unInstall($source, $destination) | ||
public function unInstall(string $source, string $destination): void | ||
{ | ||
|
||
$iterator = $this->getIterator($source, RecursiveIteratorIterator::CHILD_FIRST); | ||
|
@@ -115,12 +77,7 @@ public function unInstall($source, $destination) | |
$this->gitIgnore->removeIgnoreDirectories(); | ||
} | ||
|
||
/** | ||
* @param string $source | ||
* @param int $flags | ||
* @return RecursiveIteratorIterator | ||
*/ | ||
public function getIterator($source, $flags) | ||
public function getIterator(string $source, int $flags): RecursiveIteratorIterator | ||
{ | ||
return new RecursiveIteratorIterator( | ||
new RecursiveDirectoryIterator( | ||
|
Oops, something went wrong.