modifs.mineures sans commentaires
This commit is contained in:
parent
4b0c79f4c3
commit
ee0ae30257
|
@ -6,7 +6,6 @@
|
||||||
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" packagePrefix="nur\sery\" />
|
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" packagePrefix="nur\sery\" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/nur_src" isTestSource="false" packagePrefix="nur\" />
|
<sourceFolder url="file://$MODULE_DIR$/nur_src" isTestSource="false" packagePrefix="nur\" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/nur_tests" isTestSource="true" packagePrefix="nur\" />
|
<sourceFolder url="file://$MODULE_DIR$/nur_tests" isTestSource="true" packagePrefix="nur\" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor" />
|
<excludeFolder url="file://$MODULE_DIR$/vendor" />
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
"ext-json": "*",
|
"ext-json": "*",
|
||||||
"ext-iconv": "*",
|
"ext-iconv": "*",
|
||||||
"ext-curl": "*",
|
"ext-curl": "*",
|
||||||
|
"ext-tidy": "*",
|
||||||
"ext-oci8": "*",
|
"ext-oci8": "*",
|
||||||
"ext-pdo": "*",
|
"ext-pdo": "*",
|
||||||
"ext-pgsql": "*",
|
"ext-pgsql": "*",
|
||||||
|
@ -37,7 +38,10 @@
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"nur\\sery\\": "src",
|
"nur\\sery\\": "src",
|
||||||
"nur\\": "nur_src"
|
"nur\\": "nur_src"
|
||||||
}
|
},
|
||||||
|
"files": [
|
||||||
|
"nur_autoload.php"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"autoload-dev": {
|
"autoload-dev": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "b812e89a26ebc52585e5908d66151999",
|
"content-hash": "4bd0015796ba3b74f5a4e1a85f3a2287",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "nulib/php",
|
"name": "nulib/php",
|
||||||
|
@ -12,18 +12,23 @@
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "path",
|
"type": "path",
|
||||||
"url": "../nulib",
|
"url": "../nulib",
|
||||||
"reference": "d7323d7d45a73edf8d033253a6b52ae8a3f6e25e"
|
"reference": "2964153e54b269c833810194f16bd9bccc9267ce"
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=7.3"
|
"php": ">=7.4"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"nulib/tests": "7.3"
|
"ext-curl": "*",
|
||||||
|
"nulib/tests": "7.4"
|
||||||
},
|
},
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"nulib\\": "php/src_base"
|
"nulib\\": "php/src_base",
|
||||||
|
"nulib\\ref\\": "php/src_ref",
|
||||||
|
"nulib\\php\\": "php/src_php",
|
||||||
|
"nulib\\output\\": "php/src_output",
|
||||||
|
"nulib\\web\\": "php/src_web"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"autoload-dev": {
|
"autoload-dev": {
|
||||||
|
@ -598,23 +603,23 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpunit/php-code-coverage",
|
"name": "phpunit/php-code-coverage",
|
||||||
"version": "9.2.29",
|
"version": "9.2.30",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
|
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
|
||||||
"reference": "6a3a87ac2bbe33b25042753df8195ba4aa534c76"
|
"reference": "ca2bd87d2f9215904682a9cb9bb37dda98e76089"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/6a3a87ac2bbe33b25042753df8195ba4aa534c76",
|
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ca2bd87d2f9215904682a9cb9bb37dda98e76089",
|
||||||
"reference": "6a3a87ac2bbe33b25042753df8195ba4aa534c76",
|
"reference": "ca2bd87d2f9215904682a9cb9bb37dda98e76089",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"ext-dom": "*",
|
"ext-dom": "*",
|
||||||
"ext-libxml": "*",
|
"ext-libxml": "*",
|
||||||
"ext-xmlwriter": "*",
|
"ext-xmlwriter": "*",
|
||||||
"nikic/php-parser": "^4.15",
|
"nikic/php-parser": "^4.18 || ^5.0",
|
||||||
"php": ">=7.3",
|
"php": ">=7.3",
|
||||||
"phpunit/php-file-iterator": "^3.0.3",
|
"phpunit/php-file-iterator": "^3.0.3",
|
||||||
"phpunit/php-text-template": "^2.0.2",
|
"phpunit/php-text-template": "^2.0.2",
|
||||||
|
@ -664,7 +669,7 @@
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
|
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
|
||||||
"security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy",
|
"security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy",
|
||||||
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.29"
|
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.30"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
|
@ -672,7 +677,7 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2023-09-19T04:57:46+00:00"
|
"time": "2023-12-22T06:47:57+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpunit/php-file-iterator",
|
"name": "phpunit/php-file-iterator",
|
||||||
|
@ -1261,20 +1266,20 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "sebastian/complexity",
|
"name": "sebastian/complexity",
|
||||||
"version": "2.0.2",
|
"version": "2.0.3",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/sebastianbergmann/complexity.git",
|
"url": "https://github.com/sebastianbergmann/complexity.git",
|
||||||
"reference": "739b35e53379900cc9ac327b2147867b8b6efd88"
|
"reference": "25f207c40d62b8b7aa32f5ab026c53561964053a"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/739b35e53379900cc9ac327b2147867b8b6efd88",
|
"url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/25f207c40d62b8b7aa32f5ab026c53561964053a",
|
||||||
"reference": "739b35e53379900cc9ac327b2147867b8b6efd88",
|
"reference": "25f207c40d62b8b7aa32f5ab026c53561964053a",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"nikic/php-parser": "^4.7",
|
"nikic/php-parser": "^4.18 || ^5.0",
|
||||||
"php": ">=7.3"
|
"php": ">=7.3"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
|
@ -1306,7 +1311,7 @@
|
||||||
"homepage": "https://github.com/sebastianbergmann/complexity",
|
"homepage": "https://github.com/sebastianbergmann/complexity",
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/sebastianbergmann/complexity/issues",
|
"issues": "https://github.com/sebastianbergmann/complexity/issues",
|
||||||
"source": "https://github.com/sebastianbergmann/complexity/tree/2.0.2"
|
"source": "https://github.com/sebastianbergmann/complexity/tree/2.0.3"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
|
@ -1314,7 +1319,7 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2020-10-26T15:52:27+00:00"
|
"time": "2023-12-22T06:19:30+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "sebastian/diff",
|
"name": "sebastian/diff",
|
||||||
|
@ -1588,20 +1593,20 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "sebastian/lines-of-code",
|
"name": "sebastian/lines-of-code",
|
||||||
"version": "1.0.3",
|
"version": "1.0.4",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/sebastianbergmann/lines-of-code.git",
|
"url": "https://github.com/sebastianbergmann/lines-of-code.git",
|
||||||
"reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc"
|
"reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/c1c2e997aa3146983ed888ad08b15470a2e22ecc",
|
"url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/e1e4a170560925c26d424b6a03aed157e7dcc5c5",
|
||||||
"reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc",
|
"reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"nikic/php-parser": "^4.6",
|
"nikic/php-parser": "^4.18 || ^5.0",
|
||||||
"php": ">=7.3"
|
"php": ">=7.3"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
|
@ -1633,7 +1638,7 @@
|
||||||
"homepage": "https://github.com/sebastianbergmann/lines-of-code",
|
"homepage": "https://github.com/sebastianbergmann/lines-of-code",
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/sebastianbergmann/lines-of-code/issues",
|
"issues": "https://github.com/sebastianbergmann/lines-of-code/issues",
|
||||||
"source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.3"
|
"source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.4"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
|
@ -1641,7 +1646,7 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2020-11-28T06:42:11+00:00"
|
"time": "2023-12-22T06:20:34+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "sebastian/object-enumerator",
|
"name": "sebastian/object-enumerator",
|
||||||
|
@ -2053,6 +2058,7 @@
|
||||||
"ext-json": "*",
|
"ext-json": "*",
|
||||||
"ext-iconv": "*",
|
"ext-iconv": "*",
|
||||||
"ext-curl": "*",
|
"ext-curl": "*",
|
||||||
|
"ext-tidy": "*",
|
||||||
"ext-oci8": "*",
|
"ext-oci8": "*",
|
||||||
"ext-pdo": "*",
|
"ext-pdo": "*",
|
||||||
"ext-pgsql": "*",
|
"ext-pgsql": "*",
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
<?php
|
||||||
|
## Fonctions qui doivent être disponible tout le temps dans le namespace global
|
||||||
|
|
||||||
|
# pour compatibilité, il est possible de ne pas définir ces fonctions
|
||||||
|
if (!defined("NO_AUTOLOAD_NUR_BASE")) {
|
||||||
|
/** définir $name s'il n'est pas encore défini */
|
||||||
|
function definem($name, $value): void {
|
||||||
|
if (!defined($name)) define($name, $value);
|
||||||
|
}
|
||||||
|
|
||||||
|
# nur\debug
|
||||||
|
function Txx(...$values): void { nur\debug::log(...$values); }
|
||||||
|
|
||||||
|
# nur
|
||||||
|
function q($vs): iterable { return nur\c::q($vs); }
|
||||||
|
}
|
|
@ -24,8 +24,8 @@ class file {
|
||||||
return $file;
|
return $file;
|
||||||
}
|
}
|
||||||
|
|
||||||
static function writer($output, ?callable $func=null): FileWriter {
|
static function writer($output, ?string $mode=null, ?callable $func=null): FileWriter {
|
||||||
$file = new FileWriter($output);
|
$file = new FileWriter($output, $mode);
|
||||||
if ($func !== null) {
|
if ($func !== null) {
|
||||||
try {
|
try {
|
||||||
$func($file);
|
$func($file);
|
||||||
|
|
|
@ -21,7 +21,7 @@ class FileReader extends _File {
|
||||||
if ($mode === null) $mode = static::DEFAULT_MODE;
|
if ($mode === null) $mode = static::DEFAULT_MODE;
|
||||||
$this->file = $file;
|
$this->file = $file;
|
||||||
$this->mode = $mode;
|
$this->mode = $mode;
|
||||||
$fd = null;
|
$fd = $this->open();
|
||||||
$close = true;
|
$close = true;
|
||||||
}
|
}
|
||||||
parent::__construct($fd, $close, $throwOnError, $allowLocking);
|
parent::__construct($fd, $close, $throwOnError, $allowLocking);
|
||||||
|
|
|
@ -24,7 +24,7 @@ class FileWriter extends _File {
|
||||||
IOException::ensure_value(sh::mkdirof($file));
|
IOException::ensure_value(sh::mkdirof($file));
|
||||||
$this->file = $file;
|
$this->file = $file;
|
||||||
$this->mode = $mode;
|
$this->mode = $mode;
|
||||||
$fd = null;
|
$fd = $this->open();
|
||||||
$close = true;
|
$close = true;
|
||||||
}
|
}
|
||||||
parent::__construct($fd, $close, $throwOnError, $allowLocking);
|
parent::__construct($fd, $close, $throwOnError, $allowLocking);
|
||||||
|
|
|
@ -2,13 +2,15 @@
|
||||||
namespace nur\sery\os\file;
|
namespace nur\sery\os\file;
|
||||||
|
|
||||||
use nur\sery\os\IOException;
|
use nur\sery\os\IOException;
|
||||||
|
use nur\sery\os\path;
|
||||||
use nur\sery\web\http;
|
use nur\sery\web\http;
|
||||||
|
|
||||||
class TmpfileWriter extends FileWriter {
|
class TmpfileWriter extends FileWriter {
|
||||||
const DEFAULT_MODE = "w+b";
|
const DEFAULT_MODE = "w+b";
|
||||||
|
|
||||||
function __construct(?string $destdir=null, ?string $mode=null, bool $throwOnError=true, ?bool $allowLocking=null) {
|
function __construct(?string $destdir=null, ?string $mode=null, bool $throwOnError=true, ?bool $allowLocking=null) {
|
||||||
if ($destdir === null) $destdir = sys_get_temp_dir();
|
$tmpDir = sys_get_temp_dir();
|
||||||
|
if ($destdir === null) $destdir = $tmpDir;
|
||||||
if (is_dir($destdir)) {
|
if (is_dir($destdir)) {
|
||||||
# si on spécifie un répertoire, créer un fichier temporaire dedans
|
# si on spécifie un répertoire, créer un fichier temporaire dedans
|
||||||
$file = tempnam($destdir, "tmp_nulib_");
|
$file = tempnam($destdir, "tmp_nulib_");
|
||||||
|
@ -17,6 +19,7 @@ class TmpfileWriter extends FileWriter {
|
||||||
# si on spécifie un fichier qui existe le prendre comme "fichier
|
# si on spécifie un fichier qui existe le prendre comme "fichier
|
||||||
# temporaire" mais ne pas le supprimer automatiquement
|
# temporaire" mais ne pas le supprimer automatiquement
|
||||||
$file = $destdir;
|
$file = $destdir;
|
||||||
|
if (!path::is_qualified($file)) $file = path::join($tmpDir, $file);
|
||||||
$this->delete = false;
|
$this->delete = false;
|
||||||
} else {
|
} else {
|
||||||
# un chemin qui n'existe pas: ne le sélectionner que si le répertoire
|
# un chemin qui n'existe pas: ne le sélectionner que si le répertoire
|
||||||
|
|
|
@ -15,10 +15,12 @@ abstract class _File extends Stream {
|
||||||
/** @var string */
|
/** @var string */
|
||||||
protected $mode;
|
protected $mode;
|
||||||
|
|
||||||
function getResource() {
|
protected function open() {
|
||||||
if ($this->fd === null && $this->file !== null) {
|
return IOException::ensure_value(@fopen($this->file, $this->mode));
|
||||||
$this->fd = IOException::ensure_value(@fopen($this->file, $this->mode));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getResource() {
|
||||||
|
if ($this->fd === null && $this->file !== null) $this->fd = $this->open();
|
||||||
return parent::getResource();
|
return parent::getResource();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue