@@ -16,7 +16,7 @@ |
||
| 16 | 16 | use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; |
| 17 | 17 | |
| 18 | 18 | // Error reporting |
| 19 | -ini_set('display_errors', 'on'); |
|
| 19 | +ini_set('display_errors', 'on'); |
|
| 20 | 20 | ini_set('error_reporting', E_ALL); |
| 21 | 21 | |
| 22 | 22 | // Set the default timezone if not already set |
@@ -79,7 +79,7 @@ |
||
| 79 | 79 | * @return RequestInterface |
| 80 | 80 | */ |
| 81 | 81 | public function createRequest($method, $uri, $headers=[], $body=null, |
| 82 | - $protocolVersion='1.1') { |
|
| 82 | + $protocolVersion='1.1') { |
|
| 83 | 83 | return $this->messageFactory->createRequest( |
| 84 | 84 | $method, $uri, $headers, $body, $protocolVersion); |
| 85 | 85 | } |
@@ -78,8 +78,8 @@ |
||
| 78 | 78 | * |
| 79 | 79 | * @return RequestInterface |
| 80 | 80 | */ |
| 81 | - public function createRequest($method, $uri, $headers=[], $body=null, |
|
| 82 | - $protocolVersion='1.1') { |
|
| 81 | + public function createRequest($method, $uri, $headers = [], $body = null, |
|
| 82 | + $protocolVersion = '1.1') { |
|
| 83 | 83 | return $this->messageFactory->createRequest( |
| 84 | 84 | $method, $uri, $headers, $body, $protocolVersion); |
| 85 | 85 | } |
@@ -20,33 +20,33 @@ |
||
| 20 | 20 | * @coversDefaultClass \ComponentManager\Component |
| 21 | 21 | */ |
| 22 | 22 | class ComponentTest extends TestCase { |
| 23 | - public function testGetNameParts() { |
|
| 24 | - $component = new Component('type_name', []); |
|
| 25 | - $this->assertEquals(['type', 'name'], $component->getNameParts()); |
|
| 26 | - $this->assertEquals('type', $component->getPluginType()); |
|
| 27 | - $this->assertEquals('name', $component->getPluginName()); |
|
| 28 | - } |
|
| 29 | - |
|
| 30 | - public function testGetVersion() { |
|
| 31 | - $goodPackageRepository = $this->createMock(PackageRepository::class); |
|
| 32 | - $goodPackageRepository->method('satisfiesVersion') |
|
| 33 | - ->willReturn(true); |
|
| 34 | - $badPackageRepository = $this->createMock(PackageRepository::class); |
|
| 35 | - $badPackageRepository->method('satisfiesVersion') |
|
| 36 | - ->willReturn(false); |
|
| 37 | - |
|
| 38 | - $componentVersion = new ComponentVersion( |
|
| 23 | + public function testGetNameParts() { |
|
| 24 | + $component = new Component('type_name', []); |
|
| 25 | + $this->assertEquals(['type', 'name'], $component->getNameParts()); |
|
| 26 | + $this->assertEquals('type', $component->getPluginType()); |
|
| 27 | + $this->assertEquals('name', $component->getPluginName()); |
|
| 28 | + } |
|
| 29 | + |
|
| 30 | + public function testGetVersion() { |
|
| 31 | + $goodPackageRepository = $this->createMock(PackageRepository::class); |
|
| 32 | + $goodPackageRepository->method('satisfiesVersion') |
|
| 33 | + ->willReturn(true); |
|
| 34 | + $badPackageRepository = $this->createMock(PackageRepository::class); |
|
| 35 | + $badPackageRepository->method('satisfiesVersion') |
|
| 36 | + ->willReturn(false); |
|
| 37 | + |
|
| 38 | + $componentVersion = new ComponentVersion( |
|
| 39 | 39 | '2015021800', 'Genesis', ComponentVersion::MATURITY_STABLE, []); |
| 40 | 40 | |
| 41 | - $component = new Component( |
|
| 41 | + $component = new Component( |
|
| 42 | 42 | 'type_name', [$componentVersion], $goodPackageRepository); |
| 43 | - $this->assertEquals( |
|
| 43 | + $this->assertEquals( |
|
| 44 | 44 | $componentVersion, $component->getVersion('2015021800')); |
| 45 | 45 | |
| 46 | - $this->expectException(UnsatisfiedVersionException::class); |
|
| 47 | - $this->expectExceptionCode(UnsatisfiedVersionException::CODE_UNKNOWN_VERSION); |
|
| 48 | - $component = new Component( |
|
| 46 | + $this->expectException(UnsatisfiedVersionException::class); |
|
| 47 | + $this->expectExceptionCode(UnsatisfiedVersionException::CODE_UNKNOWN_VERSION); |
|
| 48 | + $component = new Component( |
|
| 49 | 49 | 'type_name', [$componentVersion], $badPackageRepository); |
| 50 | - $component->getVersion('2015021800'); |
|
| 51 | - } |
|
| 50 | + $component->getVersion('2015021800'); |
|
| 51 | + } |
|
| 52 | 52 | } |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | * |
| 86 | 86 | * @throws VersionControlException |
| 87 | 87 | */ |
| 88 | - public function runCommand(Command $command, $exceptionCode=null) { |
|
| 88 | + public function runCommand(Command $command, $exceptionCode = null) { |
|
| 89 | 89 | $process = $this->createProcess($command->getCommandLine()); |
| 90 | 90 | $process->run(); |
| 91 | 91 | |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | * |
| 160 | 160 | * @codeCoverageIgnore |
| 161 | 161 | */ |
| 162 | - public function fetch($remote=null) { |
|
| 162 | + public function fetch($remote = null) { |
|
| 163 | 163 | $command = new FetchCommand($remote); |
| 164 | 164 | return $this->runCommand( |
| 165 | 165 | $command, VersionControlException::CODE_FETCH_FAILED); |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | * |
| 177 | 177 | * @codeCoverageIgnore |
| 178 | 178 | */ |
| 179 | - public function fetchTags($remote=null) { |
|
| 179 | + public function fetchTags($remote = null) { |
|
| 180 | 180 | $command = new FetchCommand($remote); |
| 181 | 181 | $command->setTags(true); |
| 182 | 182 | return $this->runCommand( |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | * |
| 34 | 34 | * @param string|null $remote |
| 35 | 35 | */ |
| 36 | - public function __construct($remote=null) { |
|
| 36 | + public function __construct($remote = null) { |
|
| 37 | 37 | $this->remote = $remote; |
| 38 | 38 | } |
| 39 | 39 | |
@@ -33,6 +33,7 @@ |
||
| 33 | 33 | * @param HttpClient $httpClient |
| 34 | 34 | * @param Platform $platform |
| 35 | 35 | * @param stdClass $options |
| 36 | + * @return void |
|
| 36 | 37 | */ |
| 37 | 38 | public function __construct(Filesystem $filesystem, HttpClient $httpClient, |
| 38 | 39 | Platform $platform, stdClass $options); |
@@ -16,8 +16,8 @@ |
||
| 16 | 16 | use ComponentManager\Exception\InvalidProjectException; |
| 17 | 17 | use ComponentManager\HttpClient; |
| 18 | 18 | use ComponentManager\Platform\Platform; |
| 19 | -use stdClass; |
|
| 20 | 19 | use Symfony\Component\Filesystem\Filesystem; |
| 20 | +use stdClass; |
|
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | 23 | * Package repository interface. |
@@ -24,6 +24,7 @@ |
||
| 24 | 24 | * Initialiser. |
| 25 | 25 | * |
| 26 | 26 | * @param Filesystem $filesystem |
| 27 | + * @return void |
|
| 27 | 28 | */ |
| 28 | 29 | public function __construct(Filesystem $filesystem); |
| 29 | 30 | |
@@ -66,8 +66,8 @@ |
||
| 66 | 66 | * @param string $packageSource |
| 67 | 67 | * @param stdClass $extra |
| 68 | 68 | */ |
| 69 | - public function __construct($name, $version, $packageRepository=null, |
|
| 70 | - $packageSource=null, stdClass $extra=null) { |
|
| 69 | + public function __construct($name, $version, $packageRepository = null, |
|
| 70 | + $packageSource = null, stdClass $extra = null) { |
|
| 71 | 71 | $this->name = $name; |
| 72 | 72 | $this->version = $version; |
| 73 | 73 | |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | * |
| 138 | 138 | * @return Moodle |
| 139 | 139 | */ |
| 140 | - protected function getMoodle($moodleDirectory=null) { |
|
| 140 | + protected function getMoodle($moodleDirectory = null) { |
|
| 141 | 141 | if ($this->moodle === null) { |
| 142 | 142 | $moodleDirectory = ($moodleDirectory === null) |
| 143 | 143 | ? $this->platform->getWorkingDirectory() : $moodleDirectory; |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | * |
| 157 | 157 | * @return Project |
| 158 | 158 | */ |
| 159 | - protected function getProject($projectFilename=null, $projectLockFilename=null) { |
|
| 159 | + protected function getProject($projectFilename = null, $projectLockFilename = null) { |
|
| 160 | 160 | $workingDirectory = $this->platform->getWorkingDirectory(); |
| 161 | 161 | |
| 162 | 162 | if ($this->project === null) { |