Compare commits

...

8 Commits

9 changed files with 57 additions and 23 deletions

View File

@ -6,9 +6,6 @@
<Configuration> <Configuration>
<option name="path" value="$PROJECT_DIR$/tests" /> <option name="path" value="$PROJECT_DIR$/tests" />
</Configuration> </Configuration>
<Configuration>
<option name="path" value="$PROJECT_DIR$/tests" />
</Configuration>
</list> </list>
</option> </option>
</component> </component>

View File

@ -42,6 +42,10 @@
<path value="$PROJECT_DIR$/vendor/sebastian/code-unit" /> <path value="$PROJECT_DIR$/vendor/sebastian/code-unit" />
<path value="$PROJECT_DIR$/vendor/sebastian/code-unit-reverse-lookup" /> <path value="$PROJECT_DIR$/vendor/sebastian/code-unit-reverse-lookup" />
<path value="$PROJECT_DIR$/vendor/theseer/tokenizer" /> <path value="$PROJECT_DIR$/vendor/theseer/tokenizer" />
<path value="$PROJECT_DIR$/vendor/mur/tests" />
<path value="$PROJECT_DIR$/vendor/symfony/deprecation-contracts" />
<path value="$PROJECT_DIR$/vendor/symfony/yaml" />
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-ctype" />
</include_path> </include_path>
</component> </component>
<component name="PhpProjectSharedConfiguration" php_language_level="7.4" /> <component name="PhpProjectSharedConfiguration" php_language_level="7.4" />

View File

@ -5,9 +5,6 @@
<PhpSpecSuiteConfiguration> <PhpSpecSuiteConfiguration>
<option name="myPath" value="$PROJECT_DIR$" /> <option name="myPath" value="$PROJECT_DIR$" />
</PhpSpecSuiteConfiguration> </PhpSpecSuiteConfiguration>
<PhpSpecSuiteConfiguration>
<option name="myPath" value="$PROJECT_DIR$" />
</PhpSpecSuiteConfiguration>
</suites> </suites>
</component> </component>
</project> </project>

View File

@ -4,5 +4,5 @@
RUNPHP= RUNPHP=
# Si RUNPHP n'est pas défini, les variables suivantes peuvent être définies # Si RUNPHP n'est pas défini, les variables suivantes peuvent être définies
DIST=d11 DIST=d12
#REGISTRY=pubdocker.univ-reunion.fr #REGISTRY=pubdocker.univ-reunion.fr

32
_merge2php82 Executable file
View File

@ -0,0 +1,32 @@
#!/bin/bash
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
mydir="$(cd "$(dirname -- "$0")"; pwd)"
myself="$mydir/$(basename -- "$0")"
cwd="$(pwd)"
if [ "$mydir" == "$cwd" -o "${mydir#$cwd/}" != "$mydir" ]; then
cp "$myself" /tmp/merge2php82.sh
exec /tmp/merge2php82.sh "$mydir" "$mydir"
else
nulibdir="${2:-$mydir}"
source "$nulibdir/load.sh" || exit 1
fi
args=(
"description"
#"usage"
)
parse_args "$@"; set -- "${args[@]}"
projdir="${1:-.}"
cd "$projdir" || die
edebug "mydir=$mydir, nulibdir=$nulibdir, projdir=$projdir"
git checkout php82
git rebase master ||
die "Le rebase automatique a échoué. Après avoir résolu les conflits, faire
git checkout master
pp -af
"
git checkout master
pp -af

View File

@ -15,12 +15,12 @@
} }
}, },
"require": { "require": {
"symfony/yaml": "^5.0", "symfony/yaml": "^7.1",
"ext-json": "*", "ext-json": "*",
"php": "^7.4" "php": "^8.2"
}, },
"require-dev": { "require-dev": {
"nulib/tests": "7.4", "nulib/tests": "8.2",
"ext-posix": "*", "ext-posix": "*",
"ext-pcntl": "*", "ext-pcntl": "*",
"ext-curl": "*" "ext-curl": "*"

View File

@ -17,7 +17,7 @@ class CsvBuilder extends AbstractBuilder {
parent::__construct($output, $params); parent::__construct($output, $params);
} }
protected function _write(array $row): void { protected function _write(array $row, ?array $colsStyle=null, ?array $rowStyle=null): void {
$this->fputcsv($row); $this->fputcsv($row);
} }

View File

@ -33,6 +33,7 @@ abstract class AbstractBuilder extends TempStream implements IBuilder {
$rows = $params["rows"] ?? null; $rows = $params["rows"] ?? null;
if (is_callable($rows)) $rows = $rows(); if (is_callable($rows)) $rows = $rows();
$this->rows = $rows; $this->rows = $rows;
$this->index = 0;
$cookFunc = $params["cook_func"] ?? null; $cookFunc = $params["cook_func"] ?? null;
$cookCtx = $cookArgs = null; $cookCtx = $cookArgs = null;
if ($cookFunc !== null) { if ($cookFunc !== null) {
@ -55,6 +56,8 @@ abstract class AbstractBuilder extends TempStream implements IBuilder {
protected ?iterable $rows; protected ?iterable $rows;
protected int $index;
protected ?string $output; protected ?string $output;
protected ?array $cookCtx; protected ?array $cookCtx;
@ -69,7 +72,7 @@ abstract class AbstractBuilder extends TempStream implements IBuilder {
$this->headers = $headers; $this->headers = $headers;
} }
protected abstract function _write(array $row): void; protected abstract function _write(array $row, ?array $colsStyle=null, ?array $rowStyle=null): void;
protected bool $wroteHeaders = false; protected bool $wroteHeaders = false;
@ -89,26 +92,27 @@ abstract class AbstractBuilder extends TempStream implements IBuilder {
$row = nur_func::_call($this->cookCtx, $args); $row = nur_func::_call($this->cookCtx, $args);
} }
if ($row !== null) { if ($row !== null) {
foreach ($row as &$value) { foreach ($row as &$col) {
# formatter les dates # formatter les dates
if ($value instanceof DateTime) { if ($col instanceof DateTime) {
$value = $value->format(); $col = $col->format();
} elseif ($value instanceof DateTimeInterface) { } elseif ($col instanceof DateTimeInterface) {
$value = DateTime::with($value)->format(); $col = DateTime::with($col)->format();
} }
}; unset($value); }; unset($col);
} }
return $row; return $row;
} }
function write(?array $row): void { function write(?array $row, ?array $colsStyle=null, ?array $rowStyle=null): void {
$row = $this->cookRow($row); $row = $this->cookRow($row);
if ($row === null) return; if ($row === null) return;
$this->writeHeaders(array_keys($row)); $this->writeHeaders(array_keys($row));
$this->_write($row); $this->_write($row, $colsStyle, $rowStyle);
$this->index++;
} }
function writeAll(?iterable $rows=null): void { function writeAll(?iterable $rows=null, ?array $rowStyle=null): void {
$unsetRows = false; $unsetRows = false;
if ($rows === null) { if ($rows === null) {
$rows = $this->rows; $rows = $this->rows;
@ -116,7 +120,7 @@ abstract class AbstractBuilder extends TempStream implements IBuilder {
} }
if ($rows !== null) { if ($rows !== null) {
foreach ($rows as $row) { foreach ($rows as $row) {
$this->write(cl::with($row)); $this->write(cl::with($row), null, $rowStyle);
} }
} }
if ($unsetRows) $this->rows = null; if ($unsetRows) $this->rows = null;

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 # -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
source /etc/nulib.sh || exit 1 source "$(dirname -- "$0")/../../load.sh" || exit 1
declare -A DESTDIRS=( declare -A DESTDIRS=(
[template-_bg_launcher.php]=sbin [template-_bg_launcher.php]=sbin