diff --git a/.github/workflows/tag_meged_pull_request.yml b/.github/workflows/tag_meged_pull_request.yml index 044bba3..f26a4df 100644 --- a/.github/workflows/tag_meged_pull_request.yml +++ b/.github/workflows/tag_meged_pull_request.yml @@ -18,7 +18,7 @@ jobs: - name: Set up PHP uses: shivammathur/setup-php@v2 with: - php-version: 8.2 + php-version: 8.3 coverage: xdebug tools: composer:v2 diff --git a/.github/workflows/test_pull_request.yml b/.github/workflows/test_pull_request.yml index b72af4f..d335be9 100644 --- a/.github/workflows/test_pull_request.yml +++ b/.github/workflows/test_pull_request.yml @@ -11,7 +11,7 @@ jobs: - name: Set up PHP uses: shivammathur/setup-php@v2 with: - php-version: 8.2 + php-version: 8.3 tools: composer:v2 - name: Checkout code @@ -52,7 +52,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php: ['8.1', '8.2', '8.3'] + php: ['8.1', '8.2', '8.3', '8.4'] steps: - name: Set up PHP @@ -65,7 +65,7 @@ jobs: - name: Set up Node uses: actions/setup-node@v4 with: - node-version: '14.x' + node-version: '20.x' - name: Checkout code uses: actions/checkout@v4 @@ -88,10 +88,10 @@ jobs: - name: Neon Lint run: ./vendor/nette/neon/bin/neon-lint conf - - name: PHP MD - run: | - ./vendor/bin/phpmd --version - ./vendor/bin/phpmd ./src/ ./examples/ ./tests/ text phpmd.xml + #- name: PHP MD + # run: | + # ./vendor/bin/phpmd --version + # ./vendor/bin/phpmd ./src/ ./examples/ ./tests/ text phpmd.xml - name: PHP Code Sniffer run: | @@ -115,7 +115,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php: ['8.1'] + php: ['8.3'] steps: - name: Set up PHP @@ -128,7 +128,7 @@ jobs: - name: Set up Node uses: actions/setup-node@v4 with: - node-version: '14.x' + node-version: '20.x' - name: Checkout code uses: actions/checkout@v4 diff --git a/.gitignore b/.gitignore index acc428e..2d020d1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /vendor/ composer.lock .php-version +.tool-versions diff --git a/PHP_VERSIONS b/PHP_VERSIONS index 4215b26..75df3c4 100644 --- a/PHP_VERSIONS +++ b/PHP_VERSIONS @@ -1,3 +1,4 @@ +8.4 8.3 8.2 8.1 diff --git a/README.md b/README.md index 72bd4a2..0731c5a 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,11 @@ You can also retrieve parsed data: - PHP 8.1 or later - Imagick PHP Extension + + Check with commands: + ```php + php -i | grep imagick + ``` - Composer ## 4. Installation @@ -544,90 +549,90 @@ Then, run the PHP code. ```bash array(2) { - ["John"]=> - array(6) { - ["count"]=> - int(11) - ["x"]=> - array(5) { - ["Mean"]=> - int(6) - ["Max"]=> - int(11) - ["Min"]=> - int(1) - ["Variance"]=> - int(10) - ["StandardDeviation"]=> - float(3.1622776601683795) - } - ["y"]=> - array(5) { - ["Mean"]=> - int(5) - ["Max"]=> - int(11) - ["Min"]=> - int(1) - ["Variance"]=> - float(10.181818181818182) - ["StandardDeviation"]=> - float(3.1908961408698624) - } - ["Covariance"]=> - float(5.181818181818182) - ["CorrelationCoefficient"]=> - float(0.5135343537364686) - ["RegressionLineFormula"]=> - array(2) { - ["a"]=> - float(0.5181818181818182) - ["b"]=> - float(1.8909090909090907) - } + ["John"]=> + array(6) { + ["count"]=> + int(11) + ["x"]=> + array(5) { + ["Mean"]=> + int(6) + ["Max"]=> + int(11) + ["Min"]=> + int(1) + ["Variance"]=> + int(10) + ["StandardDeviation"]=> + float(3.1622776601683795) + } + ["y"]=> + array(5) { + ["Mean"]=> + int(5) + ["Max"]=> + int(11) + ["Min"]=> + int(1) + ["Variance"]=> + float(10.181818181818182) + ["StandardDeviation"]=> + float(3.1908961408698624) + } + ["Covariance"]=> + float(5.181818181818182) + ["CorrelationCoefficient"]=> + float(0.5135343537364686) + ["RegressionLineFormula"]=> + array(2) { + ["a"]=> + float(0.5181818181818182) + ["b"]=> + float(1.8909090909090907) + } + } + ["Jake"]=> + array(6) { + ["count"]=> + int(11) + ["x"]=> + array(5) { + ["Mean"]=> + int(6) + ["Max"]=> + int(11) + ["Min"]=> + int(1) + ["Variance"]=> + int(10) + ["StandardDeviation"]=> + float(3.1622776601683795) + } + ["y"]=> + array(5) { + ["Mean"]=> + int(6) + ["Max"]=> + int(11) + ["Min"]=> + int(1) + ["Variance"]=> + int(10) + ["StandardDeviation"]=> + float(3.1622776601683795) } - ["Jake"]=> - array(6) { - ["count"]=> - int(11) - ["x"]=> - array(5) { - ["Mean"]=> - int(6) - ["Max"]=> - int(11) - ["Min"]=> - int(1) - ["Variance"]=> - int(10) - ["StandardDeviation"]=> - float(3.1622776601683795) - } - ["y"]=> - array(5) { - ["Mean"]=> - int(6) - ["Max"]=> - int(11) - ["Min"]=> - int(1) - ["Variance"]=> - int(10) - ["StandardDeviation"]=> - float(3.1622776601683795) - } - ["Covariance"]=> - float(-9.454545454545455) - ["CorrelationCoefficient"]=> - float(-0.9454545454545453) - ["RegressionLineFormula"]=> - array(2) { - ["a"]=> - float(-0.9454545454545455) - ["b"]=> - float(11.672727272727274) - } + ["Covariance"]=> + float(-9.454545454545455) + ["CorrelationCoefficient"]=> + float(-0.9454545454545453) + ["RegressionLineFormula"]=> + array(2) { + ["a"]=> + float(-0.9454545454545455) + ["b"]=> + float(11.672727272727274) } + } } ``` @@ -659,6 +664,6 @@ Then, run the PHP code. *Document written: 2023/06/06* -*Document updated: 2024/04/18* +*Document updated: 2025/01/04* -Copyright 2023 - 2024 macocci7. +Copyright 2023 - 2025 macocci7. diff --git a/bin/TestAndLint.sh b/bin/TestAndLint.sh index 89c427b..4a3b743 100644 --- a/bin/TestAndLint.sh +++ b/bin/TestAndLint.sh @@ -1,12 +1,11 @@ #!/usr/bin/bash # Script to Test and Lint -# - for the repository: macocci7/php-scatterplot # requirement: -# - phpenv/phpenv +# - https://github.com/jdx/mise installed # - PHP versions defined in ../PHP_VERSIONS installed -CMD=phpenv +CMD=mise $CMD -v &> /dev/null if [ $? -ne 0 ]; then echo "command [${CMD}] not found!" @@ -20,46 +19,13 @@ if [ $? -ne 0 ]; then exit 1 fi -test_and_lint() { +switch_version() { echo "===========================================================" - echo "[PHP $1][phpenv local $1]" - phpenv local $1 - if [ $? -ne 0 ]; then - echo "Failed to switch version to $i. skipped." - return 1 - fi - echo "-----------------------------------------------------------" - echo "[PHP $1][php -v]" - php -v - echo "-----------------------------------------------------------" - echo "[PHP $1][parallel-lint]" - ./vendor/bin/parallel-lint src tests examples - echo "-----------------------------------------------------------" - echo "[PHP $1][neon-lint]" - ./vendor/nette/neon/bin/neon-lint conf - echo "-----------------------------------------------------------" - echo "[PHP $1][phpcs]" - ./vendor/bin/phpcs --ignore=vendor \ - --standard=phpcs.xml \ - -p \ - -s \ - . - echo "-----------------------------------------------------------" - echo "[PHP $1][phpmd]" - ./vendor/bin/phpmd \ - ./src/ ./examples/ ./tests/ text \ - phpmd.xml - echo "-----------------------------------------------------------" - echo "[PHP $1][phpstan]" - ./vendor/bin/phpstan analyze -c phpstan.neon - echo "-----------------------------------------------------------" - echo "[PHP $1][phpunit]" - ./vendor/bin/phpunit ./tests/ \ - --color=auto - echo "-----------------------------------------------------------" + echo "[PHP $1][Switching PHP version to $1]" + mise x php@$1 -- bash bin/TestAndLintSub.sh $1; } -echo "[[TesAndLint.sh]]" +echo "[[TestAndLint.sh]]" SUPPORTED_PHP_VERSIONS=PHP_VERSIONS if [ ! -f $SUPPORTED_PHP_VERSIONS ]; then @@ -74,6 +40,6 @@ if [ ! -r $SUPPORTED_PHP_VERSIONS ]; then fi STR_CMD='' while read version ; do - STR_CMD="$STR_CMD test_and_lint $version;" + STR_CMD="$STR_CMD switch_version $version;" done < $SUPPORTED_PHP_VERSIONS eval $STR_CMD diff --git a/bin/TestAndLintSub.sh b/bin/TestAndLintSub.sh new file mode 100644 index 0000000..28e2d19 --- /dev/null +++ b/bin/TestAndLintSub.sh @@ -0,0 +1,34 @@ +#!/usr/bin/bash + +# Script to Test and Lint +# requirement: +# - PHP versions defined in ../PHP_VERSIONS installed + +echo "-----------------------------------------------------------" +echo "[PHP $1][php -v]" +php -v +echo "-----------------------------------------------------------" +echo "[PHP $1][parallel-lint]" +./vendor/bin/parallel-lint src tests examples +echo "-----------------------------------------------------------" +echo "[PHP $1][neon-lint]" +./vendor/nette/neon/bin/neon-lint conf +echo "-----------------------------------------------------------" +echo "[PHP $1][phpcs]" +./vendor/bin/phpcs --ignore=vendor \ + --standard=phpcs.xml \ + -p \ + -s \ + . +#echo "-----------------------------------------------------------" +#echo "[PHP $1][phpmd]" +#./vendor/bin/phpmd \ +# ./src/ ./examples/ ./tests/ text \ +# phpmd.xml +echo "-----------------------------------------------------------" +echo "[PHP $1][phpstan]" +./vendor/bin/phpstan analyze -c phpstan.neon +echo "-----------------------------------------------------------" +echo "[PHP $1][phpunit]" +./vendor/bin/phpunit ./tests/ +echo "-----------------------------------------------------------" diff --git a/composer.json b/composer.json index 094dc8e..3138b7c 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "macocci7/php-scatterplot", - "description": "it's easy to use for creating scatter plots.", - "version": "1.2.2", + "description": "PHP-Scatterplot is a simple PHP library to create scatter plot easily.", + "version": "1.2.3", "type": "library", "license": "MIT", "autoload": { @@ -18,17 +18,16 @@ "minimum-stability": "stable", "require": { "php": ">=8.1", - "intervention/image": "^3.7", - "macocci7/php-frequency-table": "^1.3", - "macocci7/php-csv": "^1.0", - "macocci7/php-combination": "^1.0", + "intervention/image": "^3.10", + "macocci7/php-frequency-table": "^1.4", + "macocci7/php-csv": "^1.1", + "macocci7/php-combination": "^1.1", "nette/neon": "^3.4" }, "require-dev": { - "squizlabs/php_codesniffer": "^3.7", - "phpmd/phpmd": "^2.15", + "squizlabs/php_codesniffer": "^3.11", "phpunit/phpunit": "^10.5", - "phpstan/phpstan": "^1.11", + "phpstan/phpstan": "^2.1", "php-parallel-lint/php-parallel-lint": "^1.4" } } diff --git a/examples/ParsedData.txt b/examples/ParsedData.txt index 674406b..df79397 100644 --- a/examples/ParsedData.txt +++ b/examples/ParsedData.txt @@ -1,87 +1,86 @@ -/home/macocci7/php/PHP-Scatterplot/examples/ParsedData.php:20: array(2) { - 'John' => + ["John"]=> array(6) { - 'count' => + ["count"]=> int(11) - 'x' => + ["x"]=> array(5) { - 'Mean' => + ["Mean"]=> int(6) - 'Max' => + ["Max"]=> int(11) - 'Min' => + ["Min"]=> int(1) - 'Variance' => + ["Variance"]=> int(10) - 'StandardDeviation' => - double(3.1622776601684) + ["StandardDeviation"]=> + float(3.1622776601683795) } - 'y' => + ["y"]=> array(5) { - 'Mean' => + ["Mean"]=> int(5) - 'Max' => + ["Max"]=> int(11) - 'Min' => + ["Min"]=> int(1) - 'Variance' => - double(10.181818181818) - 'StandardDeviation' => - double(3.1908961408699) + ["Variance"]=> + float(10.181818181818182) + ["StandardDeviation"]=> + float(3.1908961408698624) } - 'Covariance' => - double(5.1818181818182) - 'CorrelationCoefficient' => - double(0.51353435373647) - 'RegressionLineFormula' => + ["Covariance"]=> + float(5.181818181818182) + ["CorrelationCoefficient"]=> + float(0.5135343537364686) + ["RegressionLineFormula"]=> array(2) { - 'a' => - double(0.51818181818182) - 'b' => - double(1.8909090909091) + ["a"]=> + float(0.5181818181818182) + ["b"]=> + float(1.8909090909090907) } } - 'Jake' => + ["Jake"]=> array(6) { - 'count' => + ["count"]=> int(11) - 'x' => + ["x"]=> array(5) { - 'Mean' => + ["Mean"]=> int(6) - 'Max' => + ["Max"]=> int(11) - 'Min' => + ["Min"]=> int(1) - 'Variance' => + ["Variance"]=> int(10) - 'StandardDeviation' => - double(3.1622776601684) + ["StandardDeviation"]=> + float(3.1622776601683795) } - 'y' => + ["y"]=> array(5) { - 'Mean' => + ["Mean"]=> int(6) - 'Max' => + ["Max"]=> int(11) - 'Min' => + ["Min"]=> int(1) - 'Variance' => + ["Variance"]=> int(10) - 'StandardDeviation' => - double(3.1622776601684) + ["StandardDeviation"]=> + float(3.1622776601683795) } - 'Covariance' => - double(-9.4545454545455) - 'CorrelationCoefficient' => - double(-0.94545454545455) - 'RegressionLineFormula' => + ["Covariance"]=> + float(-9.454545454545455) + ["CorrelationCoefficient"]=> + float(-0.9454545454545453) + ["RegressionLineFormula"]=> array(2) { - 'a' => - double(-0.94545454545455) - 'b' => - double(11.672727272727) + ["a"]=> + float(-0.9454545454545455) + ["b"]=> + float(11.672727272727274) } } } diff --git a/examples/img/AdjustDisplayByArray.png b/examples/img/AdjustDisplayByArray.png index 364ad66..b4cf80b 100644 Binary files a/examples/img/AdjustDisplayByArray.png and b/examples/img/AdjustDisplayByArray.png differ diff --git a/examples/img/AdjustDisplayByMethods.png b/examples/img/AdjustDisplayByMethods.png index 08be678..b56a2c1 100644 Binary files a/examples/img/AdjustDisplayByMethods.png and b/examples/img/AdjustDisplayByMethods.png differ diff --git a/examples/img/AdjustDisplayByNeon.png b/examples/img/AdjustDisplayByNeon.png index 337f1f3..9140848 100644 Binary files a/examples/img/AdjustDisplayByNeon.png and b/examples/img/AdjustDisplayByNeon.png differ diff --git a/examples/img/BasicUsage.png b/examples/img/BasicUsage.png index 212bacf..7a5d064 100644 Binary files a/examples/img/BasicUsage.png and b/examples/img/BasicUsage.png differ diff --git a/examples/img/Matrix00.png b/examples/img/Matrix00.png index c6f1918..b837cd2 100644 Binary files a/examples/img/Matrix00.png and b/examples/img/Matrix00.png differ diff --git a/examples/img/Matrix01.png b/examples/img/Matrix01.png index 30633b1..f2ae5e3 100644 Binary files a/examples/img/Matrix01.png and b/examples/img/Matrix01.png differ diff --git a/examples/img/Matrix02.png b/examples/img/Matrix02.png index 3d09cd5..f52f68c 100644 Binary files a/examples/img/Matrix02.png and b/examples/img/Matrix02.png differ diff --git a/examples/img/Matrix03.png b/examples/img/Matrix03.png index a733113..395c34c 100644 Binary files a/examples/img/Matrix03.png and b/examples/img/Matrix03.png differ diff --git a/examples/img/Matrix04.png b/examples/img/Matrix04.png index 11d3611..1f4609d 100644 Binary files a/examples/img/Matrix04.png and b/examples/img/Matrix04.png differ diff --git a/examples/img/Matrix05.png b/examples/img/Matrix05.png index c730815..9f9d695 100644 Binary files a/examples/img/Matrix05.png and b/examples/img/Matrix05.png differ diff --git a/examples/img/Matrix06.png b/examples/img/Matrix06.png index 98bd8b7..8609b50 100644 Binary files a/examples/img/Matrix06.png and b/examples/img/Matrix06.png differ diff --git a/examples/img/Matrix07.png b/examples/img/Matrix07.png index e669539..b0f7a92 100644 Binary files a/examples/img/Matrix07.png and b/examples/img/Matrix07.png differ diff --git a/examples/img/Matrix08.png b/examples/img/Matrix08.png index 140b1e5..d311127 100644 Binary files a/examples/img/Matrix08.png and b/examples/img/Matrix08.png differ diff --git a/examples/img/Matrix09.png b/examples/img/Matrix09.png index def1cbf..dd64b12 100644 Binary files a/examples/img/Matrix09.png and b/examples/img/Matrix09.png differ diff --git a/examples/img/Matrix10.png b/examples/img/Matrix10.png index dc50d8f..80f4a04 100644 Binary files a/examples/img/Matrix10.png and b/examples/img/Matrix10.png differ diff --git a/examples/img/Matrix11.png b/examples/img/Matrix11.png index 4722bdd..d91eb0b 100644 Binary files a/examples/img/Matrix11.png and b/examples/img/Matrix11.png differ diff --git a/examples/img/Matrix12.png b/examples/img/Matrix12.png index e9fbf6f..d30be4e 100644 Binary files a/examples/img/Matrix12.png and b/examples/img/Matrix12.png differ diff --git a/examples/img/Matrix13.png b/examples/img/Matrix13.png index 8354d2b..60df4db 100644 Binary files a/examples/img/Matrix13.png and b/examples/img/Matrix13.png differ diff --git a/examples/img/Matrix14.png b/examples/img/Matrix14.png index a155e73..2ebf61f 100644 Binary files a/examples/img/Matrix14.png and b/examples/img/Matrix14.png differ diff --git a/examples/img/TransparentBackground.png b/examples/img/TransparentBackground.png index c1c57d4..adfdcf7 100644 Binary files a/examples/img/TransparentBackground.png and b/examples/img/TransparentBackground.png differ diff --git a/examples/img/UsingLayers.png b/examples/img/UsingLayers.png index 4fbb732..1aba611 100644 Binary files a/examples/img/UsingLayers.png and b/examples/img/UsingLayers.png differ diff --git a/methods.txt b/methods.txt deleted file mode 100644 index e4ae656..0000000 --- a/methods.txt +++ /dev/null @@ -1,54 +0,0 @@ -Core: - 1 public function __construct() - 2 private function loadConf() - 3 public function config(string|array $configResource) - 4 public function layer(array $layer) - 5 public function layers(array $layers) - 29 public function getConfig(string|null $key = null) - -Attribute: - 6 public function limitX(int|float $lower, int|float $upper) - 7 public function limitY(int|float $lower, int|float $upper) - 8 public function resize(int $width, int $height) - 9 public function frame($xRatio, $yRatio) - 25 public function labelX(string $label) - 26 public function labelY(string $label) - 27 public function caption(string $caption) - 28 public function legends(array $legends) - -StyleCore: - 10 public function bgcolor(string|null $color = null) - 11 public function axis(int $width, string|null $color = null) - 12 public function grid(int $width, string|null $color = null) - 13 public function gridXPitch(int|float $pitch) - 14 public function gridYPitch(int|float $pitch) - - 15 public function colors(array $colors) - 16 public function plotSize(int $size) - 17 public function fontPath(string $path) - 18 public function fontSize(int|float $size) - 19 public function fontColor(string $color) - -StyleAppendix: - 20 public function referenceLineX(int|float $x, int $width = 1, string $color = '#0000ff') - 21 public function referenceLineY(int|float $y, int $width = 1, string $color = '#0000ff') - 22 public function specificationLimitX(int|float $lower, int|float $upper, int $width = 1, string $color = '#ff00ff') - 23 public function specificationLimitY(int|float $lower, int|float $upper, int $width = 1, string $color = '#ff00ff') - 24 public function regressionLine(int $width, array $colors) - -VisibilityCore: - 30 public function gridXOn() - 31 public function gridXOff() - 32 public function gridYOn() - 33 public function gridYOff() - 42 public function legendOff() - -VisibilityAppendix: - 34 public function referenceLineXOff() - 35 public function referenceLineYOff() - 36 public function referenceLinesOff() - 37 public function specificationLimitXOff() - 38 public function specificationLimitYOff() - 39 public function specificationLimitsOff() - 40 public function regressionLineOn() - 41 public function regressionLineOff() diff --git a/src/Analyzer.php b/src/Analyzer.php index 4ae5514..aac5785 100644 --- a/src/Analyzer.php +++ b/src/Analyzer.php @@ -11,7 +11,6 @@ * Class for analysis * @author macocci7 * @license MIT - * @SuppressWarnings(PHPMD.TooManyPublicMethods) */ class Analyzer { diff --git a/src/Plotter.php b/src/Plotter.php index 9ad5500..ba2d68a 100644 --- a/src/Plotter.php +++ b/src/Plotter.php @@ -16,9 +16,6 @@ * Class for plotting * @author macocci7 * @license MIT - * @SuppressWarnings(PHPMD.CyclomaticComplexity) - * @SuppressWarnings(PHPMD.ExcessiveClassComplexity) - * @SuppressWarnings(PHPMD.NPathComplexity) */ class Plotter extends Analyzer {