Skip to content

Commit

Permalink
Merge pull request #1 from qlimix/v2
Browse files Browse the repository at this point in the history
V2
  • Loading branch information
frank-q committed Nov 14, 2020
2 parents edbc905 + cb68155 commit 6a9ca39
Show file tree
Hide file tree
Showing 36 changed files with 514 additions and 182 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
language: php

php:
- 7.2
- 7.3
- 7.4
- nightly

matrix:
Expand All @@ -15,6 +14,7 @@ before_script:

script:
- vendor/bin/grumphp run
- vendor/bin/phpunit tests --coverage-clover clover.xml

notifications:
email:
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
### 2.0.0 - 14-11-2020

### Changes
- restructuring object and interfaces

### Dependencies
- update code standard

### Compatibility
- Updated to php >7.4
17 changes: 12 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,31 @@
"description": "Process control interfaces",
"license": "MIT",
"keywords": [
"process",
"manager"
"process"
],
"authors": [
{
"name": "frank",
"email": "frank@qlimix.net"
}
],
"require": {
"php": ">7.4"
},
"require-dev": {
"qlimix/code-standard": "^3.0"
},
"autoload": {
"psr-4": {
"Qlimix\\Process\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Qlimix\\Tests\\Process\\": "tests/"
}
},
"config": {
"sort-packages": true
},
"require-dev": {
"qlimix/code-standard": "^1.0"
}
}
17 changes: 13 additions & 4 deletions grumphp.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
parameters:
git_dir: .
bin_dir: vendor/bin
grumphp:
stop_on_failure: false
ignore_unstaged_changes: false
ascii: ~
ascii:
failed: ~
succeeded: ~
tasks:
phpcs:
phpmd:
Expand All @@ -18,3 +18,12 @@ parameters:
- "public"
- "bin"
- "docs"
psalm:
config: psalm.xml
ignore_patterns: []
no_cache: false
report: ~
output_format: null
threads: 1
triggered_by: ['php']
show_info: false
File renamed without changes.
22 changes: 22 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.4/phpunit.xsd"
backupGlobals="false"
colors="true"
processIsolation="false"
stopOnFailure="false"
bootstrap="vendor/autoload.php"
>
<testsuites>
<testsuite name="Test">
<directory suffix=".php">./tests/</directory>
</testsuite>
</testsuites>

<filter>
<whitelist>
<directory suffix=".php">./src/</directory>
</whitelist>
</filter>
</phpunit>
17 changes: 17 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0"?>
<psalm
totallyTyped="true"
resolveFromConfigFile="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
memoizeMethodCallResults="true"
errorLevel="8"
>
<projectFiles>
<directory name="src" />
<ignoreFiles>
<directory name="vendor" />
</ignoreFiles>
</projectFiles>
</psalm>
37 changes: 37 additions & 0 deletions src/Control/ControlInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php declare(strict_types=1);

namespace Qlimix\Process\Control;

use Qlimix\Process\Control\Exception\ControlException;

interface ControlInterface
{
/**
* @throws ControlException
*/
public function status(): ?Status;

/**
* @throws ControlException
*/
public function start(string $process): int;

/**
* @param string[] $processes
*
* @return int[]
*
* @throws ControlException
*/
public function startMultiple(array $processes): array;

/**
* @throws ControlException
*/
public function stop(int $id): void;

/**
* @throws ControlException
*/
public function stopAll(): void;
}
9 changes: 9 additions & 0 deletions src/Control/Exception/ControlException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php declare(strict_types=1);

namespace Qlimix\Process\Control\Exception;

use Exception;

final class ControlException extends Exception
{
}
34 changes: 34 additions & 0 deletions src/Control/Status.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php declare(strict_types=1);

namespace Qlimix\Process\Control;

final class Status
{
private int $id;

private string $process;

private bool $success;

public function __construct(int $id, string $process, bool $success)
{
$this->id = $id;
$this->process = $process;
$this->success = $success;
}

public function getId(): int
{
return $this->id;
}

public function getProcess(): string
{
return $this->process;
}

public function isSuccess(): bool
{
return $this->success;
}
}
9 changes: 0 additions & 9 deletions src/Exception/ProcessException.php

This file was deleted.

9 changes: 0 additions & 9 deletions src/Exception/ProcessRunnerException.php

This file was deleted.

9 changes: 9 additions & 0 deletions src/Manager/Exception/ManagerException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php declare(strict_types=1);

namespace Qlimix\Process\Manager\Exception;

use Exception;

final class ManagerException extends Exception
{
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php declare(strict_types=1);

namespace Qlimix\Process;
namespace Qlimix\Process\Manager;

use Qlimix\Process\Exception\ProcessException;
use Qlimix\Process\Manager\Exception\ManagerException;

interface ProcessManagerInterface
interface ManagerInterface
{
/**
* @throws ProcessException
* @throws ManagerException
*/
public function maintain(): void;

Expand All @@ -16,7 +16,7 @@ public function stop(): void;
public function continue(): bool;

/**
* @throws ProcessException
* @throws ManagerException
*/
public function initialize(): void;
}
2 changes: 2 additions & 0 deletions src/Output/OutputInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@
interface OutputInterface
{
public function write(string $text): void;

public function writeLine(string $text): void;
}
8 changes: 8 additions & 0 deletions src/Output/StdOutput.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ final class StdOutput implements OutputInterface
* @inheritDoc
*/
public function write(string $text): void
{
echo $text;
}

/**
* @inheritDoc
*/
public function writeLine(string $text): void
{
echo $text.PHP_EOL;
}
Expand Down
43 changes: 0 additions & 43 deletions src/ProcessControlInterface.php

This file was deleted.

15 changes: 0 additions & 15 deletions src/ProcessInterface.php

This file was deleted.

13 changes: 0 additions & 13 deletions src/ProcessRunnerInterface.php

This file was deleted.

0 comments on commit 6a9ca39

Please sign in to comment.